Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidContentType is an error that indicates invalid content type. ErrInvalidContentType = errors.New("invalid content type") // ErrInvalidHeader is an error that indicates invalid X-Content-Security header. ErrInvalidHeader = errors.New("invalid X-Content-Security header") // ErrInvalidKey is an error that indicates invalid key. ErrInvalidKey = errors.New("invalid key") // ErrInvalidPublicKey is an error that indicates invalid public key. ErrInvalidPublicKey = errors.New("invalid public key") // ErrInvalidSecret is an error that indicates invalid secret. ErrInvalidSecret = errors.New("invalid secret") )
Functions ¶
func VerifySignature ¶
func VerifySignature(r *http.Request, securityHeader *ContentSecurityHeader, tolerance time.Duration) int
VerifySignature verifies the signature in given r.
Types ¶
type ContentSecurityHeader ¶
A ContentSecurityHeader is a content security header.
func ParseContentSecurity ¶
func ParseContentSecurity(decrypters map[string]codec.RsaDecrypter, r *http.Request) ( *ContentSecurityHeader, error)
ParseContentSecurity parses content security settings in give r.
func (*ContentSecurityHeader) Encrypted ¶
func (h *ContentSecurityHeader) Encrypted() bool
Encrypted checks if it's a crypted request.
type WithCodeResponseWriter ¶
type WithCodeResponseWriter struct { Writer http.ResponseWriter Code int }
A WithCodeResponseWriter is a helper to delay sealing a http.ResponseWriter on writing code.
func (*WithCodeResponseWriter) Flush ¶
func (w *WithCodeResponseWriter) Flush()
Flush flushes the response writer.
func (*WithCodeResponseWriter) Header ¶
func (w *WithCodeResponseWriter) Header() http.Header
Header returns the http header.
func (*WithCodeResponseWriter) Hijack ¶
func (w *WithCodeResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
Hijack implements the http.Hijacker interface. This expands the Response to fulfill http.Hijacker if the underlying http.ResponseWriter supports it.
func (*WithCodeResponseWriter) Write ¶
func (w *WithCodeResponseWriter) Write(bytes []byte) (int, error)
Write writes bytes into w.
func (*WithCodeResponseWriter) WriteHeader ¶
func (w *WithCodeResponseWriter) WriteHeader(code int)
WriteHeader writes code into w, and not sealing the writer.
Click to show internal directories.
Click to hide internal directories.