Documentation
¶
Index ¶
- Constants
- Variables
- type AuthUser
- type IAuth
- type User
- func (u *User) GetAuthorization() (string, error)
- func (u *User) GetAuthorizedAt() (time.Time, error)
- func (u *User) GetEmail() (string, error)
- func (u *User) GetField(key string) (interface{}, error)
- func (u *User) GetID() (string, error)
- func (u *User) GetPassword() (string, error)
- func (u *User) GetRaw() (interface{}, error)
- func (u *User) GetRoles() ([]string, error)
- func (u *User) GetToken() ([]byte, error)
- func (u *User) GetUserModel() *AuthUser
- func (u *User) GetUsername() (string, error)
- func (u *User) IsAuthorized() bool
- func (u *User) SetUserModel(au *AuthUser)
- type UserIDAuth
Constants ¶
View Source
const DefaultUserHeaderKey = "REMOTE_USER"
View Source
const ENCRYPTION_TIMES = 10000
Variables ¶
View Source
var ErrNotSupported = errors.New("not supported")
Functions ¶
This section is empty.
Types ¶
type AuthUser ¶
type AuthUser struct {
ID string `json:"id" gorm:"primaryKey"`
Password string `json:"password"`
Username string `json:"username" gorm:"unique"`
IsSuperuser bool `json:"is_superuser"`
Phone string `json:"phone"`
IsActive bool `json:"is_active"`
CreatedAt datatypes.IRFTime `json:"created_at" gorm:"autoCreateTime"`
IsDel soft_delete.DeletedAt `json:"is_del" gorm:"softDelete:flag"`
}
用户表
type User ¶
type User struct {
// contains filtered or unexported fields
}
实现 iris 的 User 接口: https://github.com/kataras/iris/blob/master/context/context_user.go
func (*User) GetAuthorization ¶
GetAuthorization should return the authorization method, e.g. Basic Authentication.
func (*User) GetPassword ¶
func (*User) GetUsername ¶
func (*User) IsAuthorized ¶
type UserIDAuth ¶
type UserIDAuth struct {
}
使用header里面的 字段 remote_user 作为用户ID进行授权
func NewUserIDAuth ¶
func NewUserIDAuth() *UserIDAuth
func (*UserIDAuth) Auth ¶
func (a *UserIDAuth) Auth(ctx iris.Context)
Click to show internal directories.
Click to hide internal directories.