25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Log an error when JWT authentication is configured without jwt_key

This commit is contained in:
Evgeny Khramtsov 2019-07-19 12:01:57 +03:00
parent 55d42b9000
commit 4be98b5aef
3 changed files with 12 additions and 5 deletions

View File

@ -39,7 +39,14 @@
%%%----------------------------------------------------------------------
%%% API
%%%----------------------------------------------------------------------
start(_Host) -> ok.
start(Host) ->
case ejabberd_option:jwt_key(Host) of
undefined ->
?ERROR_MSG("Option jwt_key is not configured for ~s: "
"JWT authentication won't work", [Host]);
_ ->
ok
end.
stop(_Host) -> ok.

View File

@ -424,10 +424,10 @@ include_config_file() ->
include_config_file(Host) ->
ejabberd_config:get_option({include_config_file, Host}).
-spec jwt_key() -> jose_jwk:key().
-spec jwt_key() -> jose_jwk:key() | 'undefined'.
jwt_key() ->
jwt_key(global).
-spec jwt_key(global | binary()) -> jose_jwk:key().
-spec jwt_key(global | binary()) -> jose_jwk:key() | 'undefined'.
jwt_key(Host) ->
ejabberd_config:get_option({jwt_key, Host}).

View File

@ -428,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, jose_jwk:key()} |
{jwt_key, jose_jwk:key() | undefined} |
{append_host_config, [{binary(), any()}]} |
{host_config, [{binary(), any()}]} |
{define_macro, any()} |
@ -635,7 +635,7 @@ options() ->
{websocket_origin, []},
{websocket_ping_interval, timer:seconds(60)},
{websocket_timeout, timer:minutes(5)},
{jwt_key, <<"">>}].
{jwt_key, undefined}].
-spec globals() -> [atom()].
globals() ->