Skip to content

Commit 345d5af

Browse files
Remove access_token_format
Rather than configuring the type of token, the server is able to detect if the token is jwt or not
1 parent 75aa944 commit 345d5af

File tree

4 files changed

+3
-26
lines changed

4 files changed

+3
-26
lines changed

deps/rabbitmq_auth_backend_oauth2/include/oauth2.hrl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@
4949
additional_scopes_key :: binary() | undefined,
5050
preferred_username_claims :: list(),
5151
scope_aliases :: map() | undefined,
52-
oauth_provider_id :: oauth_provider_id(),
53-
access_token_format :: jwt | opaque | undefined
52+
oauth_provider_id :: oauth_provider_id()
5453
}).
5554

5655
-type resource_server() :: #resource_server{}.

deps/rabbitmq_auth_backend_oauth2/priv/schema/rabbitmq_auth_backend_oauth2.schema

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,6 @@
153153
rabbit_oauth2_schema:translate_signing_keys(Conf)
154154
end}.
155155

156-
{mapping,
157-
"auth_oauth2.access_token_format",
158-
"rabbitmq_auth_backend_oauth2.access_token_format",
159-
[{datatype, {enum, [jwt, opaque]}}]}.
160-
161156
%% basic_authorization -> Authorization: Basic base64(client_id, client_secret)
162157
%% post_request_param -> &client_id=<client_id>&client_secret=<client_secret>
163158
{mapping,
@@ -468,11 +463,6 @@
468463
"rabbitmq_auth_backend_oauth2.resource_servers",
469464
[{datatype, string}]}.
470465

471-
{mapping,
472-
"auth_oauth2.resource_servers.$name.access_token_format",
473-
"rabbitmq_auth_backend_oauth2.resource_servers",
474-
[{datatype, {enum, [jwt, opaque]}}]}.
475-
476466
{translation, "rabbitmq_auth_backend_oauth2.resource_servers",
477467
fun(Conf) ->
478468
rabbit_oauth2_schema:translate_resource_servers(Conf)

deps/rabbitmq_auth_backend_oauth2/src/rabbit_oauth2_resource_server.erl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ new_resource_server(ResourceServerId) ->
2424
additional_scopes_key = undefined,
2525
preferred_username_claims = ?DEFAULT_PREFERRED_USERNAME_CLAIMS,
2626
scope_aliases = undefined,
27-
oauth_provider_id = root,
28-
access_token_format = jwt
27+
oauth_provider_id = root
2928
}.
3029

3130
-spec resolve_resource_server_from_audience(binary() | list() | none) ->
@@ -86,8 +85,6 @@ get_root_resource_server() ->
8685
end,
8786
ScopePrefix =
8887
get_env(scope_prefix, DefaultScopePrefix),
89-
AccessTokenFormat =
90-
get_env(access_token_format, jwt),
9188
OAuthProviderId =
9289
case get_env(default_oauth_provider) of
9390
undefined -> root;
@@ -102,7 +99,6 @@ get_root_resource_server() ->
10299
additional_scopes_key = AdditionalScopesKey,
103100
preferred_username_claims = PreferredUsernameClaims,
104101
scope_aliases = ScopeAliases,
105-
access_token_format = AccessTokenFormat,
106102
oauth_provider_id = OAuthProviderId
107103
}.
108104

@@ -147,9 +143,6 @@ get_resource_server(ResourceServerId, RootResourseServer) when
147143
undefined -> erlang:iolist_to_binary([ResourceServerId, <<".">>]);
148144
Prefix -> Prefix
149145
end),
150-
AccessTokenFormat =
151-
proplists:get_value(access_token_format, ResourceServerProps,
152-
RootResourseServer#resource_server.access_token_format),
153146
OAuthProviderId =
154147
proplists:get_value(oauth_provider_id, ResourceServerProps,
155148
RootResourseServer#resource_server.oauth_provider_id),
@@ -162,8 +155,7 @@ get_resource_server(ResourceServerId, RootResourseServer) when
162155
additional_scopes_key = AdditionalScopesKey,
163156
preferred_username_claims = PreferredUsernameClaims,
164157
scope_aliases = ScopeAliases,
165-
oauth_provider_id = OAuthProviderId,
166-
access_token_format = AccessTokenFormat
158+
oauth_provider_id = OAuthProviderId
167159
}.
168160

169161
-spec find_audience(binary() | list(), list()) ->

deps/rabbitmq_auth_backend_oauth2/test/config_schema_SUITE_data/rabbitmq_auth_backend_oauth2.snippets

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,11 @@
330330
{token_introspection,
331331
"auth_oauth2.resource_server_id = new_resource_server_id
332332
auth_oauth2.introspection_endpoint = https://introspect
333-
auth_oauth2.access_token_format = jwt
334333
auth_oauth2.introspection_client_auth_method = basic
335334
auth_oauth2.introspection_client_id = rabbit
336335
auth_oauth2.introspection_client_secret = rabbit_secret",
337336
[
338337
{rabbitmq_auth_backend_oauth2, [
339-
{access_token_format, jwt},
340338
{introspection_client_auth_method, basic },
341339
{introspection_client_id, <<"rabbit">> },
342340
{introspection_client_secret, <<"rabbit_secret">> },
@@ -348,14 +346,12 @@
348346
},
349347
{token_introspection_via_oauth_providers,
350348
"auth_oauth2.resource_server_id = new_resource_server_id
351-
auth_oauth2.access_token_format = jwt
352349
auth_oauth2.oauth_providers.p.introspection_endpoint = https://introspect
353350
auth_oauth2.oauth_providers.p.introspection_client_id = rabbit
354351
auth_oauth2.oauth_providers.p.introspection_client_auth_method = basic
355352
auth_oauth2.oauth_providers.p.introspection_client_secret = rabbit_secret",
356353
[
357354
{rabbitmq_auth_backend_oauth2, [
358-
{access_token_format, jwt},
359355
{resource_server_id, <<"new_resource_server_id">>},
360356
{oauth_providers, #{
361357
<<"p">> => [

0 commit comments

Comments
 (0)