From c7f177054c4cbb0160b5babc6b632cdc05ed4f5c Mon Sep 17 00:00:00 2001 From: Stefan Strigler Date: Thu, 1 Jun 2023 20:47:47 +0200 Subject: [PATCH] fix(emqx_authn): verify_claims is list(), therefor default must match --- apps/emqx_authn/src/emqx_authn.app.src | 2 +- apps/emqx_authn/src/simple_authn/emqx_authn_jwt.erl | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/emqx_authn/src/emqx_authn.app.src b/apps/emqx_authn/src/emqx_authn.app.src index a291f2f61..8a5b29642 100644 --- a/apps/emqx_authn/src/emqx_authn.app.src +++ b/apps/emqx_authn/src/emqx_authn.app.src @@ -1,7 +1,7 @@ %% -*- mode: erlang -*- {application, emqx_authn, [ {description, "EMQX Authentication"}, - {vsn, "0.1.20"}, + {vsn, "0.1.21"}, {modules, []}, {registered, [emqx_authn_sup, emqx_authn_registry]}, {applications, [kernel, stdlib, emqx_resource, emqx_connector, ehttpc, epgsql, mysql, jose]}, 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 0df9014b8..5fef89078 100644 --- a/apps/emqx_authn/src/simple_authn/emqx_authn_jwt.erl +++ b/apps/emqx_authn/src/simple_authn/emqx_authn_jwt.erl @@ -158,12 +158,15 @@ verify_claims(type) -> verify_claims(desc) -> ?DESC(?FUNCTION_NAME); verify_claims(default) -> - #{}; + []; verify_claims(validator) -> [fun do_check_verify_claims/1]; verify_claims(converter) -> - fun(VerifyClaims) -> - [{to_binary(K), V} || {K, V} <- maps:to_list(VerifyClaims)] + fun + (VerifyClaims) when is_map(VerifyClaims) -> + [{to_binary(K), V} || {K, V} <- maps:to_list(VerifyClaims)]; + (VerifyClaims) -> + VerifyClaims end; verify_claims(required) -> false;