token

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2018 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidatedHandler

func ValidatedHandler(validator Validator, handler func(w http.ResponseWriter, r *http.Request, token *jwt.Token)) func(w http.ResponseWriter, r *http.Request)

ValidatedHandler will return a http handler which validates a request prior to invoking the given handler.

Types

type Generator

type Generator interface {
	Generate(subject string, claims jwt.MapClaims) (*jwt.Token, error)
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager validates and generates new tokens

func NewManager

func NewManager(pub, priv string) (*Manager, error)

func (*Manager) Generate

func (tm *Manager) Generate(subject string, claims jwt.MapClaims) (string, error)

func (*Manager) Validate

func (tm *Manager) Validate(token string) (*jwt.Token, error)

Validate should be called to validate a jwt token.

type Validator

type Validator interface {
	Validate(token string) (*jwt.Token, error)
}

Jump to

Keyboard shortcuts

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