fix(build): apply PR#8956 changes
This commit is contained in:
parent
85835256f1
commit
fc3fdfb994
|
@ -133,47 +133,43 @@ authenticate(
|
||||||
password_hash_algorithm := Algorithm
|
password_hash_algorithm := Algorithm
|
||||||
}
|
}
|
||||||
) ->
|
) ->
|
||||||
?WITH_SUCCESSFUL_RENDER(
|
NKey = emqx_authn_utils:render_str(KeyTemplate, Credential),
|
||||||
begin
|
Command = [CommandName, NKey | Fields],
|
||||||
NKey = emqx_authn_utils:render_str(KeyTemplate, Credential),
|
case emqx_resource:query(ResourceId, {cmd, Command}) of
|
||||||
Command = [CommandName, NKey | Fields],
|
{ok, []} ->
|
||||||
case emqx_resource:query(ResourceId, {cmd, Command}) of
|
ignore;
|
||||||
{ok, []} ->
|
{ok, Values} ->
|
||||||
ignore;
|
case merge(Fields, Values) of
|
||||||
{ok, Values} ->
|
Selected when Selected =/= #{} ->
|
||||||
case merge(Fields, Values) of
|
case
|
||||||
Selected when Selected =/= #{} ->
|
emqx_authn_utils:check_password_from_selected_map(
|
||||||
case
|
Algorithm, Selected, Password
|
||||||
emqx_authn_utils:check_password_from_selected_map(
|
)
|
||||||
Algorithm, Selected, Password
|
of
|
||||||
)
|
ok ->
|
||||||
of
|
{ok, emqx_authn_utils:is_superuser(Selected)};
|
||||||
ok ->
|
{error, _Reason} = Error ->
|
||||||
{ok, emqx_authn_utils:is_superuser(Selected)};
|
Error
|
||||||
{error, _Reason} = Error ->
|
|
||||||
Error
|
|
||||||
end;
|
|
||||||
_ ->
|
|
||||||
?TRACE_AUTHN_PROVIDER(info, "redis_query_not_matched", #{
|
|
||||||
resource => ResourceId,
|
|
||||||
cmd => Command,
|
|
||||||
keys => NKey,
|
|
||||||
fields => Fields
|
|
||||||
}),
|
|
||||||
ignore
|
|
||||||
end;
|
end;
|
||||||
{error, Reason} ->
|
_ ->
|
||||||
?TRACE_AUTHN_PROVIDER(error, "redis_query_failed", #{
|
?TRACE_AUTHN_PROVIDER(info, "redis_query_not_matched", #{
|
||||||
resource => ResourceId,
|
resource => ResourceId,
|
||||||
cmd => Command,
|
cmd => Command,
|
||||||
keys => NKey,
|
keys => NKey,
|
||||||
fields => Fields,
|
fields => Fields
|
||||||
reason => Reason
|
|
||||||
}),
|
}),
|
||||||
ignore
|
ignore
|
||||||
end
|
end;
|
||||||
end
|
{error, Reason} ->
|
||||||
).
|
?TRACE_AUTHN_PROVIDER(error, "redis_query_failed", #{
|
||||||
|
resource => ResourceId,
|
||||||
|
cmd => Command,
|
||||||
|
keys => NKey,
|
||||||
|
fields => Fields,
|
||||||
|
reason => Reason
|
||||||
|
}),
|
||||||
|
ignore
|
||||||
|
end.
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% Internal functions
|
%% Internal functions
|
||||||
|
|
|
@ -464,7 +464,7 @@ user_seeds() ->
|
||||||
<<"cmd">> => <<"HMGET mqtt_user:${username} password_hash salt is_superuser">>,
|
<<"cmd">> => <<"HMGET mqtt_user:${username} password_hash salt is_superuser">>,
|
||||||
<<"password_hash_algorithm">> => #{<<"name">> => <<"bcrypt">>}
|
<<"password_hash_algorithm">> => #{<<"name">> => <<"bcrypt">>}
|
||||||
},
|
},
|
||||||
result => {error, not_authorized}
|
result => {error, bad_username_or_password}
|
||||||
},
|
},
|
||||||
|
|
||||||
#{
|
#{
|
||||||
|
|
Loading…
Reference in New Issue