From c46a22cb8ec8cc1dd3574fe85e60045c4fa889d8 Mon Sep 17 00:00:00 2001 From: Marcial Rosales Date: Fri, 29 Nov 2024 10:03:48 +0100 Subject: [PATCH] Fix test failure --- deps/rabbitmq_auth_backend_oauth2/src/uaa_jwt.erl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/deps/rabbitmq_auth_backend_oauth2/src/uaa_jwt.erl b/deps/rabbitmq_auth_backend_oauth2/src/uaa_jwt.erl index c7288bef4e8..cf14486c6ea 100644 --- a/deps/rabbitmq_auth_backend_oauth2/src/uaa_jwt.erl +++ b/deps/rabbitmq_auth_backend_oauth2/src/uaa_jwt.erl @@ -81,21 +81,22 @@ decode_and_verify(Token) -> end. -spec resolve_resource_server_id(binary()|map()) -> binary() | {error, term()}. -resolve_resource_server_id(Token) when is_binary(Token) -> - case uaa_jwt_jwt:get_aud(Token) of - {error, _} = Error -> - Error; - {ok, Audience} -> - rabbit_oauth2_config:get_resource_server_id_for_audience(Audience) - end; resolve_resource_server_id(Token) when is_map(Token) -> case maps:get(<<"aud">>, Token, undefined) of undefined -> {error, audience_not_found_in_token}; Audience -> rabbit_oauth2_config:get_resource_server_id_for_audience(Audience) + end; +resolve_resource_server_id(Token) -> + case uaa_jwt_jwt:get_aud(Token) of + {error, _} = Error -> + Error; + {ok, Audience} -> + rabbit_oauth2_config:get_resource_server_id_for_audience(Audience) end. + -spec get_jwk(binary(), oauth_provider_id()) -> {ok, map()} | {error, term()}. get_jwk(KeyId, OAuthProviderId) -> get_jwk(KeyId, OAuthProviderId, true).