From a21bff82bcca923a2e37fe39006d9e65fcd4663a Mon Sep 17 00:00:00 2001 From: rudy Date: Fri, 6 Jan 2023 14:02:20 +0100 Subject: [PATCH] =?UTF-8?q?baseUrl:=20modification=20pour=20la=20construct?= =?UTF-8?q?ion=20de=20l'url=20apr=C3=A8s=20acces,=20utilsation=20de=20base?= =?UTF-8?q?Url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/services.yaml | 4 ++++ src/Hydra/HydraService.php | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config/services.yaml b/config/services.yaml index cebc5f0..2b7950e 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -48,6 +48,10 @@ services: arguments: $baseUrl: '%base_url%' + App\Hydra\HydraService: + arguments: + $baseUrl: '%base_url%' + App\SQLLogin\SQLLoginRequest: arguments: $config: [] diff --git a/src/Hydra/HydraService.php b/src/Hydra/HydraService.php index 6bfad86..4378f1b 100644 --- a/src/Hydra/HydraService.php +++ b/src/Hydra/HydraService.php @@ -15,12 +15,14 @@ class HydraService extends AbstractController public SessionInterface $session; public Client $client; public TokenStorageInterface $tokenStorage; + public string $baseUrl; - public function __construct(Client $client, SessionInterface $session, TokenStorageInterface $tokenStorage) + public function __construct(Client $client, SessionInterface $session, TokenStorageInterface $tokenStorage, string $baseUrl) { $this->session = $session; $this->client = $client; $this->tokenStorage = $tokenStorage; + $this->baseUrl = $baseUrl; } public function handleLoginRequest(Request $request) @@ -40,7 +42,7 @@ class HydraService extends AbstractController // si le challenge est validé par hydra, on le stocke en session pour l'utiliser par la suite et on redirige vers une route interne protégée qui va déclencher l'identification FranceConnect $this->session->set('challenge', $loginRequestInfo['challenge']); - return $this->redirectToRoute('app_login'); + return new RedirectResponse($this->baseUrl.'/login'); } public function handleConsentRequest(Request $request) -- 2.17.1