GuardAuthenticatorHandler
class GuardAuthenticatorHandler
Класс-утилита, выполняющая большую часть работы во время процесса аутентификации стража.
Размещение логики здесь, а не в слушателе, позволяет напрямую вызывать больше этапов процесса (например, для ручной аутентификации) или переопределять их.
Методы
| __construct(TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher = null) | ||
| authenticateWithToken(TokenInterface $token, Request $request) Аутентифицирует данный токен в системе. | ||
| null|Response | handleAuthenticationSuccess(TokenInterface $token, Request $request, GuardAuthenticatorInterface $guardAuthenticator, string $providerKey) Возвращает ответ "при успехе" для данного GuardAuthenticator. | |
| Response|null | authenticateUserAndHandleSuccess(UserInterface $user, Request $request, GuardAuthenticatorInterface $authenticator, string $providerKey) Удобный метод для аутентификации пользователя и возвращения ответа Response при успехе (если таковой есть). | |
| null|Response | handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, GuardAuthenticatorInterface $guardAuthenticator, string $providerKey) Обрабатывает неудачную аутентификацию и возвращает ответ Response для GuardAuthenticator. |
Детали
__construct(TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher = null)
Параметры
| TokenStorageInterface | $tokenStorage | |
| EventDispatcherInterface | $eventDispatcher |
authenticateWithToken(TokenInterface $token, Request $request)
Аутентифицирует данный токен в системе.
Параметры
| TokenInterface | $token | |
| Request | $request |
null|Response handleAuthenticationSuccess(TokenInterface $token, Request $request, GuardAuthenticatorInterface $guardAuthenticator, string $providerKey)
Возвращает ответ "при успехе" для данного GuardAuthenticator.
Параметры
| TokenInterface | $token | |
| Request | $request | |
| GuardAuthenticatorInterface | $guardAuthenticator | |
| string | $providerKey | Ключ провайдера (т.е. фаервола) |
Возвращаемое значение
| null|Response |
Response|null authenticateUserAndHandleSuccess(UserInterface $user, Request $request, GuardAuthenticatorInterface $authenticator, string $providerKey)
Удобный метод для аутентификации пользователя и возвращения ответа Response при успехе (если таковой есть).
Параметры
| UserInterface | $user | |
| Request | $request | |
| GuardAuthenticatorInterface | $authenticator | |
| string | $providerKey | Ключ провайдера (т.е. фаервола) |
Возвращаемое значение
| Response|null |
null|Response handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, GuardAuthenticatorInterface $guardAuthenticator, string $providerKey)
Обрабатывает неудачную аутентификацию и возвращает ответ Response для GuardAuthenticator.
Параметры
| AuthenticationException | $authenticationException | |
| Request | $request | |
| GuardAuthenticatorInterface | $guardAuthenticator | |
| string | $providerKey | Ключ фаервола |
Возвращаемое значение
| null|Response |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.2/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.html