public function DenyTestAuthRequests::check in Drupal 9
Same name and namespace in other branches
- 8 core/modules/rest/tests/modules/rest_test/src/PageCache/RequestPolicy/DenyTestAuthRequests.php \Drupal\rest_test\PageCache\RequestPolicy\DenyTestAuthRequests::check()
- 10 core/modules/rest/tests/modules/rest_test/src/PageCache/RequestPolicy/DenyTestAuthRequests.php \Drupal\rest_test\PageCache\RequestPolicy\DenyTestAuthRequests::check()
Determines whether delivery of a cached page should be attempted.
Note that the request-policy check runs very early. In particular it is not possible to determine the logged in user. Also the current route match is not yet present when the check runs. Therefore, request-policy checks need to be designed in a way such that they do not depend on any other service and only take in account the information present on the incoming request.
When matching against the request path, special attention is needed to support path prefixes which are often used on multilingual sites.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The incoming request object.
Return value
string|null One of static::ALLOW, static::DENY or NULL. Calling code may attempt to deliver a cached page if static::ALLOW is returned. Returns NULL if the policy is not specified for the given request.
Overrides RequestPolicyInterface::check
File
- core/
modules/ rest/ tests/ modules/ rest_test/ src/ PageCache/ RequestPolicy/ DenyTestAuthRequests.php, line 25
Class
- DenyTestAuthRequests
- Cache policy for pages requested with REST Test Auth.
Namespace
Drupal\rest_test\PageCache\RequestPolicyCode
public function check(Request $request) {
if ($request->headers
->has('REST-test-auth') || $request->headers
->has('REST-test-auth-global')) {
return self::DENY;
}
}