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),
|
||||
Login = case {Clientid, Username} of
|
||||
{undefined, undefined} -> all;
|
||||
{_, undefined} -> {clientid, urldecode(Clientid)};
|
||||
{undefined, _} -> {username, urldecode(Username)}
|
||||
{_, undefined} -> {clientid, Clientid};
|
||||
{undefined, _} -> {username, Username}
|
||||
end,
|
||||
Topic = urldecode(get_value(<<"topic">>, Params)),
|
||||
Action = urldecode(get_value(<<"action">>, Params)),
|
||||
Access = urldecode(get_value(<<"access">>, Params)),
|
||||
Topic = get_value(<<"topic">>, Params),
|
||||
Action = get_value(<<"action">>, Params),
|
||||
Access = get_value(<<"access">>, Params),
|
||||
Re = case validate([login, topic, action, access], [Login, Topic, Action, Access]) of
|
||||
ok ->
|
||||
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,
|
||||
[{description, "EMQ X Authentication with Mnesia"},
|
||||
{vsn, "4.3.2"}, % strict semver, bump manually
|
||||
{vsn, "4.3.3"}, % strict semver, bump manually
|
||||
{modules, []},
|
||||
{registered, []},
|
||||
{applications, [kernel,stdlib,mnesia]},
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
{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", [
|
||||
{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", [
|
||||
{load_module,emqx_auth_mnesia_api, brutal_purge,soft_purge,[]}
|
||||
]},
|
||||
|
|
|
@ -133,14 +133,14 @@ add_clientid(_Bindings, Params) ->
|
|||
end.
|
||||
|
||||
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([], ReList) ->
|
||||
{ok, ReList}.
|
||||
|
||||
do_add_clientid(Params) ->
|
||||
Clientid = urldecode(get_value(<<"clientid">>, Params)),
|
||||
Clientid = get_value(<<"clientid">>, Params),
|
||||
Password = get_value(<<"password">>, Params),
|
||||
Login = {clientid, Clientid},
|
||||
case validate([login, password], [Login, Password]) of
|
||||
|
@ -182,14 +182,14 @@ add_username(_Bindings, Params) ->
|
|||
end.
|
||||
|
||||
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([], ReList) ->
|
||||
{ok, ReList}.
|
||||
|
||||
do_add_username(Params) ->
|
||||
Username = urldecode(get_value(<<"username">>, Params)),
|
||||
Username = get_value(<<"username">>, Params),
|
||||
Password = get_value(<<"password">>, Params),
|
||||
Login = {username, Username},
|
||||
case validate([login, password], [Login, Password]) of
|
||||
|
|
Loading…
Reference in New Issue