Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authentication ¶
Authentication 表示一个身份验证请求
type Authenticator ¶
type Authenticator interface { Authenticate(a Authentication) (User, error) Support(a Authentication) bool }
Authenticator 表示一个身份验证算法
type Authenticators ¶
type Authenticators interface {
Authenticate(a Authentication) (User, error)
}
Authenticators 表示一组身份验证算法
type Authorization ¶
Authorization 表示一个授权请求
func NewAuthorization ¶
func NewAuthorization(c context.Context, user User) Authorization
NewAuthorization 新建一个 Authorization 的实例
type Authorizer ¶
type Authorizer interface { Authorize(a Authorization) error Support(a Authorization) bool }
Authorizer 表示一个授权组件
type Authorizers ¶
type Authorizers interface {
Authorize(a Authorization) error
}
Authorizers 表示一组授权组件
type PasswordCalculator ¶
type PasswordCalculator struct {
// contains filtered or unexported fields
}
PasswordCalculator 是默认的密码计算器
func (*PasswordCalculator) Compute ¶
func (inst *PasswordCalculator) Compute(plain []byte) []byte
Compute 计算密码的哈希值
func (*PasswordCalculator) Init ¶
func (inst *PasswordCalculator) Init(target, salt []byte)
Init ...
func (*PasswordCalculator) Verify ¶
func (inst *PasswordCalculator) Verify(plain []byte) error
Verify 验证密码是否正确
type Registration ¶
type Registration struct { Authenticator Authenticator Authorizer Authorizer Priority int Enabled bool }
Registration ... 注册信息
type Service ¶
type Service interface { Authenticators Authorizers Login(c context.Context, a Authentication) error }
Service ...
type User ¶
type User interface { ID() rbac.UserID // 用户ID Name() rbac.UserName // 用户名 Avatar() string // 头像图片的 URL Roles() rbac.RoleNameList // 角色 DisplayName() string // 显示名称(昵称) }
User 表示经过验证的用户
type UserBuilder ¶
type UserBuilder struct { ID rbac.UserID Name rbac.UserName Roles rbac.RoleNameList Avatar string DisplayName string }
UserBuilder 用于创建 User 实例
Click to show internal directories.
Click to hide internal directories.