token

package
v0.0.0-...-92eef12 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyToken = errors.New("token: empty token")
)

Functions

func GenerateToken

func GenerateToken(ctx Context) (tokenString string, err error)

func Init

func Init(c *Config)

func Parse

func Parse(tokenString string, secret string, ctx Context) (err error)

Parse validates the token with the specialized secret, and store result to context

func ParseRequest

func ParseRequest(r *http.Request, v Context) (err error)

Types

type Config

type Config struct {
	Secret       string
	LookupMethod []string
}

type Context

type Context interface {
	ToMap() goutil.Map
	LoadFromMap(data map[string]interface{}) error
}

Jump to

Keyboard shortcuts

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