Documentation ¶
Index ¶
- type AuthManager
- type AuthServiceProvider
- type CustomCliams
- type DatabaseUserProvider
- func (d *DatabaseUserProvider) RetrieveByCredentials(credentials map[string]interface{}) contracts.IUser
- func (d *DatabaseUserProvider) RetrieveById(identifier string) contracts.IUser
- func (d *DatabaseUserProvider) RetrieveByToken(identifier, token string) contracts.IUser
- func (d *DatabaseUserProvider) UpdateApiToken(user contracts.IUser, token string)
- func (d *DatabaseUserProvider) UpdateRememberToken(user contracts.IUser, token string)
- func (d *DatabaseUserProvider) ValidateCredentials(user contracts.IUser, credentials map[string]interface{}) bool
- type GenericUser
- func (g *GenericUser) Get(name string) interface{}
- func (g *GenericUser) GetApiToken() string
- func (g *GenericUser) GetApiTokenName() string
- func (g *GenericUser) GetAuthIdentifier() string
- func (g *GenericUser) GetAuthIdentifierName() string
- func (g *GenericUser) GetAuthPassword() string
- func (g *GenericUser) GetRememberToken() string
- func (g *GenericUser) GetRememberTokenName() string
- func (g *GenericUser) IsEmpty() bool
- func (g *GenericUser) SetApiToken(v interface{})
- func (g *GenericUser) SetRememberToken(v interface{})
- type JWTGuard
- func (j *JWTGuard) Attempt(credentials map[string]interface{}, remember ...bool) bool
- func (j *JWTGuard) Check() bool
- func (j *JWTGuard) Guest() bool
- func (j *JWTGuard) ID() string
- func (j *JWTGuard) Login(user contracts.IUser, remember ...bool)
- func (j *JWTGuard) Logout()
- func (j *JWTGuard) SetUser(user contracts.IUser)
- func (j *JWTGuard) User() contracts.IUser
- func (j *JWTGuard) Validate(credentials map[string]interface{}) bool
- func (j *JWTGuard) WithContext(c *gin.Context) contracts.IAuth
- type SessionGuard
- func (a *SessionGuard) Attempt(credentials map[string]interface{}, remember ...bool) bool
- func (a *SessionGuard) Check() bool
- func (a *SessionGuard) Guest() bool
- func (a *SessionGuard) ID() string
- func (a *SessionGuard) Login(user contracts.IUser, remember ...bool)
- func (a *SessionGuard) Logout()
- func (a *SessionGuard) SetUser(user contracts.IUser)
- func (a *SessionGuard) User() contracts.IUser
- func (a *SessionGuard) Validate(credentials map[string]interface{}) bool
- func (a *SessionGuard) WithContext(c *gin.Context) contracts.IAuth
- type TokenGuard
- func (t *TokenGuard) Attempt(credentials map[string]interface{}, remember ...bool) bool
- func (t *TokenGuard) Check() bool
- func (t *TokenGuard) Guest() bool
- func (t *TokenGuard) ID() string
- func (t *TokenGuard) Login(user contracts.IUser, remember ...bool)
- func (t *TokenGuard) Logout()
- func (t *TokenGuard) SetUser(user contracts.IUser)
- func (t *TokenGuard) User() contracts.IUser
- func (t *TokenGuard) Validate(credentials map[string]interface{}) bool
- func (t *TokenGuard) WithContext(c *gin.Context) contracts.IAuth
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthManager ¶
type AuthManager struct { App contracts.IApplication // contains filtered or unexported fields }
type AuthServiceProvider ¶
type AuthServiceProvider struct {
*support.ServiceProvider
}
func (*AuthServiceProvider) Register ¶
func (a *AuthServiceProvider) Register()
type CustomCliams ¶
type CustomCliams struct { User *GenericUser *jwt.RegisteredClaims }
type DatabaseUserProvider ¶
type DatabaseUserProvider struct {
// contains filtered or unexported fields
}
func (*DatabaseUserProvider) RetrieveByCredentials ¶
func (d *DatabaseUserProvider) RetrieveByCredentials(credentials map[string]interface{}) contracts.IUser
通过凭证检索
func (*DatabaseUserProvider) RetrieveById ¶
func (d *DatabaseUserProvider) RetrieveById(identifier string) contracts.IUser
func (*DatabaseUserProvider) RetrieveByToken ¶
func (d *DatabaseUserProvider) RetrieveByToken(identifier, token string) contracts.IUser
func (*DatabaseUserProvider) UpdateApiToken ¶
func (d *DatabaseUserProvider) UpdateApiToken(user contracts.IUser, token string)
func (*DatabaseUserProvider) UpdateRememberToken ¶
func (d *DatabaseUserProvider) UpdateRememberToken(user contracts.IUser, token string)
func (*DatabaseUserProvider) ValidateCredentials ¶
func (d *DatabaseUserProvider) ValidateCredentials(user contracts.IUser, credentials map[string]interface{}) bool
type GenericUser ¶
type GenericUser struct {
Attributes map[string]interface{}
}
func (*GenericUser) Get ¶
func (g *GenericUser) Get(name string) interface{}
func (*GenericUser) GetApiToken ¶
func (g *GenericUser) GetApiToken() string
func (*GenericUser) GetApiTokenName ¶
func (g *GenericUser) GetApiTokenName() string
func (*GenericUser) GetAuthIdentifier ¶
func (g *GenericUser) GetAuthIdentifier() string
func (*GenericUser) GetAuthIdentifierName ¶
func (g *GenericUser) GetAuthIdentifierName() string
func (*GenericUser) GetAuthPassword ¶
func (g *GenericUser) GetAuthPassword() string
func (*GenericUser) GetRememberToken ¶
func (g *GenericUser) GetRememberToken() string
func (*GenericUser) GetRememberTokenName ¶
func (g *GenericUser) GetRememberTokenName() string
func (*GenericUser) IsEmpty ¶
func (g *GenericUser) IsEmpty() bool
func (*GenericUser) SetApiToken ¶
func (g *GenericUser) SetApiToken(v interface{})
func (*GenericUser) SetRememberToken ¶
func (g *GenericUser) SetRememberToken(v interface{})
type JWTGuard ¶
type JWTGuard struct {
// contains filtered or unexported fields
}
type SessionGuard ¶
type SessionGuard struct {
// contains filtered or unexported fields
}
func (*SessionGuard) Attempt ¶
func (a *SessionGuard) Attempt(credentials map[string]interface{}, remember ...bool) bool
尝试登录
func (*SessionGuard) Check ¶
func (a *SessionGuard) Check() bool
func (*SessionGuard) Guest ¶
func (a *SessionGuard) Guest() bool
func (*SessionGuard) ID ¶
func (a *SessionGuard) ID() string
func (*SessionGuard) Login ¶
func (a *SessionGuard) Login(user contracts.IUser, remember ...bool)
使用IUser登录
func (*SessionGuard) Logout ¶
func (a *SessionGuard) Logout()
func (*SessionGuard) SetUser ¶
func (a *SessionGuard) SetUser(user contracts.IUser)
func (*SessionGuard) User ¶
func (a *SessionGuard) User() contracts.IUser
func (*SessionGuard) Validate ¶
func (a *SessionGuard) Validate(credentials map[string]interface{}) bool
func (*SessionGuard) WithContext ¶
func (a *SessionGuard) WithContext(c *gin.Context) contracts.IAuth
session, cookie 会用到context
type TokenGuard ¶
type TokenGuard struct {
// contains filtered or unexported fields
}
func (*TokenGuard) Attempt ¶
func (t *TokenGuard) Attempt(credentials map[string]interface{}, remember ...bool) bool
func (*TokenGuard) Check ¶
func (t *TokenGuard) Check() bool
func (*TokenGuard) Guest ¶
func (t *TokenGuard) Guest() bool
func (*TokenGuard) ID ¶
func (t *TokenGuard) ID() string
func (*TokenGuard) Logout ¶
func (t *TokenGuard) Logout()
func (*TokenGuard) SetUser ¶
func (t *TokenGuard) SetUser(user contracts.IUser)
func (*TokenGuard) User ¶
func (t *TokenGuard) User() contracts.IUser
func (*TokenGuard) Validate ¶
func (t *TokenGuard) Validate(credentials map[string]interface{}) bool
func (*TokenGuard) WithContext ¶
func (t *TokenGuard) WithContext(c *gin.Context) contracts.IAuth
Click to show internal directories.
Click to hide internal directories.