Documentation ¶
Overview ¶
Package m provides gin middleware with Content Security Policy
Index ¶
- func ContentSecurityPolicy(pol *cspbuilder.Policy, h http.Handler, reportOnly bool) http.Handler
- func Directive(w http.ResponseWriter, ds string) *cspbuilder.Directive
- func Hash(w http.ResponseWriter, ds string, ht cspbuilder.HashType, source string)
- func Nonce(w http.ResponseWriter) string
- func NonceHTMLAttr(w http.ResponseWriter) template.HTMLAttr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentSecurityPolicy ¶
ContentSecurityPolicy implements the http.HandlerFunc for integration with the standard net/http lib. reportOnly sets Content-Security-Policy-Report-Only header
func Directive ¶ added in v0.2.0
func Directive(w http.ResponseWriter, ds string) *cspbuilder.Directive
func Hash ¶ added in v0.2.0
func Hash(w http.ResponseWriter, ds string, ht cspbuilder.HashType, source string)
func Nonce ¶
func Nonce(w http.ResponseWriter) string
Nonce returns the nonce value associated with the present response. If no nonce has been generated it returns an empty string.
func NonceHTMLAttr ¶ added in v0.2.1
func NonceHTMLAttr(w http.ResponseWriter) template.HTMLAttr
NonceHTMLAttr returns unescaped `nonce="<nonce>"` string for use in template.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.