From 94fbf3e9b33a1d25855fc47dd918a5f57850084b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 15 Jul 2024 15:49:32 +0200 Subject: [PATCH] fix: Add direct parameter to flow auth v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- core/Controller/ClientFlowLoginV2Controller.php | 10 ++++++---- core/templates/loginflowv2/authpicker.php | 2 +- core/templates/loginflowv2/grant.php | 3 +++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index f5bd2d216dde3..915a130193a11 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -100,7 +100,7 @@ public function poll(string $token): JSONResponse { */ #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] #[UseSession] - public function landing(string $token, $user = ''): Response { + public function landing(string $token, string $user = '', int $direct = 0): Response { if (!$this->loginFlowV2Service->startLoginFlow($token)) { return $this->loginTokenForbiddenResponse(); } @@ -108,7 +108,7 @@ public function landing(string $token, $user = ''): Response { $this->session->set(self::TOKEN_NAME, $token); return new RedirectResponse( - $this->urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.showAuthPickerPage', ['user' => $user]) + $this->urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.showAuthPickerPage', ['user' => $user, 'direct' => $direct]) ); } @@ -118,7 +118,7 @@ public function landing(string $token, $user = ''): Response { */ #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] #[UseSession] - public function showAuthPickerPage($user = ''): StandaloneTemplateResponse { + public function showAuthPickerPage(string $user = '', int $direct = 0): StandaloneTemplateResponse { try { $flow = $this->getFlowByLoginToken(); } catch (LoginFlowV2NotFoundException $e) { @@ -140,6 +140,7 @@ public function showAuthPickerPage($user = ''): StandaloneTemplateResponse { 'urlGenerator' => $this->urlGenerator, 'stateToken' => $stateToken, 'user' => $user, + 'direct' => $direct, ], 'guest' ); @@ -152,7 +153,7 @@ public function showAuthPickerPage($user = ''): StandaloneTemplateResponse { */ #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] #[UseSession] - public function grantPage(?string $stateToken): StandaloneTemplateResponse { + public function grantPage(?string $stateToken, int $direct = 0): StandaloneTemplateResponse { if ($stateToken === null) { return $this->stateTokenMissingResponse(); } @@ -179,6 +180,7 @@ public function grantPage(?string $stateToken): StandaloneTemplateResponse { 'instanceName' => $this->defaults->getName(), 'urlGenerator' => $this->urlGenerator, 'stateToken' => $stateToken, + 'direct' => $direct, ], 'guest' ); diff --git a/core/templates/loginflowv2/authpicker.php b/core/templates/loginflowv2/authpicker.php index 0e18cc99ce15f..a3cb4be7db3a9 100644 --- a/core/templates/loginflowv2/authpicker.php +++ b/core/templates/loginflowv2/authpicker.php @@ -46,7 +46,7 @@
+

diff --git a/core/templates/loginflowv2/grant.php b/core/templates/loginflowv2/grant.php index 567c3b4e7760e..599e612010bf6 100644 --- a/core/templates/loginflowv2/grant.php +++ b/core/templates/loginflowv2/grant.php @@ -48,6 +48,9 @@
+ + +