Differential D9859 Diff 23678 src/applications/conduit/method/ConduitAPI_conduit_getcertificate_Method.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conduit/method/ConduitAPI_conduit_getcertificate_Method.php
| <?php | <?php | ||||
| /** | |||||
| * @group conduit | |||||
| */ | |||||
| final class ConduitAPI_conduit_getcertificate_Method extends ConduitAPIMethod { | final class ConduitAPI_conduit_getcertificate_Method extends ConduitAPIMethod { | ||||
| public function shouldRequireAuthentication() { | public function shouldRequireAuthentication() { | ||||
| return false; | return false; | ||||
| } | } | ||||
| public function shouldAllowUnguardedWrites() { | public function shouldAllowUnguardedWrites() { | ||||
| // This method performs logging and is on the authentication pathway. | // This method performs logging and is on the authentication pathway. | ||||
| ▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | protected function execute(ConduitAPIRequest $request) { | ||||
| return array( | return array( | ||||
| 'username' => $user->getUserName(), | 'username' => $user->getUserName(), | ||||
| 'certificate' => $user->getConduitCertificate(), | 'certificate' => $user->getConduitCertificate(), | ||||
| ); | ); | ||||
| } | } | ||||
| private function logFailure( | private function logFailure( | ||||
| ConduitAPIRequest $request, | ConduitAPIRequest $request, | ||||
| PhabricatorConduitCertificateToken $info = null) { | PhabricatorConduitCertificateToken $info = null) { | ||||
| $log = PhabricatorUserLog::initializeNewLog( | $log = PhabricatorUserLog::initializeNewLog( | ||||
| $request->getUser(), | $request->getUser(), | ||||
| $info ? $info->getUserPHID() : '-', | $info ? $info->getUserPHID() : '-', | ||||
| PhabricatorUserLog::ACTION_CONDUIT_CERTIFICATE_FAILURE) | PhabricatorUserLog::ACTION_CONDUIT_CERTIFICATE_FAILURE) | ||||
| ->save(); | ->save(); | ||||
| } | } | ||||
| } | } | ||||