jwt

package
v1.0.25 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlacklistKey = "blacklist.key.%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Jwt

type Jwt struct {
	Blacklist guard.Blacklist
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *Jwt

func (*Jwt) Cancellation

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

func (*Jwt) ExpiresAt

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

func (*Jwt) IssuerAt

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

func (*Jwt) License

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

func (*Jwt) Provide

func (guard *Jwt) Provide() interface{}

func (*Jwt) Verify

func (guard *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) Checklist added in v1.0.0

func (rbl *RedisBlacklist) Checklist(license string) (bool, error)

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