From 74d0b24f5fb020c76b4895250778c65fdc275d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sat, 8 Apr 2023 19:35:02 +0200 Subject: [PATCH 1/2] RVRNEXT-2 make endpoint names simpler --- web.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web.php b/web.php index ac60ae3..84e0e70 100644 --- a/web.php +++ b/web.php @@ -23,8 +23,8 @@ Container::$routeCollection->group('login', function (SokoWeb\Routing\RouteColle Container::$routeCollection->group('oauth', function (SokoWeb\Routing\RouteCollection $routeCollection) { $routeCollection->get('oauth-start', 'start', [RVR\Controller\OAuthLoginController::class, 'startOauth']); $routeCollection->get('oauth-finish', 'finish', [RVR\Controller\OAuthLoginController::class, 'finishOauth']); - $routeCollection->get('oauth-getToken', 'getToken', [RVR\Controller\OAuthLoginController::class, 'getToken']); - $routeCollection->get('oauth-getJwtPublicKey', 'getJwtPublicKey', [RVR\Controller\OAuthLoginController::class, 'getJwtPublicKey']); + $routeCollection->get('oauth-token', 'token', [RVR\Controller\OAuthLoginController::class, 'getToken']); + $routeCollection->get('oauth-jwtPublicKey', 'jwtPublicKey', [RVR\Controller\OAuthLoginController::class, 'getJwtPublicKey']); }); Container::$routeCollection->group('password', function (SokoWeb\Routing\RouteCollection $routeCollection) { $routeCollection->get('password-requestReset', 'requestReset', [RVR\Controller\LoginController::class, 'getRequestPasswordResetForm']); -- 2.45.2 From 120048918632ae058215a097b5136ad3b85e4cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sat, 8 Apr 2023 19:36:05 +0200 Subject: [PATCH 2/2] RVRNEXT-2 token endpoint should be POST --- src/Controller/OAuthLoginController.php | 2 +- web.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Controller/OAuthLoginController.php b/src/Controller/OAuthLoginController.php index 0e3fec5..c0d226a 100644 --- a/src/Controller/OAuthLoginController.php +++ b/src/Controller/OAuthLoginController.php @@ -89,7 +89,7 @@ class OAuthLoginController { $oAuthTokenRepository = new OAuthTokenRepository(); $userRepository = new UserRepository(); - $token = $oAuthTokenRepository->getByCode($this->request->query('code')); + $token = $oAuthTokenRepository->getByCode($this->request->post('code')); if ($token === null || $token->getExpiresDate() < new DateTime()) { return new JsonContent([ diff --git a/web.php b/web.php index 84e0e70..4de9e66 100644 --- a/web.php +++ b/web.php @@ -23,7 +23,7 @@ Container::$routeCollection->group('login', function (SokoWeb\Routing\RouteColle Container::$routeCollection->group('oauth', function (SokoWeb\Routing\RouteCollection $routeCollection) { $routeCollection->get('oauth-start', 'start', [RVR\Controller\OAuthLoginController::class, 'startOauth']); $routeCollection->get('oauth-finish', 'finish', [RVR\Controller\OAuthLoginController::class, 'finishOauth']); - $routeCollection->get('oauth-token', 'token', [RVR\Controller\OAuthLoginController::class, 'getToken']); + $routeCollection->post('oauth-token', 'token', [RVR\Controller\OAuthLoginController::class, 'getToken']); $routeCollection->get('oauth-jwtPublicKey', 'jwtPublicKey', [RVR\Controller\OAuthLoginController::class, 'getJwtPublicKey']); }); Container::$routeCollection->group('password', function (SokoWeb\Routing\RouteCollection $routeCollection) { -- 2.45.2