25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

Improve jwt_key validator

This commit is contained in:
Evgeny Khramtsov 2019-10-25 18:30:50 +03:00
parent 02cb3d93fd
commit f981a2ef17
2 changed files with 4 additions and 2 deletions

View File

@ -162,7 +162,7 @@ format_error({bad_cert, Why, Path}) ->
format_error({bad_jwt_key, Path}) ->
format("No valid JWT key found in file: ~ts", [Path]);
format_error({bad_jwt_key_set, Path}) ->
format("JWT key contains JWK set in file: ~ts", [Path]);
format("JWK set contains multiple JWT keys in file: ~ts", [Path]);
format_error({bad_jid, Bad}) ->
format("Invalid XMPP address: ~ts", [Bad]);
format_error({bad_user, Bad}) ->

View File

@ -411,8 +411,10 @@ opt_type(jwt_key) ->
case jose_jwk:to_map(JWK) of
{_, #{<<"keys">> := [Key]}} ->
jose_jwk:from_map(Key);
{_, #{<<"keys">> := _}} ->
{_, #{<<"keys">> := [_|_]}} ->
econf:fail({bad_jwt_key_set, Path});
{_, #{<<"keys">> := _}} ->
econf:fail({bad_jwt_key, Path});
_ ->
JWK
end