public function DisallowSimpleOauthRequests::isOauth2Request in Simple OAuth (OAuth2) & OpenID Connect 8.3
Same name and namespace in other branches
- 8.4 src/PageCache/DisallowSimpleOauthRequests.php \Drupal\simple_oauth\PageCache\DisallowSimpleOauthRequests::isOauth2Request()
- 5.x src/PageCache/DisallowSimpleOauthRequests.php \Drupal\simple_oauth\PageCache\DisallowSimpleOauthRequests::isOauth2Request()
Returns a state whether the request has an OAuth2 access token.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The incoming request object.
Return value
bool A state whether the request has an OAuth2 access token.
Overrides SimpleOauthRequestPolicyInterface::isOauth2Request
1 call to DisallowSimpleOauthRequests::isOauth2Request()
- DisallowSimpleOauthRequests::check in src/
PageCache/ DisallowSimpleOauthRequests.php - Determines whether delivery of a cached page should be attempted.
File
- src/
PageCache/ DisallowSimpleOauthRequests.php, line 17
Class
- DisallowSimpleOauthRequests
- Do not serve a page from cache if OAuth2 authentication is applicable.
Namespace
Drupal\simple_oauth\PageCacheCode
public function isOauth2Request(Request $request) {
// Check the header. See: http://tools.ietf.org/html/rfc6750#section-2.1
return strpos(trim($request->headers
->get('Authorization', '', TRUE)), 'Bearer ') !== FALSE;
}