Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker interface { // 检测用户状态 Check(user UserDetails) error }
Checker 检查加载 UserDetails 的状态
type NilUserDetailsService ¶
type NilUserDetailsService struct{}
func (*NilUserDetailsService) LoadUserByUsername ¶
func (*NilUserDetailsService) LoadUserByUsername(username string) (UserDetails, error)
LoadUserByUsername 加载指定 username 的用户
type Service ¶
type Service interface { // 加载指定 username 的用户 LoadUserByUsername(username string) (UserDetails, error) }
Service �用于加载 UserDetails
type User ¶
type User struct { Authorities []core.GrantedAuthority Username string Password string AccountNonExpired bool AccountNonLocked bool CredentialsNonExpired bool Enabled bool }
User UserDetails 的基本实现
func NewUser ¶
func NewUser(username, password string, authorities []core.GrantedAuthority) *User
NewUser 实例化
func NewUserAllParams ¶
func NewUserAllParams(username, password string, authorities []core.GrantedAuthority, accountNonExpired, accountNonLocked, credentialsNonExpired, enabled bool) *User
NewUserAllParams 实例化
func (*User) GetAuthorities ¶
func (u *User) GetAuthorities() []core.GrantedAuthority
GetAuthorities 获取授予用户的权限
func (*User) IsAccountNonExpired ¶
IsAccountNonExpired 账户是否未过期
func (*User) IsAccountNonLocked ¶
IsAccountNonLocked 账户是否未锁定
func (*User) IsCredentialsNonExpired ¶
IsCredentialsNonExpired 用户凭证(密码)是否未过期
type UserCache ¶
type UserCache interface { // 从缓存中获取用户信息 GetUserFromCache(string) (UserDetails, error) // 增加缓存 PutUserInCache(UserDetails) error // 移除缓存 RemoveUserFromCache(string) error }
UserCache 用户缓存接口
type UserDetails ¶
type UserDetails interface { // 获取授予用户的权限 GetAuthorities() []core.GrantedAuthority // 获取用户名 GetUsername() string // 获取密码 GetPassword() string // 账户是否未过期 IsAccountNonExpired() bool // 账户是否未锁定 IsAccountNonLocked() bool // 用户凭证(密码)是否未过期 IsCredentialsNonExpired() bool // 用户是否可用 IsEnabled() bool }
UserDetails 用户信息
Click to show internal directories.
Click to hide internal directories.