jwt

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: MIT Imports: 3 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 {
	Encode(o *Token) (Text, error)
	Decode(t Text) (*Token, error)
}

CODEC 是 JWT 的编解码器

type Getter

type Getter interface {
	GetDTO(c context.Context) (*Token, error)
	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
}

Service 提供全部功能的 JWT 服务

type Setter

type Setter interface {
	SetDTO(c context.Context, o *Token) error
	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.BaseDTO

	ExpiredAt  lang.Time         `json:"expired_at"`
	Session    rbac.SessionDTO   `json:"session"`
	Properties map[string]string `json:"properties"`
}

Token 是 JSON 结构形式的 JWT

Jump to

Keyboard shortcuts

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