代码拉取完成,页面将自动刷新
同步操作将从 JUMEI_ARCH/volantmq 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package auth
// AccessType acl type
type AccessType int
// Status auth
type Status int
// Error auth provider errors
type Error int
// nolint: golint
const (
AccessTypeRead AccessType = 0x1
AccessTypeWrite = 0x2
AccessTypeAll = 0x3
AccessTypeNone = 0x4
)
// nolint: golint
const (
StatusAllow Status = 0
StatusDeny = 1
StatusNone = 2
)
// nolint: golint
const (
ErrInvalidArgs Error = iota
ErrUnknownProvider
ErrAlreadyExists
ErrNotFound
ErrNotOpen
ErrInternal
)
var errorsDesc = map[Error]string{
ErrInvalidArgs: "auth: invalid arguments",
ErrUnknownProvider: "auth: unknown provider",
ErrAlreadyExists: "auth: already exists",
ErrNotFound: "auth: not found",
ErrNotOpen: "auth: not open",
ErrInternal: "auth: internal error",
}
var statusDesc = map[Status]string{
StatusAllow: "auth status: access granted",
StatusDeny: "auth status: access denied",
}
type UserParam struct {
User string `json:user`
Password string `json:password`
Status string `json:status`
Topic string `json:topic`
Access string `json:access`
}
// Provider interface
type Provider interface {
// Password try authenticate with username and password
Password(string, string) Status
// ACL check access type for client id with username
ACL(id string, username string, topic string, accessType AccessType) Status
ListUsers(handle func(string, string, string, string, string)) error
AddUser(param *UserParam) error
DelUser(user string) error
}
// SessionPermissions check session permissions
type SessionPermissions interface {
ACL(id string, username string, topic string, accessType AccessType) Status
}
// Type return string representation of the type
func (t AccessType) Type() string {
switch t {
case AccessTypeRead:
return "read"
case AccessTypeWrite:
return "write"
}
return ""
}
func (e Error) Error() string {
if s, ok := errorsDesc[e]; ok {
return s
}
return "auth: unknown error"
}
func (e Status) Error() string {
if s, ok := statusDesc[e]; ok {
return s
}
return "auth status: unknown status"
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。