jwt

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 4 Imported by: 0

README

JSON Web Token (JWT)

什么是JWT?

JSON Web Token (JWT,RFC 7519 (opens new window)),是为了在网络应用环境间传递声明而执行的一种基于 JSON 的开放标准((RFC 7519)。该 token 被设计为紧凑且安全的,特别适用于分布式站点的单点登录(SSO)场景。JWT 的声明一般被用来在身份提供者和服务提供者间传递被认证的用户身份信息,以便于从资源服务器获取资源,也可以增加一些额外的其它业务逻辑所必须的声明信息,该 token 也可直接被用于认证,也可被加密。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthenticator

func NewAuthenticator(opts ...Option) (engine.Authenticator, error)

Types

type Authenticator

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

func (*Authenticator) Authenticate

func (jwt *Authenticator) Authenticate(ctx context.Context, contextType engine.ContextType) (*engine.AuthClaims, error)

func (*Authenticator) AuthenticateToken

func (jwt *Authenticator) AuthenticateToken(token string) (*engine.AuthClaims, error)

func (*Authenticator) Close

func (jwt *Authenticator) Close()

func (*Authenticator) CreateIdentity

func (jwt *Authenticator) CreateIdentity(claims engine.AuthClaims) (string, error)

func (*Authenticator) CreateIdentityWithContext

func (jwt *Authenticator) CreateIdentityWithContext(ctx context.Context, contextType engine.ContextType, claims engine.AuthClaims) (context.Context, error)

type Option

type Option func(d *Options)

func WithKey

func WithKey(key []byte) Option

WithKey set key

func WithSigningMethod

func WithSigningMethod(alg string) Option

WithSigningMethod set signing method

type Options

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

Jump to

Keyboard shortcuts

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