feat(upgrade): add compliance with symfony 6.2
This commit is contained in:
parent
79c799748b
commit
ce4deb24f8
|
@ -18,6 +18,10 @@ use Symfony\Component\Security\Csrf\CsrfToken;
|
|||
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
|
||||
use Symfony\Component\Security\Http\Util\TargetPathTrait;
|
||||
use Symfony\Component\Security\Http\Authenticator\AbstractLoginFormAuthenticator;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge;
|
||||
|
||||
class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
|
||||
{
|
||||
|
@ -44,6 +48,21 @@ class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
|
|||
return 'auth_login' === $request->attributes->get('_route') && $request->isMethod('POST');
|
||||
}
|
||||
|
||||
public function authenticate(Request $request): Passport
|
||||
{
|
||||
$id = $request->request->get('id', '');
|
||||
|
||||
$request->getSession()->set(Security::LAST_USERNAME, $id);
|
||||
|
||||
return new Passport(
|
||||
new UserBadge($id),
|
||||
new PasswordCredentials($request->request->get('password', '')),
|
||||
[
|
||||
new CsrfTokenBadge('authenticate', $request->request->get('_csrf_token')),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function getCredentials(Request $request)
|
||||
{
|
||||
$credentials = [
|
||||
|
|
Loading…
Reference in a new issue