class CasRedirectResponse in CAS 8
Same name and namespace in other branches
- 2.x src/CasRedirectResponse.php \Drupal\cas\CasRedirectResponse
Provides a non-cacheable redirect response to an outside server.
When returning a redirect response to a non-local URL (external server), you must use a response class that inherits from SecuredRedirectResponse.
Core provides one, called TrustedRedirectResponse, but it is cacheable, meaning Drupal's cache modules will attempt to cache the response.
We need a redirect response that is NOT cacheable, since when we redirect the user for gateway mode, there are far too many complexities involved construct the proper cache contexts and tags.
This response simply allows us to redirect a user to another site without worrying about Drupal caching that redirect response.
Hierarchy
- class \Drupal\Component\HttpFoundation\SecuredRedirectResponse extends \Symfony\Component\HttpFoundation\RedirectResponse
- class \Drupal\cas\CasRedirectResponse
Expanded class hierarchy of CasRedirectResponse
2 files declare their use of CasRedirectResponse
- CasRedirector.php in src/
Service/ CasRedirector.php - LogoutController.php in src/
Controller/ LogoutController.php
File
- src/
CasRedirectResponse.php, line 23
Namespace
Drupal\casView source
class CasRedirectResponse extends SecuredRedirectResponse {
/**
* {@inheritdoc}
*/
protected function isSafe($url) {
return TRUE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CasRedirectResponse:: |
protected | function |
Returns whether the URL is considered as safe to redirect to. Overrides SecuredRedirectResponse:: |
|
SecuredRedirectResponse:: |
public static | function | Copies an existing redirect response into a safe one. | |
SecuredRedirectResponse:: |
protected | function | Copies over the values from the given response. | 1 |
SecuredRedirectResponse:: |
public | function | Sets the redirect target of this response. |