LocalRedirectResponse
class LocalRedirectResponse extends CacheableSecuredRedirectResponse (View source)
Provides a redirect response which cannot redirect to an external URL.
Traits
Provides a trait which ensures that a URL is safe to redirect to.
Provides an implementation of CacheableResponseInterface.
Properties
| protected CacheableMetadata | $cacheabilityMetadata | The cacheability metadata. |
from CacheableResponseTrait |
| protected RequestContext | $requestContext | The request context. |
from LocalAwareRedirectResponseTrait |
Methods
Copies an existing redirect response into a safe one.
Copies over the values from the given response.
Returns whether the URL is considered as safe to redirect to.
Returns the request context.
Details
static SecuredRedirectResponse
createFromRedirectResponse(RedirectResponse $response)
Copies an existing redirect response into a safe one.
The safe one cannot accidentally redirect to an external URL, unless actively wanted (see TrustedRedirectResponse).
protected
fromResponse(RedirectResponse $response)
Copies over the values from the given response.
setTargetUrl($url)
{@inheritdoc}
abstract protected bool
isSafe(string $url)
Returns whether the URL is considered as safe to redirect to.
addCacheableDependency($dependency)
{@inheritdoc}
getCacheableMetadata()
{@inheritdoc}
protected bool
isLocal(string $url)
Determines whether a path is local.
protected RequestContext
getRequestContext()
Returns the request context.
$this
setRequestContext(RequestContext $request_context)
Sets the request context.