mirror of
https://github.com/fhmq/hmq.git
synced 2026-04-24 10:38:34 +00:00
29 lines
648 B
Go
29 lines
648 B
Go
package acl
|
|
|
|
type aclAuth struct {
|
|
config *ACLConfig
|
|
}
|
|
|
|
func Init() *aclAuth {
|
|
aclConfig, err := AclConfigLoad("./plugins/auth/authhttp/http.json")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return &aclAuth{
|
|
config: aclConfig,
|
|
}
|
|
}
|
|
|
|
func (a *aclAuth) CheckConnect(clientID, username, password string) bool {
|
|
return checkTopicAuth(a.config, clientID, username, password)
|
|
}
|
|
|
|
func (a *aclAuth) CheckACL(action, username, topic string) bool {
|
|
return checkTopicAuth(a.config, action, clientID, username, password)
|
|
}
|
|
|
|
// type Auth interface {
|
|
// CheckACL(action, username, topic string) bool
|
|
// CheckConnect(clientID, username, password string) bool
|
|
// }
|