jwt

package
v1.0.55 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 2 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	Getter
	Setter
	Accept(c context.Context) bool
}

Adapter 用来适配各种不同的上下文

type CODEC

type CODEC interface {
	Encoder
	Decoder
}

CODEC 是 JWT 的编解码器

type Decoder added in v1.0.49

type Decoder interface {
	Decode(t Text) (*Token, error)
}

Decoder 是 JWT 的解码器

type Encoder added in v1.0.49

type Encoder interface {
	Encode(o *Token) (Text, error)
}

Encoder 是 JWT 的编码器

type Getter

type Getter interface {
	GetText(c context.Context) (Text, error)
}

Getter 用来获取跟上下文绑定的JWT

type Registration

type Registration struct {
	Adapter  Adapter
	CODEC    CODEC
	Priority int
	Enabled  bool
}

Registration 表示 JWT 组件的注册信息

type Registry

type Registry interface {
	ListRegistrations() []*Registration
}

Registry 是 JWT 组件的注册接口

type Service

type Service interface {
	Getter
	Setter
	CODEC

	GetDTO(c context.Context) (*Token, error)
	SetDTO(c context.Context, o *Token) error
}

Service 提供全部功能的 JWT 服务

type Setter

type Setter interface {
	SetText(c context.Context, t Text) error
}

Setter 用来设置跟上下文绑定的JWT

type Text

type Text string

Text 是文本形式的 JWT

func (Text) String

func (t Text) String() string

type Token added in v1.0.5

type Token struct {

	// 当前用户信息
	rbac.CurrentUser

	Session rbac.SessionID `json:"session"` // 会话的 UUID
}

Token 是 JSON 结构形式的 JWT

Jump to

Keyboard shortcuts

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