Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var JSON = &jsonProvider{}
JSON json 提供者
Functions ¶
Types ¶
type AccessRight ¶
type AccessRight int
AccessRight 访问权限类型
const ( PullRight AccessRight = 1 << iota // 拉流权限 PushRight // 推流权限 )
权限常量
type Mode ¶
type Mode int
Mode 认证模式
func (*Mode) UnmarshalText ¶
UnmarshalText 从文本编出认证模式 典型的用于 YAML、TOML、JSON等文件编出
type PathMatcher ¶
PathMatcher 路径匹配接口
type Token ¶
type Token struct { Username string `json:"-"` AToken string `json:"access_token"` AExp int64 `json:"-"` RToken string `json:"refresh_token"` RExp int64 `json:"-"` }
Token 用户登录后的Token
type TokenManager ¶
type TokenManager struct {
// contains filtered or unexported fields
}
TokenManager token管理
func (*TokenManager) AccessCheck ¶
func (tm *TokenManager) AccessCheck(atoken string) string
AccessCheck 访问检测
func (*TokenManager) NewToken ¶
func (tm *TokenManager) NewToken(username string) *Token
NewToken 给用户新建Token
func (*TokenManager) Refresh ¶
func (tm *TokenManager) Refresh(rtoken string) *Token
Refresh 刷新指定的Token
type User ¶
type User struct { Name string `json:"name"` Password string `json:"password,omitempty"` Admin bool `json:"admin,omitempty"` PushAccess string `json:"push,omitempty"` PullAccess string `json:"pull,omitempty"` // contains filtered or unexported fields }
User 用户
func (*User) ValidatePassword ¶
ValidatePassword 验证密码
func (*User) ValidatePermission ¶
func (u *User) ValidatePermission(path string, right AccessRight) bool
ValidatePermission 验证权限
Click to show internal directories.
Click to hide internal directories.