token

package
v0.0.0-...-6bcd878 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTManager

type JWTManager struct {
	Storage *storage.Storage
	RDB     *redis.Client
	// contains filtered or unexported fields
}

func NewJWTManager

func NewJWTManager(secret string, store *storage.Storage, rdb *redis.Client) *JWTManager

func (*JWTManager) CheckUnauthorizedToken

func (m *JWTManager) CheckUnauthorizedToken(ctx context.Context, tokenString string) error

func (*JWTManager) Generate

func (m *JWTManager) Generate(claims map[string]string, expiration time.Time) (string, error)

func (*JWTManager) InvalidateToken

func (m *JWTManager) InvalidateToken(ctx context.Context, tokenString string) error

func (*JWTManager) Validate

func (m *JWTManager) Validate(ctx context.Context, tokenString string) (map[string]string, error)

type Manager

type Manager interface {
	Generate(claims map[string]string, expiration time.Time) (string, error)
	Validate(ctx context.Context, tokenString string) (map[string]string, error)
	InvalidateToken(ctx context.Context, tokenString string) error
}

Jump to

Keyboard shortcuts

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