csphandler

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package m provides gin middleware with Content Security Policy

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentSecurityPolicy

func ContentSecurityPolicy(pol *cspbuilder.Policy, h http.Handler, reportOnly bool) http.Handler

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.

Directories

Path Synopsis
Package gincsp is a gin middleware that supports Content Security Policy
Package gincsp is a gin middleware that supports Content Security Policy

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL