From e945b35c917151b760d05533f1e23af9ccf143f2 Mon Sep 17 00:00:00 2001 From: "joy.zhou" Date: Mon, 15 Jul 2019 18:21:12 +0800 Subject: [PATCH] change acl --- plugins/authhttp/authhttp.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/plugins/authhttp/authhttp.go b/plugins/authhttp/authhttp.go index d9a04e4..e0fe382 100644 --- a/plugins/authhttp/authhttp.go +++ b/plugins/authhttp/authhttp.go @@ -114,19 +114,24 @@ func CheckSuper(clientID, username, password string) bool { //CheckACL check mqtt connect func CheckACL(username, access, topic string) bool { - req, err := http.NewRequest("GET", config.ACLURL, nil) + data := url.Values{} + data.Add("username", username) + data.Add("topic", topic) + data.Add("access", access) + + req, err := http.NewRequest("GET", config.ACLURL, strings.NewReader(data.Encode())) if err != nil { log.Error("get acl: ", zap.Error(err)) return false } - data := req.URL.Query() + // data := req.URL.Query() - data.Add("username", username) - data.Add("topic", topic) - data.Add("access", access) - req.URL.RawQuery = data.Encode() - // log.Debugf("req is :%v", req) + // data.Add("username", username) + // data.Add("topic", topic) + // data.Add("access", access) + // req.URL.RawQuery = data.Encode() + // fmt.Println("req:", req) resp, err := httpClient.Do(req) if err != nil { log.Error("request acl: ", zap.Error(err))