jwt

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrJWTNotFound describes error when kid is missing in repository
	ErrJWTNotFound = errors.New("jwt not found in repository")
	// ErrJWTExpired fires when jwt exist and expired
	ErrJWTExpired = errors.New("jwt exists in repository, marked as expired, must be deleted")
	// ErrJWTInvalid fires when jwt are not valid
	ErrJWTInvalid = errors.New("jwt exists in repository and is not valid")
)

Functions

This section is empty.

Types

type DefaultOptions

type DefaultOptions struct {
}

DefaultOptions for repo

type RepoOptions

type RepoOptions struct {
	Store  *svalkey.Store
	Prefix string
	Opts   *DefaultOptions
}

RepoOptions holds options for NewJWTRepo func

type Repository

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

Repository holds all jwt

func New

func New(repoOpts *RepoOptions) (*Repository, error)

New returns pointer to new KeysRepository

func (*Repository) Del

func (p *Repository) Del(jti string) error

Del deletes jwt from db

func (*Repository) JWTExists

func (p *Repository) JWTExists(jti string) (bool, error)

JWTExists return true if jwt is in db

func (*Repository) List

func (p *Repository) List() ([]StoreValue, error)

List returns all jwt in db it's dangerous operation because db may hold to much tokens

func (*Repository) Store

func (p *Repository) Store(val *StoreValue) error

Store stores jwt in db

type StoreValue

type StoreValue struct {
	JTI          string
	RefreshToken string
	Expiry       jwt.NumericDate // RefreshToken expiry time
}

StoreValue holds internal storage structure

Jump to

Keyboard shortcuts

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