You are here

class UsersJwtRequestPolicy in JSON Web Token Authentication (JWT) 8

Cache policy for pages served from JWT auth.

This policy disallows caching of requests that use users_jwt_auth. Otherwise, responses for authenticated requests can get into the page cache and could be delivered to unprivileged users.

Hierarchy

Expanded class hierarchy of UsersJwtRequestPolicy

1 string reference to 'UsersJwtRequestPolicy'
users_jwt.services.yml in modules/users_jwt/users_jwt.services.yml
modules/users_jwt/users_jwt.services.yml
1 service uses UsersJwtRequestPolicy
users_jwt.page_cache_request_policy in modules/users_jwt/users_jwt.services.yml
Drupal\users_jwt\PageCache\UsersJwtRequestPolicy

File

modules/users_jwt/src/PageCache/UsersJwtRequestPolicy.php, line 16

Namespace

Drupal\users_jwt\PageCache
View source
class UsersJwtRequestPolicy implements RequestPolicyInterface {

  /**
   * {@inheritdoc}
   */
  public function check(Request $request) {
    if (UsersJwtAuth::getJwtFromRequest($request)) {
      return self::DENY;
    }
    return NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RequestPolicyInterface::ALLOW constant Allow delivery of cached pages.
RequestPolicyInterface::DENY constant Deny delivery of cached pages.
UsersJwtRequestPolicy::check public function Determines whether delivery of a cached page should be attempted. Overrides RequestPolicyInterface::check