jwt

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: Zlib Imports: 7 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 (*Authenticate) Check

func (t *Authenticate) Check(source token.Source, tok string) (token.Token, error)

Check implement token.Authenticate interface

func (*Authenticate) Create

func (t *Authenticate) Create(source token.Source, expireSeconds int64) (token.Token, error)

Create implement token.Authenticate interface

func (*Authenticate) Decode

func (t *Authenticate) Decode(source token.Source, tok string) (token.Token, error)

Decode implement token.Authenticate interface

func (*Authenticate) EnableFlag added in v0.5.19

func (t *Authenticate) EnableFlag(source token.Source) int

EnableFlag implement token.Authenticate interface

func (*Authenticate) SetEnabled

func (t *Authenticate) SetEnabled(source token.Source, 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:"-"`
	// contains filtered or unexported fields
}

func NewToken

func NewToken(key token.Key) *Token

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) 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

Jump to

Keyboard shortcuts

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