jwt_manager

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: GPL-3.0 Imports: 12 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 {
	Generate(*m.User, bool, ...*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) JwtManager

NewJwtManager ...

type UserClaims

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

UserClaims ...

Jump to

Keyboard shortcuts

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