Skip to content

Commit

Permalink
Fix test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcialRosales committed Nov 29, 2024
1 parent 7c37546 commit c46a22c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions deps/rabbitmq_auth_backend_oauth2/src/uaa_jwt.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit c46a22c

Please sign in to comment.