You are here

protected function AuthenticationManager::applyFilter in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Authentication/AuthenticationManager.php \Drupal\Core\Authentication\AuthenticationManager::applyFilter()

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.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The incoming request.

bool $authenticated: Whether or not the request is authenticated.

string $provider_id: The id of the authentication provider to check access for.

Return value

bool TRUE if provider is allowed, FALSE otherwise.

2 calls to AuthenticationManager::applyFilter()
AuthenticationManager::appliesToRoutedRequest in core/lib/Drupal/Core/Authentication/AuthenticationManager.php
Checks whether the authentication method is allowed on a given route.
AuthenticationManager::getChallenger in core/lib/Drupal/Core/Authentication/AuthenticationManager.php
Returns the ID of the challenge provider for a request.

File

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

Class

AuthenticationManager
Manager for authentication.

Namespace

Drupal\Core\Authentication

Code

protected function applyFilter(Request $request, $authenticated, $provider_id) {
  $provider = $this->authCollector
    ->getProvider($provider_id);
  if ($provider && $provider instanceof AuthenticationProviderFilterInterface) {
    $result = $provider
      ->appliesToRoutedRequest($request, $authenticated);
  }
  else {
    $result = $this
      ->defaultFilter($request, $provider_id);
  }
  return $result;
}