token

package
v0.0.0-...-c59394f Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2017 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWT

type JWT struct {
	*jwt.Token
}

JWT implements the Tokener

func NewJWT

func NewJWT() *JWT

NewJWT allocates and returns a new Token with name and expiration mins

func (*JWT) Make

func (j *JWT) Make(secret string, params map[string]interface{}, expiration time.Duration) (string, error)

Make makes a jwt token string. if expiration <= 0, no expiration.

func (*JWT) Verify

func (j *JWT) Verify(code string, secret string) (map[string]interface{}, error)

Verify verifies the code

type Tokener

type Tokener interface {
	Make(secret string, params map[string]interface{}, expiration time.Duration) (string, error)
	Verify(code string, secret string) (map[string]interface{}, error)
}

Tokener defines the abilities of tokener

var Default Tokener

Default is a ready to use Tokener

Jump to

Keyboard shortcuts

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