You are here

class DisallowOauth2Requests in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x src/PageCache/DisallowOauth2Requests.php \Drupal\oauth2_server\PageCache\DisallowOauth2Requests

Class Disallow Oauth2 Requests.

@package Drupal\oauth2_server\PageCache

Hierarchy

Expanded class hierarchy of DisallowOauth2Requests

1 string reference to 'DisallowOauth2Requests'
oauth2_server.services.yml in ./oauth2_server.services.yml
oauth2_server.services.yml
1 service uses DisallowOauth2Requests
oauth2_server.page_cache_request_policy.disallow_oauth2_token_requests in ./oauth2_server.services.yml
Drupal\oauth2_server\PageCache\DisallowOauth2Requests

File

src/PageCache/DisallowOauth2Requests.php, line 13

Namespace

Drupal\oauth2_server\PageCache
View source
class DisallowOauth2Requests implements Oauth2RequestPolicyInterface {

  /**
   * The authentication provider.
   *
   * @var \Drupal\oauth2_server\Authentication\Provider\OAuth2DrupalAuthProvider
   */
  private $authProvider;

  /**
   * DisallowOauth2Requests constructor.
   *
   * @param \Drupal\oauth2_server\Authentication\Provider\OAuth2DrupalAuthProvider $auth_provider
   *   The authentication provider.
   */
  public function __construct(OAuth2DrupalAuthProvider $auth_provider) {
    $this->authProvider = $auth_provider;
  }

  /**
   * {@inheritdoc}
   */
  public function isOauth2Request(Request $request) {
    return $this->authProvider
      ->applies($request);
  }

  /**
   * {@inheritdoc}
   */
  public function check(Request $request) {
    return $this
      ->isOauth2Request($request) ? static::DENY : NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DisallowOauth2Requests::$authProvider private property The authentication provider.
DisallowOauth2Requests::check public function Determines whether delivery of a cached page should be attempted. Overrides RequestPolicyInterface::check
DisallowOauth2Requests::isOauth2Request public function Returns a state whether the request has an OAuth2 access token. Overrides Oauth2RequestPolicyInterface::isOauth2Request
DisallowOauth2Requests::__construct public function DisallowOauth2Requests constructor.
RequestPolicyInterface::ALLOW constant Allow delivery of cached pages.
RequestPolicyInterface::DENY constant Deny delivery of cached pages.