auth

package
v6.4.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidToken = errors.New("invalid token")
)

定义错误

Functions

This section is empty.

Types

type Auther

type Auther interface {
	// 生成令牌
	GenerateToken(ctx context.Context, userID string) (TokenInfo, error)

	// 销毁令牌
	DestroyToken(ctx context.Context, accessToken string) error

	// 解析用户ID
	ParseUserID(ctx context.Context, accessToken string) (string, error)

	// 释放资源
	Release() error
}

Auther 认证接口

type TokenInfo

type TokenInfo interface {
	// 获取访问令牌
	GetAccessToken() string
	// 获取令牌类型
	GetTokenType() string
	// 获取令牌到期时间戳
	GetExpiresAt() int64
	// JSON编码
	EncodeToJSON() ([]byte, error)
}

TokenInfo 令牌信息

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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