Merge pull request #5919 from tigercl/fix/scram-users
fix(authn): fix bad user_id for scram
This commit is contained in:
commit
3df33da9ac
|
@ -148,7 +148,7 @@ add_user(#{user_id := UserID,
|
||||||
case mnesia:read(?TAB, {UserGroup, UserID}, write) of
|
case mnesia:read(?TAB, {UserGroup, UserID}, write) of
|
||||||
[] ->
|
[] ->
|
||||||
IsSuperuser = maps:get(is_superuser, UserInfo, false),
|
IsSuperuser = maps:get(is_superuser, UserInfo, false),
|
||||||
add_user(UserID, Password, IsSuperuser, State),
|
add_user(UserGroup, UserID, Password, IsSuperuser, State),
|
||||||
{ok, #{user_id => UserID, is_superuser => IsSuperuser}};
|
{ok, #{user_id => UserID, is_superuser => IsSuperuser}};
|
||||||
[_] ->
|
[_] ->
|
||||||
{error, already_exist}
|
{error, already_exist}
|
||||||
|
@ -240,9 +240,9 @@ check_client_final_message(Bin, #{is_superuser := IsSuperuser} = Cache, #{algori
|
||||||
{error, not_authorized}
|
{error, not_authorized}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
add_user(UserID, Password, IsSuperuser, State) ->
|
add_user(UserGroup, UserID, Password, IsSuperuser, State) ->
|
||||||
{StoredKey, ServerKey, Salt} = esasl_scram:generate_authentication_info(Password, State),
|
{StoredKey, ServerKey, Salt} = esasl_scram:generate_authentication_info(Password, State),
|
||||||
UserInfo = #user_info{user_id = UserID,
|
UserInfo = #user_info{user_id = {UserGroup, UserID},
|
||||||
stored_key = StoredKey,
|
stored_key = StoredKey,
|
||||||
server_key = ServerKey,
|
server_key = ServerKey,
|
||||||
salt = Salt,
|
salt = Salt,
|
||||||
|
|
Loading…
Reference in New Issue