abstract class CacheableSecuredRedirectResponse extends SecuredRedirectResponse implements CacheableResponseInterface (View source)

Provides a common base class for cacheable safe redirects.

Traits

Provides an implementation of CacheableResponseInterface.

Properties

protected CacheableMetadata $cacheabilityMetadata

The cacheability metadata.

from  CacheableResponseTrait

Methods

createFromRedirectResponse(RedirectResponse $response)

Copies an existing redirect response into a safe one.

fromResponse(RedirectResponse $response)

Copies over the values from the given response.

bool
isSafe(string $url)

Returns whether the URL is considered as safe to redirect to.

addCacheableDependency($dependency)

{@inheritdoc}

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).

Parameters

RedirectResponse $response

The original redirect.

Return Value

SecuredRedirectResponse

protected fromResponse(RedirectResponse $response)

Copies over the values from the given response.

Parameters

RedirectResponse $response

The redirect response object.

SecuredRedirectResponse setTargetUrl($url)

{@inheritdoc}

Parameters

$url

Return Value

SecuredRedirectResponse

abstract protected bool isSafe(string $url)

Returns whether the URL is considered as safe to redirect to.

Parameters

string $url

The URL checked for safety.

Return Value

bool

addCacheableDependency($dependency)

{@inheritdoc}

Parameters

$dependency

getCacheableMetadata()

{@inheritdoc}