Skip to content

Commit 580eb1b

Browse files
Fix introspection_client_auth_method
1 parent 563faa4 commit 580eb1b

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

deps/rabbitmq_auth_backend_oauth2/src/rabbit_oauth2_schema.erl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,26 +232,26 @@ merge_list_of_maps(ListOfMaps) ->
232232
extract_oauth_providers_properties(Settings) ->
233233
KeyFun = fun extract_key_as_binary/1,
234234
ValueFun = fun extract_value/1,
235+
MapValueFun = fun(V) ->
236+
case V of
237+
L when is_list(L) -> list_to_binary(L);
238+
B when is_binary(B) -> B;
239+
_ -> V
240+
end end,
235241

236242
OAuthProviders = [{Name, mapOauthProviderProperty(
237243
{
238244
list_to_atom(Key),
239-
list_to_binary(V)})
245+
MapValueFun(V)})
240246
} || {[?AUTH_OAUTH2, ?OAUTH_PROVIDERS, Name, Key], V} <- Settings ],
241247
maps:groups_from_list(KeyFun, ValueFun, OAuthProviders).
242248

243249

244250
extract_resource_server_properties(Settings) ->
245251
KeyFun = fun extract_key_as_binary/1,
246252
ValueFun = fun extract_value/1,
247-
MapValueFun = fun(V) ->
248-
case V of
249-
jwt -> V;
250-
opaque -> V;
251-
_ -> list_to_binary(V)
252-
end end,
253253

254-
ResourceServers = [{Name, {list_to_atom(resource_servers_key_synonym(Key)), MapValueFun(V)}}
254+
ResourceServers = [{Name, {list_to_atom(resource_servers_key_synonym(Key)), list_to_binary(V)}}
255255
|| {[?AUTH_OAUTH2, ?RESOURCE_SERVERS, Name, Key], V} <- Settings ],
256256
maps:groups_from_list(KeyFun, ValueFun, ResourceServers).
257257

deps/rabbitmq_auth_backend_oauth2/test/config_schema_SUITE_data/rabbitmq_auth_backend_oauth2.snippets

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@
351351
auth_oauth2.access_token_format = jwt
352352
auth_oauth2.oauth_providers.p.introspection_endpoint = https://introspect
353353
auth_oauth2.oauth_providers.p.introspection_client_id = rabbit
354+
auth_oauth2.oauth_providers.p.introspection_client_auth_method = basic
354355
auth_oauth2.oauth_providers.p.introspection_client_secret = rabbit_secret",
355356
[
356357
{rabbitmq_auth_backend_oauth2, [
@@ -359,8 +360,9 @@
359360
{oauth_providers, #{
360361
<<"p">> => [
361362
{introspection_client_secret, <<"rabbit_secret">>},
363+
{introspection_client_auth_method, basic},
362364
{introspection_client_id, <<"rabbit">>},
363-
{introspection_endpoint, "https://introspect"}
365+
{introspection_endpoint, "https://introspect"}
364366
]
365367
}}
366368
]}

0 commit comments

Comments
 (0)