jwt

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBlacklistKey

func GetBlacklistKey(license string) string

Types

type Jwt

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

func Default

func Default() *Jwt

func New

func New(opts ...Option) *Jwt

func (*Jwt) Cancellation

func (g *Jwt) Cancellation(license string) error

func (*Jwt) ExpiresAt

func (g *Jwt) ExpiresAt(license string) int64

func (*Jwt) GetLicense

func (g *Jwt) GetLicense(uType guard.UserType, uid int64) ([]string, error)

func (*Jwt) IssuerAt

func (g *Jwt) IssuerAt(license string) int64

func (*Jwt) License

func (g *Jwt) License(user *guard.User) (string, error)

func (*Jwt) Provide

func (g *Jwt) Provide(ctx context.Context) interface{}

func (*Jwt) Verify

func (g *Jwt) Verify(license string) (*guard.User, error)

type Option

type Option func(*Options)

func WithExpire

func WithExpire(expire time.Duration) Option

func WithIssuer

func WithIssuer(issuer string) Option

func WithKey

func WithKey(key []byte) Option

func WithSigningMethod

func WithSigningMethod(signMethod SigningMethod) Option

type Options

type Options struct {
	Issuer        string
	Expire        time.Duration
	SigningMethod SigningMethod
	Key           []byte
}

type RedisBlacklist

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

func (*RedisBlacklist) Black

func (rbl *RedisBlacklist) Black(license string, ttl time.Duration) error

func (*RedisBlacklist) IsBlacked

func (rbl *RedisBlacklist) IsBlacked(license string) bool

func (*RedisBlacklist) Provide

func (rbl *RedisBlacklist) Provide(ctx context.Context) interface{}

type SigningMethod

type SigningMethod string
const (
	SigningMethodSH256 SigningMethod = "sha256"
	SigningMethodSH384 SigningMethod = "sha384"
	SigningMethodSH512 SigningMethod = "sha512"
)

Jump to

Keyboard shortcuts

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