jwt

package
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Zlib Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Type = "jwt"

Variables

This section is empty.

Functions

func DecodeToken

func DecodeToken(tk string) (token.Token, error)

DecodeToken 不需要认证,解包里面的信息

func DecodeTokenNoBase64 added in v0.5.42

func DecodeTokenNoBase64(tk string) (token.Token, error)

func VerifyToken

func VerifyToken(tk string, key token.Key) (token.Token, error)

VerifyToken 需要认证,解包里面的信息

func VerifyTokenNoBase64 added in v0.5.42

func VerifyTokenNoBase64(tk string, key token.Key) (token.Token, error)

Types

type Authenticate

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

func New added in v0.5.13

func New(secret token.Secret) *Authenticate

func NewWith added in v1.3.18

func NewWith(secret token.Secret, method string, factory token.Factory) *Authenticate

func (*Authenticate) Check

func (t *Authenticate) Check(secretKey string, tok string, opts ...token.Option) (token.Token, error)

Check implement token.Authenticate interface

func (*Authenticate) Create

func (t *Authenticate) Create(secretKey string, expireSeconds int64, opts ...token.Option) (token.Token, error)

Create implement token.Authenticate interface

func (*Authenticate) Decode

func (t *Authenticate) Decode(tok string, opts ...token.Option) (token.Token, error)

Decode implement token.Authenticate interface

func (*Authenticate) EnableFlag added in v0.5.19

func (t *Authenticate) EnableFlag(secretKey string) int

EnableFlag implement token.Authenticate interface

func (*Authenticate) SetEnabled

func (t *Authenticate) SetEnabled(secretKey string, enable bool)

SetEnabled implement token.Authenticate interface

func (*Authenticate) Type

func (t *Authenticate) Type() string

type Token

type Token struct {
	token.Session
	Token  string       `json:"token"`
	Extend string       `json:"-"`
	Source token.Source `json:"-"`
	// contains filtered or unexported fields
}

func NewToken

func NewToken(key token.Key, ujc UpdateJWTClaims, base64 bool) *Token

func (*Token) ExpireIn added in v1.4.20

func (tk *Token) ExpireIn() timer.Expire

ExpireIn token.Token interface

func (*Token) GetExtend

func (tk *Token) GetExtend() string

GetExtend token.Token interface

func (*Token) GetSession

func (tk *Token) GetSession() token.Session

GetSession token.Token interface

func (*Token) GetToken

func (tk *Token) GetToken() string

GetToken token.Token interface

func (*Token) GetVar added in v1.3.18

func (tk *Token) GetVar(key string) interface{}

func (*Token) Update

func (tk *Token) Update() (string, error)

Update token.Token interface

func (*Token) WithExtend

func (tk *Token) WithExtend(extend string) token.Token

WithExtend token.Token interface

func (*Token) WithSession

func (tk *Token) WithSession(session token.Session) token.Token

WithSession token.Token interface

func (*Token) WithSource

func (tk *Token) WithSource(source token.Source) token.Token

func (*Token) WithVar added in v1.3.18

func (tk *Token) WithVar(key string, value interface{}) token.Token

type UpdateJWTClaims added in v1.4.20

type UpdateJWTClaims func(tk token.Token) jwt.Claims

Jump to

Keyboard shortcuts

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