diff options
author | provokateurin <kate@provokateurin.de> | 2024-01-10 12:35:44 +0100 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-02-21 12:07:50 +0100 |
commit | 2c51933b6bc5e8f2633114e9acc493fb72a314d7 (patch) | |
tree | 43100b132f7e9cd4e899edf0584884c7fa9f0cbc /core/Controller/AppPasswordController.php | |
parent | 0117cd26940f2b0dcfd92ccf663bcf8853437193 (diff) | |
download | nextcloud-server-2c51933b6bc5e8f2633114e9acc493fb72a314d7.tar.gz nextcloud-server-2c51933b6bc5e8f2633114e9acc493fb72a314d7.zip |
refactor(core): Switch to attribute based routing
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'core/Controller/AppPasswordController.php')
-rw-r--r-- | core/Controller/AppPasswordController.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/Controller/AppPasswordController.php b/core/Controller/AppPasswordController.php index 2575729fe85..11aca8ef329 100644 --- a/core/Controller/AppPasswordController.php +++ b/core/Controller/AppPasswordController.php @@ -33,6 +33,7 @@ use OC\Authentication\Token\IProvider; use OC\Authentication\Token\IToken; use OC\User\Session; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\ApiRoute; use OCP\AppFramework\Http\Attribute\UseSession; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSForbiddenException; @@ -74,6 +75,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController { * * 200: App password returned */ + #[ApiRoute(verb: 'GET', url: '/getapppassword', root: '/core')] public function getAppPassword(): DataResponse { // We do not allow the creation of new tokens if this is an app password if ($this->session->exists('app_password')) { @@ -125,6 +127,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController { * * 200: App password deleted successfully */ + #[ApiRoute(verb: 'DELETE', url: '/apppassword', root: '/core')] public function deleteAppPassword(): DataResponse { if (!$this->session->exists('app_password')) { throw new OCSForbiddenException('no app password in use'); @@ -152,6 +155,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController { * * 200: App password returned */ + #[ApiRoute(verb: 'POST', url: '/apppassword/rotate', root: '/core')] public function rotateAppPassword(): DataResponse { if (!$this->session->exists('app_password')) { throw new OCSForbiddenException('no app password in use'); @@ -187,6 +191,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController { * 403: Password confirmation failed */ #[UseSession] + #[ApiRoute(verb: 'PUT', url: '/apppassword/confirm', root: '/core')] public function confirmUserPassword(string $password): DataResponse { $loginName = $this->userSession->getLoginName(); $loginResult = $this->userManager->checkPassword($loginName, $password); |