jwt_manager

package
Version: v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidAccessToken ...
	ErrInvalidAccessToken = errors.New("invalid access token")
	// ErrUnexpectedSigningMethod ...
	ErrUnexpectedSigningMethod = errors.New("unexpected signing method")
	// ErrInvalidTokenClaims ...
	ErrInvalidTokenClaims = errors.New("invalid token claims")
)

Functions

This section is empty.

Types

type JwtManager

type JwtManager interface {
	Start() (err error)
	Generate(*m.User, ...*time.Time) (accessToken string, err error)
	Verify(string) (claims *UserClaims, err error)
	SetHmacKey(hmacKey []byte)
}

JwtManager ...

func NewJwtManager

func NewJwtManager(lc fx.Lifecycle,
	adaptors *adaptors.Adaptors) (mananger JwtManager)

NewJwtManager ...

type UserClaims

type UserClaims struct {
	UserId   int64  `json:"i,omitempty"`
	Username string `json:"n,omitempty"`
	RoleName string `json:"r,omitempty"`
}

UserClaims ...

Jump to

Keyboard shortcuts

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