AuthenticationManager
class AuthenticationManager implements AuthenticationProviderInterface, AuthenticationProviderFilterInterface, AuthenticationProviderChallengeInterface (View source)
Manager for authentication.
On each request, let all authentication providers try to authenticate the user. The providers are iterated according to their priority and the first provider detecting credentials for its method wins. No further provider will get triggered.
If no provider sets an active user then the user remains anonymous.
Properties
| protected AuthenticationCollectorInterface | $authCollector | The authentication provider collector. |
Methods
Creates a new authentication manager instance.
Checks whether suitable authentication credentials are on the request.
Authenticates the user.
Checks whether the authentication method is allowed on a given route.
Constructs an exception which is used to generate the challenge.
Returns the id of the authentication provider for a request.
Returns the ID of the challenge provider for a request.
Checks whether a provider is allowed on the given request.
Default implementation of the provider filter.
Details
__construct(AuthenticationCollectorInterface $auth_collector)
Creates a new authentication manager instance.
bool
applies(Request $request)
Checks whether suitable authentication credentials are on the request.
AccountInterface|null
authenticate(Request $request)
Authenticates the user.
bool
appliesToRoutedRequest(Request $request, bool $authenticated)
Checks whether the authentication method is allowed on a given route.
While authentication itself is run before routing, this method is called after routing, hence RouteMatch is available and can be used to inspect route options.
HttpExceptionInterface|null
challengeException(Request $request, Exception $previous)
Constructs an exception which is used to generate the challenge.
protected string|null
getProvider(Request $request)
Returns the id of the authentication provider for a request.
protected string|null
getChallenger(Request $request)
Returns the ID of the challenge provider for a request.
protected bool
applyFilter(Request $request, bool $authenticated, string $provider_id)
Checks whether a provider is allowed on the given request.
If no filter is registered for the given provider id, the default filter is applied.
protected bool
defaultFilter(Request $request, string $provider_id)
Default implementation of the provider filter.
Checks whether a provider is allowed as per the _auth option on a route. If the option is not set or if the request did not match any route, only providers from the global provider set are allowed.
If no filter is registered for the given provider id, the default filter is applied.