Class CspMiddleware
Content Security Policy Middleware
Namespace: Cake\Http\Middleware
Property Summary
-
$csp protected
ParagonIE\CSPBuilder\CSPBuilder
CSP Builder
Method Summary
-
__construct() public
Constructor
-
__invoke() public
Apply the middleware.
Method Detail
__construct() ¶ public
__construct(ParagonIE\CSPBuilder\CSPBuilder|array $csp)
Constructor
Parameters
-
ParagonIE\CSPBuilder\CSPBuilder|array
$csp CSP object or config array
Throws
RuntimeException
__invoke() ¶ public
__invoke(ServerRequestInterface $requestInterface, ResponseInterface $responseInterface, callable $next): Psr\Http\Message\MessageInterface
Apply the middleware.
This will inject the CSP header into the response.
Parameters
-
ServerRequestInterface
$requestInterface The Request.
-
ResponseInterface
$responseInterface The Response.
-
callable
$next Callback to invoke the next middleware.
Returns
Psr\Http\Message\MessageInterface