Merge pull request 'baseUrl: utilisation baseUrl en cas de failure' (#5) from baseUrl2 into develop
All checks were successful
Cadoles/hydra-sql/pipeline/head This commit looks good

Reviewed-on: #5
This commit is contained in:
Rudy Masson 2023-01-06 14:32:32 +01:00
commit 0996ce6402

View File

@ -10,7 +10,6 @@ use PDOException;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
@ -29,14 +28,12 @@ class SQLLoginUserAuthenticator extends AbstractAuthenticator
protected string $baseUrl; protected string $baseUrl;
private SQLLoginService $sqlLoginService; private SQLLoginService $sqlLoginService;
private UrlGeneratorInterface $router;
private PasswordEncoder $passwordHasher; private PasswordEncoder $passwordHasher;
public function __construct(string $baseUrl, SQLLoginService $sqlLoginService, UrlGeneratorInterface $router, PasswordEncoder $passwordHasher) public function __construct(string $baseUrl, SQLLoginService $sqlLoginService, PasswordEncoder $passwordHasher)
{ {
$this->baseUrl = $baseUrl; $this->baseUrl = $baseUrl;
$this->sqlLoginService = $sqlLoginService; $this->sqlLoginService = $sqlLoginService;
$this->router = $router;
$this->passwordHasher = $passwordHasher; $this->passwordHasher = $passwordHasher;
} }
@ -59,9 +56,7 @@ class SQLLoginUserAuthenticator extends AbstractAuthenticator
{ {
$request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception); $request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception);
return new RedirectResponse( return new RedirectResponse($this->baseUrl.'/connect/login-accept');
$this->router->generate('app_login')
);
} }
public function authenticate(Request $request): Passport public function authenticate(Request $request): Passport