AuthenticationManager::defaultFilter

protected AuthenticationManager::defaultFilter(Request $request, $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.

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.

File

core/lib/Drupal/Core/Authentication/AuthenticationManager.php, line 174

Class

AuthenticationManager
Manager for authentication.

Namespace

Drupal\Core\Authentication

Code

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);
  }
}
doc_Drupal
2016-10-29 08:45:12
Comments
Leave a Comment

Please login to continue.