function BasicAuth::applies

Same name and namespace in other branches
  1. 9 core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php \Drupal\basic_auth\Authentication\Provider\BasicAuth::applies()
  2. 10 core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php \Drupal\basic_auth\Authentication\Provider\BasicAuth::applies()
  3. 11.x core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php \Drupal\basic_auth\Authentication\Provider\BasicAuth::applies()

Overrides AuthenticationProviderInterface::applies

File

core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php, line 79

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.