Browse Source

fix(authn): verify claims type is wrong

zhouzb 4 years atrás
parent
commit
d88bfdfe14
1 changed files with 6 additions and 1 deletions
  1. 6 1
      apps/emqx_authn/src/simple_authn/emqx_authn_jwt.erl

+ 6 - 1
apps/emqx_authn/src/simple_authn/emqx_authn_jwt.erl

@@ -125,7 +125,7 @@ verify_claims(default) -> #{};
 verify_claims(validator) -> [fun do_check_verify_claims/1];
 verify_claims(converter) ->
     fun(VerifyClaims) ->
-        maps:to_list(VerifyClaims)
+        [{to_binary(K), V} || {K, V} <- maps:to_list(VerifyClaims)]
     end;
 verify_claims(_) -> undefined.
 
@@ -349,3 +349,8 @@ validate_placeholder(<<"clientid">>) ->
     clientid;
 validate_placeholder(<<"username">>) ->
     username.
+
+to_binary(A) when is_atom(A) ->
+    atom_to_binary(A);
+to_binary(B) when is_binary(B) ->
+    B.