Browse Source

Merge pull request #887 from chimit/master

Add ClientId parameter into the auth on HTTP Publish
Feng Lee 8 years atrás
parent
commit
f25661d3cd
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/emqttd_http.erl

+ 3 - 1
src/emqttd_http.erl

@@ -112,13 +112,15 @@ validate(topic, Topic) ->
 %%--------------------------------------------------------------------
 
 authorized(Req) ->
+    Params = mochiweb_request:parse_post(Req),
+    ClientId = get_value("client", Params, http),
     case Req:get_header_value("Authorization") of
     undefined ->
         false;
     "Basic " ++ BasicAuth ->
         {Username, Password} = user_passwd(BasicAuth),
         {ok, Peer} = Req:get(peername),
-        case emqttd_access_control:auth(#mqtt_client{username = Username, peername = Peer}, Password) of
+        case emqttd_access_control:auth(#mqtt_client{client_id = ClientId, username = Username, peername = Peer}, Password) of
             ok ->
                 true;
             {ok, _IsSuper} ->