function DisallowBasicAuthRequests::check

Same name in other branches
  1. 9 core/modules/basic_auth/src/PageCache/DisallowBasicAuthRequests.php \Drupal\basic_auth\PageCache\DisallowBasicAuthRequests::check()
  2. 8.9.x core/modules/basic_auth/src/PageCache/DisallowBasicAuthRequests.php \Drupal\basic_auth\PageCache\DisallowBasicAuthRequests::check()
  3. 11.x core/modules/basic_auth/src/PageCache/DisallowBasicAuthRequests.php \Drupal\basic_auth\PageCache\DisallowBasicAuthRequests::check()

File

core/modules/basic_auth/src/PageCache/DisallowBasicAuthRequests.php, line 20

Class

DisallowBasicAuthRequests
Cache policy for pages served from basic auth.

Namespace

Drupal\basic_auth\PageCache

Code

public function check(Request $request) {
    $username = $request->headers
        ->get('PHP_AUTH_USER');
    $password = $request->headers
        ->get('PHP_AUTH_PW');
    if (isset($username) && isset($password)) {
        return self::DENY;
    }
}

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