interface AuthenticationProviderFilterInterface (View source)

Restrict authentication methods to a subset of the site.

Some authentication methods should not be available throughout a whole site. For instance, there are good reasons to restrict insecure methods like HTTP basic authentication or a URL token authentication method to API-only routes.

Methods

bool
appliesToRoutedRequest(Request $request, bool $authenticated)

Checks whether the authentication method is allowed on a given route.

Details

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.

Parameters

Request $request

The request.

bool $authenticated

Whether or not the request is authenticated.

Return Value

bool

TRUE if an authentication method is allowed on the request, otherwise FALSE.