Documentation
¶
Index ¶
- Variables
- func AuthMiddlewareFunc(af AuthFunc) iris.Handler
- type AuthFunc
- type IUserModel
- 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() IUserModel
- func (u *User) GetUsername() (string, error)
- func (u *User) IsAuthorized() bool
- func (u *User) SetUserModel(au IUserModel)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotSupported = errors.New("not supported")
Functions ¶
func AuthMiddlewareFunc ¶ added in v0.1.6
Types ¶
type IUserModel ¶ added in v0.1.6
type IUserModel interface {
GetID() string // 用户id
GetUsername() string // 用户名
GetPhone() string // 获取手机号
IsAuthorized() bool // 是否授权
}
数据库model
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 ¶
Click to show internal directories.
Click to hide internal directories.