function AuthenticationManager::defaultFilter
Same name in other branches
- 9 core/lib/Drupal/Core/Authentication/AuthenticationManager.php \Drupal\Core\Authentication\AuthenticationManager::defaultFilter()
- 8.9.x core/lib/Drupal/Core/Authentication/AuthenticationManager.php \Drupal\Core\Authentication\AuthenticationManager::defaultFilter()
- 11.x core/lib/Drupal/Core/Authentication/AuthenticationManager.php \Drupal\Core\Authentication\AuthenticationManager::defaultFilter()
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.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The incoming request.
string $provider_id: The id of the authentication provider to check access for.
Return value
bool TRUE if provider is allowed, FALSE otherwise.
1 call to AuthenticationManager::defaultFilter()
- AuthenticationManager::applyFilter in core/
lib/ Drupal/ Core/ Authentication/ AuthenticationManager.php - Checks whether a provider is allowed on the given request.
File
-
core/
lib/ Drupal/ Core/ Authentication/ AuthenticationManager.php, line 174
Class
- AuthenticationManager
- Manager for authentication.
Namespace
Drupal\Core\AuthenticationCode
protected function defaultFilter(Request $request, $provider_id) {
$route = RouteMatch::createFromRequest($request)->getRouteObject();
$has_auth_option = isset($route) && $route->hasOption('_auth');
if ($has_auth_option) {
return in_array($provider_id, $route->getOption('_auth'));
}
else {
return $this->authCollector
->isGlobal($provider_id);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.