token

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: Apache-2.0 Imports: 2 Imported by: 12

Documentation

Index

Constants

View Source
const TokenHeader = "x-access-token"

TokenHeader is the header to be used across grpc and http services to forward the access token.

Variables

This section is empty.

Functions

func ContextGetToken

func ContextGetToken(ctx context.Context) (string, bool)

ContextGetToken returns the token if set in the given context.

func ContextMustGetToken

func ContextMustGetToken(ctx context.Context) string

ContextMustGetToken panics if token is not in context.

func ContextSetToken

func ContextSetToken(ctx context.Context, t string) context.Context

ContextSetToken stores the token in the context.

Types

type Claims

type Claims map[string]interface{}

Claims is the map of attributes to encode into a token

type Manager

type Manager interface {
	MintToken(ctx context.Context, u *user.User) (string, error)
	DismantleToken(ctx context.Context, token string) (*user.User, error)
}

Manager is the interface to implement to sign and verify tokens

Directories

Path Synopsis
manager
jwt

Jump to

Keyboard shortcuts

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