EncryptCookies
class EncryptCookies
Properties
| protected array<int, string> | $except | The names of the cookies that should not be encrypted. |
|
| static protected array<int, string> | $neverEncrypt | The globally ignored cookies that should not be encrypted. |
|
| static protected array<int, string> | $onlyEncrypt | The cookies that should be encrypted (opt-in mode). |
|
| static protected bool | $serialize | Indicates if cookies should be serialized. |
Methods
Disable encryption for the given cookie name(s).
Validate and remove the cookie value prefix from the value.
Validate and remove the cookie value prefix from all values of an array.
Decrypt the given cookie and return the value.
Decrypt an array based cookie.
Encrypt the cookies on an outgoing response.
Duplicate a cookie with a new value.
Determine whether encryption has been disabled for the given cookie.
Indicate that the given cookies should never be encrypted.
Indicate that only the given cookies should be encrypted.
Determine if the cookie contents should be serialized.
Flush all static state.
Details
at line 51
__construct(Encrypter $encrypter)
Create a new middleware instance.
at line 62
void
disableFor(array|string $name)
Disable encryption for the given cookie name(s).
On the shared middleware, the list persists for the worker's lifetime and applies to every subsequent request.
at line 103
protected array|string|null
validateValue(string $key, array|string $value)
Validate and remove the cookie value prefix from the value.
at line 113
protected array
validateArray(string $key, array $value)
Validate and remove the cookie value prefix from all values of an array.
at line 127
protected array|string
decryptCookie(string $name, array|string $cookie)
Decrypt the given cookie and return the value.
at line 137
protected array
decryptArray(array $cookie)
Decrypt an array based cookie.
at line 157
protected Response
encrypt(Response $response)
Encrypt the cookies on an outgoing response.
at line 179
protected Cookie
duplicate(Cookie $cookie, mixed $value)
Duplicate a cookie with a new value.
at line 187
bool
isDisabled(string $name)
Determine whether encryption has been disabled for the given cookie.
at line 202
static void
except(array|string $cookies)
Indicate that the given cookies should never be encrypted.
The list persists in a static property for the worker lifetime and applies to every subsequent request.
at line 219
static void
only(array|string $cookies)
Indicate that only the given cookies should be encrypted.
When set, all other cookies pass through unencrypted. Takes precedence over except() and the $except property.
The list persists in a static property for the worker lifetime and applies to every subsequent request.
at line 230
static bool
serialized(string $name)
Determine if the cookie contents should be serialized.
at line 238
static void
flushState()
Flush all static state.