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.0/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.html