xsrf

package
v0.0.0-...-b4b3d51 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2017 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package xsrf provides simple routines for creating and retrieving XSRF tokens with the Angular framework.

Index

Constants

View Source
const CookieName = "XSRF-TOKEN"

CookieName is the name of the cookie angular checks to determine whether it should send an "X-XSRF-TOKEN" header.

Variables

This section is empty.

Functions

func Cookie(t tokens.AuthToken) *http.Cookie

Cookie returns an http.Cookie with the Name and Value fields set.

func FromHeader

func FromHeader(h http.Header) (t tokens.AuthToken, err error)

FromHeader fetches the Token from the X-XSRF-TOKEN header, if it exists.

func FromRequest

func FromRequest(r *http.Request) (t tokens.AuthToken, err error)

FromRequest fetches the Token from the X-XSRF-TOKEN header, if it exists.

func Hash

func Hash(t tokens.AuthToken) []byte

Hash returns the SHAKE-256 hash of the token. Hash should be used when storing the XSRF token on the backend and comparisons should be done in constant-time function, using a function like those found in crypto/subtle.

Types

This section is empty.

Jump to

Keyboard shortcuts

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