You are here

public function BasicAuth::applies in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php \Drupal\basic_auth\Authentication\Provider\BasicAuth::applies()

Checks whether suitable authentication credentials are on the request.

Parameters

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

Return value

bool TRUE if authentication credentials suitable for this provider are on the request, FALSE otherwise.

Overrides AuthenticationProviderInterface::applies

File

core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php, line 75
Contains \Drupal\basic_auth\Authentication\Provider\BasicAuth.

Class

BasicAuth
HTTP Basic authentication provider.

Namespace

Drupal\basic_auth\Authentication\Provider

Code

public function applies(Request $request) {
  $username = $request->headers
    ->get('PHP_AUTH_USER');
  $password = $request->headers
    ->get('PHP_AUTH_PW');
  return isset($username) && isset($password);
}