Compare commits
No commits in common. "437a40e309c49b515565445948f938f3bb7efef9" and "0996ce64022f582ec2f9ef246ea1305dd3194974" have entirely different histories.
437a40e309
...
0996ce6402
|
@ -23,6 +23,14 @@ security:
|
||||||
custom_authenticators:
|
custom_authenticators:
|
||||||
- App\Security\SQLLoginUserAuthenticator
|
- App\Security\SQLLoginUserAuthenticator
|
||||||
|
|
||||||
|
entry_point: form_login
|
||||||
|
form_login:
|
||||||
|
login_path: app_login
|
||||||
|
check_path: app_login
|
||||||
|
username_parameter: login
|
||||||
|
password_parameter: password
|
||||||
|
enable_csrf: true
|
||||||
|
|
||||||
login_throttling:
|
login_throttling:
|
||||||
max_attempts: 3
|
max_attempts: 3
|
||||||
logout: true
|
logout: true
|
||||||
|
|
|
@ -13,13 +13,13 @@ use Symfony\Component\HttpFoundation\Response;
|
||||||
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;
|
||||||
use Symfony\Component\Security\Http\Authenticator\AbstractLoginFormAuthenticator;
|
use Symfony\Component\Security\Http\Authenticator\AbstractAuthenticator;
|
||||||
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge;
|
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge;
|
||||||
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
|
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
|
||||||
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
|
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
|
||||||
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
|
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
|
||||||
|
|
||||||
class SQLLoginUserAuthenticator extends AbstractLoginFormAuthenticator
|
class SQLLoginUserAuthenticator extends AbstractAuthenticator
|
||||||
{
|
{
|
||||||
public const LOGIN_ROUTE = 'app_login';
|
public const LOGIN_ROUTE = 'app_login';
|
||||||
public const ERROR_LOGIN = 'error_login';
|
public const ERROR_LOGIN = 'error_login';
|
||||||
|
@ -52,11 +52,11 @@ class SQLLoginUserAuthenticator extends AbstractLoginFormAuthenticator
|
||||||
return new RedirectResponse($this->baseUrl.'/connect/login-accept');
|
return new RedirectResponse($this->baseUrl.'/connect/login-accept');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response
|
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
|
||||||
{
|
{
|
||||||
$request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception);
|
$request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception);
|
||||||
|
|
||||||
return new RedirectResponse($this->baseUrl.'/login');
|
return new RedirectResponse($this->baseUrl.'/connect/login-accept');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function authenticate(Request $request): Passport
|
public function authenticate(Request $request): Passport
|
||||||
|
@ -100,9 +100,4 @@ class SQLLoginUserAuthenticator extends AbstractLoginFormAuthenticator
|
||||||
$request->getSession()->set(self::ERROR_LOGIN, true);
|
$request->getSession()->set(self::ERROR_LOGIN, true);
|
||||||
throw new AuthenticationException();
|
throw new AuthenticationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getLoginUrl(Request $request): string
|
|
||||||
{
|
|
||||||
return $this->baseUrl.'/login';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue