Class CspMiddleware

Content Security Policy Middleware

Properties summary

  • $csp protected
    \ParagonIE\CSPBuilder\CSPBuilder

    CSP Builder

Method Summary

Method Detail

__construct() public

__construct(mixed $csp)

Constructor

Parameters

\ParagonIE\CSPBuilder\CSPBuilder|array $csp

CSP object or config array

Throws

RuntimeException

__invoke() public

__invoke(\Psr\Http\Message\ServerRequestInterface $requestInterface, \Psr\Http\Message\ResponseInterface $responseInterface, callable $next)

Apply the middleware.

This will inject the CSP header into the response.

Parameters

\Psr\Http\Message\ServerRequestInterface $requestInterface

The Request.

\Psr\Http\Message\ResponseInterface $responseInterface

The Response.

callable $next

Callback to invoke the next middleware.

Returns

\Psr\Http\Message\MessageInterface

Property Detail

$csp protected

CSP Builder

Type

\ParagonIE\CSPBuilder\CSPBuilder

© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.9/class-Cake.Http.Middleware.CspMiddleware.html