Documentation
¶
Index ¶
- Constants
- type Authentication
- type Authenticator
- type Authorization
- type Authorizer
- type Mechanism
- type PasswordCalculator
- func (inst *PasswordCalculator) Compute(plain []byte) []byte
- func (inst *PasswordCalculator) Reset() *PasswordCalculator
- func (inst *PasswordCalculator) Verify(plain []byte) error
- func (inst *PasswordCalculator) WithSalt(salt []byte) *PasswordCalculator
- func (inst *PasswordCalculator) WithTarget(target []byte) *PasswordCalculator
- type Registration
- type Registry
- type Request
- type RequestBuilder
- type Service
Constants ¶
View Source
const ( ActionLogin = rbac.ActionLogin ActionSignUp = rbac.ActionSignUp ActionResetPassword = rbac.ActionResetPassword ActionChangePassword = rbac.ActionChangePassword ActionSendCode = rbac.ActionSendCode )
定义几种常用的授权动作
View Source
const ( MechanismPassword = rbac.MechanismPassword MechanismEmail = rbac.MechanismEmail MechanismPhone = rbac.MechanismPhone )
定义几种常用的验证机制
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authentication ¶
Authentication 表示一个身份验证请求
type Authenticator ¶
type Authenticator interface { // 验证用户身份 Authenticate(a Authentication) error }
Authenticator 表示一个身份验证算法
type Authorizer ¶
type Authorizer interface { // 向用户授权 Authorize(a Authorization) error }
Authorizer 表示一个授权组件
type PasswordCalculator ¶
type PasswordCalculator struct {
// contains filtered or unexported fields
}
PasswordCalculator 是默认的密码计算器
func (*PasswordCalculator) Compute ¶
func (inst *PasswordCalculator) Compute(plain []byte) []byte
Compute 计算密码的哈希值
func (*PasswordCalculator) Reset ¶ added in v1.0.20
func (inst *PasswordCalculator) Reset() *PasswordCalculator
Reset ...
func (*PasswordCalculator) Verify ¶
func (inst *PasswordCalculator) Verify(plain []byte) error
Verify 验证密码是否正确
func (*PasswordCalculator) WithSalt ¶ added in v1.0.20
func (inst *PasswordCalculator) WithSalt(salt []byte) *PasswordCalculator
WithSalt ...
func (*PasswordCalculator) WithTarget ¶ added in v1.0.20
func (inst *PasswordCalculator) WithTarget(target []byte) *PasswordCalculator
WithTarget ...
type Registration ¶
type Registration struct { Authenticator Authenticator Authorizer Authorizer Mechanism Mechanism Priority int Enabled bool }
Registration ... 注册信息
type Request ¶ added in v1.0.14
type Request interface { Context() context.Context Attributes() attributes.Table Parameters() parameters.Table Action() string Mechanism() string }
Request 包含 Authentication 和 Authorization 的公共方法
type RequestBuilder ¶ added in v1.0.14
type RequestBuilder struct { Context context.Context Atts attributes.Table Params parameters.Table Account string Action string Mechanism string Secret lang.Base64 }
RequestBuilder 用于创建 Authentication & Authorization 实例
func (*RequestBuilder) Create ¶ added in v1.0.14
func (inst *RequestBuilder) Create() Authentication
Create 创建 Authentication 实例
Click to show internal directories.
Click to hide internal directories.