token

package
v0.0.0-...-c2fed7e Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidDataType = errors.New("given token data is not valid or supported, and thus can't be used")

Functions

This section is empty.

Types

type JWTTokenManager

type JWTTokenManager struct {
	// This method must return pointer type.
	// Required, must be set.
	ClaimsFactory func() jwt.Claims
	SigningMethod jwt.SigningMethod // which alogrithm to use, required
	Secret        interface{}       // Key for signing, required
}

func (*JWTTokenManager) IssueToken

func (m *JWTTokenManager) IssueToken(data interface{}) (serializedToken []byte, err error)

func (*JWTTokenManager) ParseToken

func (m *JWTTokenManager) ParseToken(token []byte) (data interface{}, err error)

type TokenIssuer

type TokenIssuer interface {
	IssueToken(data interface{}) (token []byte, err error)
}

Note: this is expected to be wrapped with app specific wrapper, which accepts only specified token type.

type TokenManager

type TokenManager interface {
	TokenIssuer
	TokenParser
}

type TokenParser

type TokenParser interface {
	ParseToken(token []byte) (data interface{}, err error)
}

Note: this is expected to be wrapped with app specific wrapper, which accepts only specified token type.

Jump to

Keyboard shortcuts

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