xsrftoken

package module
v0.0.0-...-e11db0a Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2015 License: Apache-2.0 Imports: 9 Imported by: 1

README

xsrftoken provides cross-site-request-forgery tokens for golang.

It is a clone of Andrew Gerrard's xsrftoken project, that doesn't have the scary google code warning.

See https://godoc.org/github.com/ConradIrwin/xsrftoken

Documentation

Overview

Package xsrftoken provides methods for generating and validating secure XSRF tokens.

Index

Constants

This section is empty.

Variables

View Source
var Timeout = 24 * time.Hour

The duration that XSRF tokens are valid. It is exported so clients may set cookie timeouts that match generated tokens.

Functions

func Generate

func Generate(key, userID, actionID string) string

Generate returns a URL-safe secure XSRF token that expires in 24 hours.

key is a secret key for your application. userID is a unique identifier for the user. actionID is the action the user is taking (e.g. POSTing to a particular path).

func Valid

func Valid(token, key, userID, actionID string) bool

Valid returns true if token is a valid, unexpired token returned by Generate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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