From d88bfdfe14eec1fad7ef599bd6b733f1079693e2 Mon Sep 17 00:00:00 2001 From: zhouzb Date: Thu, 25 Nov 2021 16:42:08 +0800 Subject: [PATCH] fix(authn): verify claims type is wrong --- apps/emqx_authn/src/simple_authn/emqx_authn_jwt.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/emqx_authn/src/simple_authn/emqx_authn_jwt.erl b/apps/emqx_authn/src/simple_authn/emqx_authn_jwt.erl index 7a24afccb..67893912c 100644 --- a/apps/emqx_authn/src/simple_authn/emqx_authn_jwt.erl +++ b/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.