Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // 认证接口错误返回. ErrorReasonServerBusy = errors.New("服务器繁忙") ErrorReasonRelogin = errors.New("请重新登陆") ErrorReasonWrongPassword = errors.New("用户或密码错误") )
View Source
var ExpireTime = 3600 // token有效期
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
AuthConfig, 认证信息结构体,记录用户认证信息(可选).
type AuthDBConfig ¶
type AuthDBConfig struct { DBName string `yaml:"DBName"` Host string `yaml:"host"` Port int `yaml:"port"` Protocol string `yaml:"protocol"` User string `yaml:"user"` Password string `yaml:"password"` }
AuthDBConfig, mysql数据库信息结构体,该库用于存放用户认证信息(可选).
type AuthService ¶
type AuthService struct { Port int `yaml:"Port"` *AuthDBConfig `yaml:"AuthDBConfig,omitempty"` *AuthConfig `yaml:"AuthConfig,omitempty"` }
AuthService, bifrost认证服务结构体,用于用户认证.
type JWTClaims ¶
type JWTClaims struct { jwt.RegisteredClaims UserID int `json:"user_id"` Password string `json:"password"` Username string `json:"username"` FullName string `json:"full_name"` Permissions []string `json:"permissions"` }
JWTClaims, jwt断言对象,定义认证接口校验的用户信息.
type ServiceMiddleware ¶
ServiceMiddleware define service middleware.
Click to show internal directories.
Click to hide internal directories.