Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authentication ¶ added in v0.0.4
Authentication 身份验证请求
type AuthenticationManager ¶ added in v0.0.4
type AuthenticationManager interface {
Authenticate(ctx context.Context, a Authentication) (Identity, error)
}
AuthenticationManager 验证管理器
type Authenticator ¶ added in v0.0.3
type Authenticator interface {
Supports(ctx context.Context, a Authentication) bool
Verify(ctx context.Context, a Authentication) (Identity, error)
}
Authenticator 身份验证器
type Authorization ¶ added in v0.0.4
Authorization 授权请求
type AuthorizationManager ¶ added in v0.0.4
type AuthorizationManager interface {
Accept(ctx context.Context, a Authorization) bool
}
AuthorizationManager 授权管理器
type Authorizer ¶ added in v0.0.3
type Authorizer interface {
Supports(ctx context.Context, a Authorization) bool
Accept(ctx context.Context, a Authorization) bool
}
Authorizer 授权者
type Context ¶
type Context interface {
GetAuthenticationManager() AuthenticationManager
GetAuthorizationManager() AuthorizationManager
GetSubjectManager() SubjectManager
GetSessionIDGenerator() SessionIDGenerator
GetSessionFactory() SessionFactory
GetSessionManager() SessionManager
}
Context 安全上下文
type Identity ¶ added in v0.0.4
type Identity interface {
UserID() string
UserUUID() string
Nickname() string
Avatar() string
Roles() []string
}
Identity 身份
type Session ¶
type Session interface {
GetID() string // the session id
GetProperty(name string) string
SetProperty(name, value string)
GetIdentity() Identity
SetIdentity(ident Identity)
}
Session 会话
type SessionIDGenerator ¶ added in v0.0.4
type SessionIDGenerator interface {
GenerateID() string
}
SessionIDGenerator 会话ID生成器
type SessionManager ¶ added in v0.0.3
type SessionManager interface {
InsertSession(session Session) (Session, error)
RemoveSession(sid string) error
UpdateSession(sid string, session Session) (Session, error)
FindSession(sid string) (Session, error)
}
SessionManager 会话管理器
type Subject ¶ added in v0.0.3
type Subject interface {
GetSession() Session
GetAccess() Access
IsAuthenticated() bool
SetSession(s Session)
SetAccess(a Access)
SetAuthenticated(authenticated bool)
Login(ctx context.Context, a Authentication) (Identity, error)
Logout() error
Authorize(ctx context.Context, a Access) (bool, error)
}
Subject 代表操作的主体
type SubjectManager ¶ added in v0.0.4
SubjectManager 主体管理器
Click to show internal directories.
Click to hide internal directories.