diff options
Diffstat (limited to 'src/ejabberd_options.erl')
-rw-r--r-- | src/ejabberd_options.erl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ejabberd_options.erl b/src/ejabberd_options.erl index cbd36cca6..a9b435dfb 100644 --- a/src/ejabberd_options.erl +++ b/src/ejabberd_options.erl @@ -399,7 +399,13 @@ opt_type(jwt_key) -> econf:file(), fun(Path) -> case file:read_file(Path) of - {ok, Binary} -> Binary; + {ok, Data} -> + try jose_jwk:from_binary(Data) of + {error, _} -> econf:fail({bad_jwt_key, Path}); + Ret -> Ret + catch _:_ -> + econf:fail({bad_jwt_key, Path}) + end; {error, Reason} -> econf:fail({read_file, Reason, Path}) end @@ -422,7 +428,7 @@ opt_type(jwt_key) -> {shaper, #{atom() => ejabberd_shaper:shaper_rate()}} | {shaper_rules, [{atom(), [ejabberd_shaper:shaper_rule()]}]} | {api_permissions, [ejabberd_access_permissions:permission()]} | - {jwt_key, binary()} | + {jwt_key, jose_jwk:key()} | {append_host_config, [{binary(), any()}]} | {host_config, [{binary(), any()}]} | {define_macro, any()} | |