auth

package
v0.0.0-...-adacb7d Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExpired    = errors.New("expired")
	ErrEmptyIdent = errors.New("empty ident")
)

Functions

This section is empty.

Types

type Auth

type Auth interface {
	GetToken(ident string) (token string, exp time.Time, err error)
	Validate(token string) (ident string, err error)
}

type JwtAuth

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

func NewJwtAuth

func NewJwtAuth(cfg ...JwtAuthConfig) (a *JwtAuth, err error)

func (*JwtAuth) GetToken

func (a *JwtAuth) GetToken(ident string) (token string, exp time.Time, err error)

func (*JwtAuth) Validate

func (a *JwtAuth) Validate(token string) (ident string, err error)

type JwtAuthConfig

type JwtAuthConfig struct {
	SigningKey string
	Lifetime   time.Duration
}

Jump to

Keyboard shortcuts

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