aboutsummaryrefslogtreecommitdiff
path: root/src/ejabberd_options.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/ejabberd_options.erl')
-rw-r--r--src/ejabberd_options.erl12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ejabberd_options.erl b/src/ejabberd_options.erl
index 518091d98..ba2fdf02f 100644
--- a/src/ejabberd_options.erl
+++ b/src/ejabberd_options.erl
@@ -407,7 +407,17 @@ opt_type(jwt_key) ->
{ok, Data} ->
try jose_jwk:from_binary(Data) of
{error, _} -> econf:fail({bad_jwt_key, Path});
- Ret -> Ret
+ JWK ->
+ case jose_jwk:to_map(JWK) of
+ {_, #{<<"keys">> := [Key]}} ->
+ jose_jwk:from_map(Key);
+ {_, #{<<"keys">> := [_|_]}} ->
+ econf:fail({bad_jwt_key_set, Path});
+ {_, #{<<"keys">> := _}} ->
+ econf:fail({bad_jwt_key, Path});
+ _ ->
+ JWK
+ end
catch _:_ ->
econf:fail({bad_jwt_key, Path})
end;