fix(auth mnesia api): parsing the http body parameter does not require url decode
This commit is contained in:
parent
1a291d5d97
commit
f92ff4494b
|
@ -144,12 +144,12 @@ do_add(Params) ->
|
||||||
Username = get_value(<<"username">>, Params, undefined),
|
Username = get_value(<<"username">>, Params, undefined),
|
||||||
Login = case {Clientid, Username} of
|
Login = case {Clientid, Username} of
|
||||||
{undefined, undefined} -> all;
|
{undefined, undefined} -> all;
|
||||||
{_, undefined} -> {clientid, urldecode(Clientid)};
|
{_, undefined} -> {clientid, Clientid};
|
||||||
{undefined, _} -> {username, urldecode(Username)}
|
{undefined, _} -> {username, Username}
|
||||||
end,
|
end,
|
||||||
Topic = urldecode(get_value(<<"topic">>, Params)),
|
Topic = get_value(<<"topic">>, Params),
|
||||||
Action = urldecode(get_value(<<"action">>, Params)),
|
Action = get_value(<<"action">>, Params),
|
||||||
Access = urldecode(get_value(<<"access">>, Params)),
|
Access = get_value(<<"access">>, Params),
|
||||||
Re = case validate([login, topic, action, access], [Login, Topic, Action, Access]) of
|
Re = case validate([login, topic, action, access], [Login, Topic, Action, Access]) of
|
||||||
ok ->
|
ok ->
|
||||||
emqx_acl_mnesia_cli:add_acl(Login, Topic, erlang:binary_to_atom(Action, utf8), erlang:binary_to_atom(Access, utf8));
|
emqx_acl_mnesia_cli:add_acl(Login, Topic, erlang:binary_to_atom(Action, utf8), erlang:binary_to_atom(Access, utf8));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_auth_mnesia,
|
{application, emqx_auth_mnesia,
|
||||||
[{description, "EMQ X Authentication with Mnesia"},
|
[{description, "EMQ X Authentication with Mnesia"},
|
||||||
{vsn, "4.3.2"}, % strict semver, bump manually
|
{vsn, "4.3.3"}, % strict semver, bump manually
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{applications, [kernel,stdlib,mnesia]},
|
{applications, [kernel,stdlib,mnesia]},
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
{VSN,
|
{VSN,
|
||||||
[
|
[
|
||||||
|
{"4.3.2", [
|
||||||
|
{load_module,emqx_acl_mnesia_api, brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_mnesia_api, brutal_purge,soft_purge,[]}
|
||||||
|
]},
|
||||||
{"4.3.1", [
|
{"4.3.1", [
|
||||||
{load_module,emqx_auth_mnesia_api, brutal_purge,soft_purge,[]}
|
{load_module,emqx_auth_mnesia_api, brutal_purge,soft_purge,[]}
|
||||||
]},
|
]},
|
||||||
|
@ -11,6 +15,10 @@
|
||||||
{<<".*">>, []}
|
{<<".*">>, []}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
{"4.3.2", [
|
||||||
|
{load_module,emqx_acl_mnesia_api, brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_mnesia_api, brutal_purge,soft_purge,[]}
|
||||||
|
]},
|
||||||
{"4.3.1", [
|
{"4.3.1", [
|
||||||
{load_module,emqx_auth_mnesia_api, brutal_purge,soft_purge,[]}
|
{load_module,emqx_auth_mnesia_api, brutal_purge,soft_purge,[]}
|
||||||
]},
|
]},
|
||||||
|
|
|
@ -133,14 +133,14 @@ add_clientid(_Bindings, Params) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
do_add_clientid([ Params | ParamsN ], ReList ) ->
|
do_add_clientid([ Params | ParamsN ], ReList ) ->
|
||||||
Clientid = urldecode(get_value(<<"clientid">>, Params)),
|
Clientid = get_value(<<"clientid">>, Params),
|
||||||
do_add_clientid(ParamsN, [{Clientid, format_msg(do_add_clientid(Params))} | ReList]);
|
do_add_clientid(ParamsN, [{Clientid, format_msg(do_add_clientid(Params))} | ReList]);
|
||||||
|
|
||||||
do_add_clientid([], ReList) ->
|
do_add_clientid([], ReList) ->
|
||||||
{ok, ReList}.
|
{ok, ReList}.
|
||||||
|
|
||||||
do_add_clientid(Params) ->
|
do_add_clientid(Params) ->
|
||||||
Clientid = urldecode(get_value(<<"clientid">>, Params)),
|
Clientid = get_value(<<"clientid">>, Params),
|
||||||
Password = get_value(<<"password">>, Params),
|
Password = get_value(<<"password">>, Params),
|
||||||
Login = {clientid, Clientid},
|
Login = {clientid, Clientid},
|
||||||
case validate([login, password], [Login, Password]) of
|
case validate([login, password], [Login, Password]) of
|
||||||
|
@ -182,14 +182,14 @@ add_username(_Bindings, Params) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
do_add_username([ Params | ParamsN ], ReList ) ->
|
do_add_username([ Params | ParamsN ], ReList ) ->
|
||||||
Username = urldecode(get_value(<<"username">>, Params)),
|
Username = get_value(<<"username">>, Params),
|
||||||
do_add_username(ParamsN, [{Username, format_msg(do_add_username(Params))} | ReList]);
|
do_add_username(ParamsN, [{Username, format_msg(do_add_username(Params))} | ReList]);
|
||||||
|
|
||||||
do_add_username([], ReList) ->
|
do_add_username([], ReList) ->
|
||||||
{ok, ReList}.
|
{ok, ReList}.
|
||||||
|
|
||||||
do_add_username(Params) ->
|
do_add_username(Params) ->
|
||||||
Username = urldecode(get_value(<<"username">>, Params)),
|
Username = get_value(<<"username">>, Params),
|
||||||
Password = get_value(<<"password">>, Params),
|
Password = get_value(<<"password">>, Params),
|
||||||
Login = {username, Username},
|
Login = {username, Username},
|
||||||
case validate([login, password], [Login, Password]) of
|
case validate([login, password], [Login, Password]) of
|
||||||
|
|
Loading…
Reference in New Issue