mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Improve jwt_key validator
This commit is contained in:
parent
02cb3d93fd
commit
f981a2ef17
@ -162,7 +162,7 @@ format_error({bad_cert, Why, Path}) ->
|
|||||||
format_error({bad_jwt_key, Path}) ->
|
format_error({bad_jwt_key, Path}) ->
|
||||||
format("No valid JWT key found in file: ~ts", [Path]);
|
format("No valid JWT key found in file: ~ts", [Path]);
|
||||||
format_error({bad_jwt_key_set, 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_error({bad_jid, Bad}) ->
|
||||||
format("Invalid XMPP address: ~ts", [Bad]);
|
format("Invalid XMPP address: ~ts", [Bad]);
|
||||||
format_error({bad_user, Bad}) ->
|
format_error({bad_user, Bad}) ->
|
||||||
|
@ -411,8 +411,10 @@ opt_type(jwt_key) ->
|
|||||||
case jose_jwk:to_map(JWK) of
|
case jose_jwk:to_map(JWK) of
|
||||||
{_, #{<<"keys">> := [Key]}} ->
|
{_, #{<<"keys">> := [Key]}} ->
|
||||||
jose_jwk:from_map(Key);
|
jose_jwk:from_map(Key);
|
||||||
{_, #{<<"keys">> := _}} ->
|
{_, #{<<"keys">> := [_|_]}} ->
|
||||||
econf:fail({bad_jwt_key_set, Path});
|
econf:fail({bad_jwt_key_set, Path});
|
||||||
|
{_, #{<<"keys">> := _}} ->
|
||||||
|
econf:fail({bad_jwt_key, Path});
|
||||||
_ ->
|
_ ->
|
||||||
JWK
|
JWK
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user