Merge pull request #6338 from tigercl/fix/superuser

fix(authn): fix superuser when missing is_superuser_field
This commit is contained in:
tigercl 2021-12-01 14:00:56 +08:00 committed by GitHub
commit e888e1ef8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -237,7 +237,9 @@ check_password(Password,
is_superuser(Doc, #{is_superuser_field := IsSuperuserField}) ->
IsSuperuser = maps:get(IsSuperuserField, Doc, false),
emqx_authn_utils:is_superuser(#{<<"is_superuser">> => IsSuperuser}).
emqx_authn_utils:is_superuser(#{<<"is_superuser">> => IsSuperuser});
is_superuser(_, _) ->
emqx_authn_utils:is_superuser(#{<<"is_superuser">> => false}).
hash(Algorithm, Password, Salt, prefix) ->
emqx_passwd:hash(Algorithm, <<Salt/binary, Password/binary>>);