You are here

protected function AuthenticationManager::defaultFilter in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 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 179
Contains \Drupal\Core\Authentication\AuthenticationManager.

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);
  }
}