mirror of
https://github.com/fhmq/hmq.git
synced 2026-05-02 14:28:34 +00:00
update
This commit is contained in:
@@ -2,6 +2,7 @@ package authhttp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@@ -88,10 +89,12 @@ func CheckAuth(clientID, username, password string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
io.Copy(ioutil.Discard, resp.Body)
|
||||||
if resp.StatusCode == http.StatusOK {
|
if resp.StatusCode == http.StatusOK {
|
||||||
addCache(action, clientID, username, password, "")
|
addCache(action, clientID, username, password, "")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,6 +130,8 @@ func CheckSuper(clientID, username, password string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
io.Copy(ioutil.Discard, resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode == http.StatusOK {
|
if resp.StatusCode == http.StatusOK {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -165,6 +170,8 @@ func CheckACL(username, access, topic string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
io.Copy(ioutil.Discard, resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode == http.StatusOK {
|
if resp.StatusCode == http.StatusOK {
|
||||||
addCache(action, "", username, "", topic)
|
addCache(action, "", username, "", topic)
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in New Issue
Block a user