Parse encoded request body data.
Enables JSON and XML request payloads to be parsed into the request's body.
You can also add your own request body parsers using the addParser() method.
Decorate closures as PSR-15 middleware.
Decorates closures with the following signature:
function (
ServerRequestInterface $request,
RequestHandlerInterface $handler
): ResponseInterface
such that it will operate as PSR-15 middleware.
Content Security Policy Middleware
scriptNonce Enable to have a nonce policy added to the script-src directive.styleNonce Enable to have a nonce policy added to the style-src directive.Provides CSRF protection & validation.
This middleware adds a CSRF token to a cookie. The cookie value is compared to token in request data, or the X-CSRF-Token header on each PATCH, POST, PUT, or DELETE request. This is known as "double submit cookie" technique.
If the request data is missing or does not match the cookie data, an InvalidCsrfTokenException will be raised.
This middleware integrates with the FormHelper automatically and when
used together your forms will have CSRF tokens automatically added
when $this->Form->create(...) is used in a view.
Middleware for encrypting & decrypting cookies.
This middleware layer will encrypt/decrypt the named cookies with the given key and cipher type. To support multiple keys/cipher types use this middleware multiple times.
Cookies in request data will be decrypted, while cookies in response headers will
be encrypted automatically. If the response is a {@link \Cake\Http\Response}, the cookie
data set with withCookie() and cookie() will also be encrypted.
The encryption types and padding are compatible with those used by CookieComponent for backwards compatibility.
Enforces use of HTTPS (SSL) for requests.
Rate limiting middleware
Provides configurable rate limiting based on various identifiers. Supports multiple strategies including sliding window, token bucket, and fixed window.
Handles common security headers in a convenient way
Provides CSRF protection via session based tokens.
This middleware adds a CSRF token to the session. Each request must contain a token in request data, or the X-CSRF-Token header on each PATCH, POST, PUT, or DELETE request. This follows a 'synchronizer token' pattern.
If the request data is missing or does not match the session data, an InvalidCsrfTokenException will be raised.
This middleware integrates with the FormHelper automatically and when
used together your forms will have CSRF tokens automatically added
when $this->Form->create(...) is used in a view.
If you use this middleware do not also use CsrfProtectionMiddleware.