From 1746331ad50891472db9fd2d85c74a1fc8c10e59 Mon Sep 17 00:00:00 2001 From: Thibault Buathier Date: Mon, 2 Jul 2018 12:36:55 +0200 Subject: [PATCH 1/2] catch OAuth2ServerException on authorizeAction --- Controller/AuthorizeController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Controller/AuthorizeController.php b/Controller/AuthorizeController.php index 46c75fca..c64aa4b0 100644 --- a/Controller/AuthorizeController.php +++ b/Controller/AuthorizeController.php @@ -171,7 +171,11 @@ public function authorizeAction(Request $request) if ($event->isAuthorizedClient()) { $scope = $request->get('scope', null); - return $this->oAuth2Server->finishClientAuthorization(true, $user, $request, $scope); + try { + return $this->oAuth2Server->finishClientAuthorization(true, $user, $request, $scope); + } catch (OAuth2ServerException $e) { + return $e->getHttpResponse(); + } } if (true === $formHandler->process()) { From 4f309fbaf06af46652f73da10064ff7b3505dfe7 Mon Sep 17 00:00:00 2001 From: Thibault Buathier Date: Mon, 2 Jul 2018 12:43:23 +0200 Subject: [PATCH 2/2] fix indent --- Controller/AuthorizeController.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Controller/AuthorizeController.php b/Controller/AuthorizeController.php index c64aa4b0..60ffe931 100644 --- a/Controller/AuthorizeController.php +++ b/Controller/AuthorizeController.php @@ -171,11 +171,11 @@ public function authorizeAction(Request $request) if ($event->isAuthorizedClient()) { $scope = $request->get('scope', null); - try { - return $this->oAuth2Server->finishClientAuthorization(true, $user, $request, $scope); - } catch (OAuth2ServerException $e) { - return $e->getHttpResponse(); - } + try { + return $this->oAuth2Server->finishClientAuthorization(true, $user, $request, $scope); + } catch (OAuth2ServerException $e) { + return $e->getHttpResponse(); + } } if (true === $formHandler->process()) { @@ -217,7 +217,7 @@ protected function processSuccess(UserInterface $user, AuthorizeFormHandler $for try { return $this->oAuth2Server ->finishClientAuthorization($formHandler->isAccepted(), $user, $request, $formHandler->getScope()) - ; + ; } catch (OAuth2ServerException $e) { return $e->getHttpResponse(); }