Skip to content

Commit 692f299

Browse files
Merge pull request #12258 from rabbitmq/make-some-oauth2-settings-optional
Make some OAuth2 settings optional
2 parents 5f87cc9 + c15f19f commit 692f299

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+4347
-3534
lines changed

.github/workflows/test-authnz.yaml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,10 @@ jobs:
6262
with:
6363
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}
6464

65-
- name: Configure Bazel
66-
run: |
67-
if [ -n "${{ secrets.REMOTE_CACHE_BUCKET_NAME }}" ]; then
68-
cat << EOF >> user.bazelrc
69-
build --remote_cache=https://storage.googleapis.com/${{ secrets.REMOTE_CACHE_BUCKET_NAME }}
70-
build --google_default_credentials
71-
72-
build --remote_download_toplevel
73-
EOF
74-
fi
75-
cat << EOF >> user.bazelrc
76-
build --color=yes
77-
EOF
78-
7965
- name: Build & Load RabbitMQ OCI
8066
run: |
81-
bazelisk run packaging/docker-image:rabbitmq-amd64
67+
make package-generic-unix
68+
make docker-image
8269
8370
- name: Configure Docker Network
8471
run: |
@@ -91,7 +78,8 @@ jobs:
9178
9279
- name: Run Suites
9380
run: |
94-
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq-amd64 \
81+
IMAGE_TAG=$(find PACKAGES/rabbitmq-server-generic-unix-*.tar.xz | awk -F 'PACKAGES/rabbitmq-server-generic-unix-|.tar.xz' '{print $2}')
82+
RABBITMQ_DOCKER_IMAGE=pivotalrabbitmq/rabbitmq:$IMAGE_TAG \
9583
${SELENIUM_DIR}/run-suites.sh full-suite-authnz-messaging
9684
9785
- name: Upload Test Artifacts

.github/workflows/test-management-ui-for-pr.yaml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,10 @@ jobs:
4242
with:
4343
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}
4444

45-
- name: Configure Bazel
46-
run: |
47-
if [ -n "${{ secrets.REMOTE_CACHE_BUCKET_NAME }}" ]; then
48-
cat << EOF >> user.bazelrc
49-
build --remote_cache=https://storage.googleapis.com/${{ secrets.REMOTE_CACHE_BUCKET_NAME }}
50-
build --google_default_credentials
51-
52-
build --remote_download_toplevel
53-
EOF
54-
fi
55-
cat << EOF >> user.bazelrc
56-
build --color=yes
57-
EOF
58-
5945
- name: Build & Load RabbitMQ OCI
6046
run: |
61-
bazelisk run packaging/docker-image:rabbitmq-amd64
47+
make package-generic-unix
48+
make docker-image
6249
6350
- name: Configure Docker Network
6451
run: |
@@ -71,8 +58,9 @@ jobs:
7158
7259
- name: Run full ui suites on a standalone rabbitmq server
7360
run: |
74-
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq-amd64 \
75-
${SELENIUM_DIR}/run-suites.sh
61+
IMAGE_TAG=$(find PACKAGES/rabbitmq-server-generic-unix-*.tar.xz | awk -F 'PACKAGES/rabbitmq-server-generic-unix-|.tar.xz' '{print $2}')
62+
RABBITMQ_DOCKER_IMAGE=pivotalrabbitmq/rabbitmq:$IMAGE_TAG \
63+
${SELENIUM_DIR}/run-suites.sh short-suite-management-ui
7664
mkdir -p /tmp/full-suite
7765
mv /tmp/selenium/* /tmp/full-suite
7866
mkdir -p /tmp/full-suite/logs

.github/workflows/test-management-ui.yaml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,10 @@ jobs:
5656
with:
5757
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}
5858

59-
- name: Configure Bazel
60-
run: |
61-
if [ -n "${{ secrets.REMOTE_CACHE_BUCKET_NAME }}" ]; then
62-
cat << EOF >> user.bazelrc
63-
build --remote_cache=https://storage.googleapis.com/${{ secrets.REMOTE_CACHE_BUCKET_NAME }}
64-
build --google_default_credentials
65-
66-
build --remote_download_toplevel
67-
EOF
68-
fi
69-
cat << EOF >> user.bazelrc
70-
build --color=yes
71-
EOF
72-
7359
- name: Build & Load RabbitMQ OCI
7460
run: |
75-
bazelisk run packaging/docker-image:rabbitmq-amd64
61+
make package-generic-unix
62+
make docker-image
7663
7764
- name: Configure Docker Network
7865
run: |
@@ -84,9 +71,10 @@ jobs:
8471
docker build -t mocha-test --target test .
8572
8673
- name: Run short ui suite on a 3-node rabbitmq cluster
87-
run: |
88-
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq-amd64 \
89-
ADDON_PROFILES=cluster ${SELENIUM_DIR}/run-suites.sh short-suite-management-ui
74+
run: |
75+
IMAGE_TAG=$(find PACKAGES/rabbitmq-server-generic-unix-*.tar.xz | awk -F 'PACKAGES/rabbitmq-server-generic-unix-|.tar.xz' '{print $2}')
76+
RABBITMQ_DOCKER_IMAGE=pivotalrabbitmq/rabbitmq:$IMAGE_TAG \
77+
${SELENIUM_DIR}/run-suites.sh short-suite-management-ui
9078
mkdir -p /tmp/short-suite
9179
mv /tmp/selenium/* /tmp/short-suite
9280
mkdir -p /tmp/short-suite/logs

deps/oauth2_client/app.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def all_srcs(name = "all_srcs"):
6464
)
6565
filegroup(
6666
name = "public_hdrs",
67-
srcs = ["include/oauth2_client.hrl"],
67+
srcs = ["include/oauth2_client.hrl", "include/types.hrl"],
6868
)
6969
filegroup(
7070
name = "license_files",
@@ -88,7 +88,7 @@ def test_suite_beam_files(name = "test_suite_beam_files"):
8888
testonly = True,
8989
srcs = ["test/system_SUITE.erl"],
9090
outs = ["test/system_SUITE.beam"],
91-
hdrs = ["include/oauth2_client.hrl"],
91+
hdrs = ["include/oauth2_client.hrl", "include/types.hrl"],
9292
app_name = "oauth2_client",
9393
erlc_opts = "//:test_erlc_opts",
9494
)
@@ -97,7 +97,7 @@ def test_suite_beam_files(name = "test_suite_beam_files"):
9797
testonly = True,
9898
srcs = ["test/unit_SUITE.erl"],
9999
outs = ["test/unit_SUITE.beam"],
100-
hdrs = ["include/oauth2_client.hrl"],
100+
hdrs = ["include/oauth2_client.hrl", "include/types.hrl"],
101101
app_name = "oauth2_client",
102102
erlc_opts = "//:test_erlc_opts",
103103
)

deps/oauth2_client/include/oauth2_client.hrl

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
%% Copyright (c) 2020-2023 VMware, Inc. or its affiliates. All rights reserved.
66
%%
77

8+
-include("types.hrl").
89

910
% define access token request common constants
1011

@@ -44,66 +45,3 @@
4445
-define(RESPONSE_END_SESSION_ENDPOINT, <<"end_session_endpoint">>).
4546
-define(RESPONSE_JWKS_URI, <<"jwks_uri">>).
4647
-define(RESPONSE_TLS_OPTIONS, <<"ssl_options">>).
47-
48-
%% The closest we have to a type import in Erlang
49-
-type option(T) :: rabbit_types:option(T).
50-
51-
-type oauth_provider_id() :: root | binary().
52-
53-
-record(openid_configuration, {
54-
issuer :: option(uri_string:uri_string()),
55-
token_endpoint :: option(uri_string:uri_string()),
56-
authorization_endpoint :: option(uri_string:uri_string()),
57-
end_session_endpoint :: option(uri_string:uri_string()),
58-
jwks_uri :: option(uri_string:uri_string())
59-
}).
60-
-type openid_configuration() :: #openid_configuration{}.
61-
62-
-record(oauth_provider, {
63-
id :: oauth_provider_id(),
64-
issuer :: option(uri_string:uri_string()),
65-
token_endpoint :: option(uri_string:uri_string()),
66-
authorization_endpoint :: option(uri_string:uri_string()),
67-
end_session_endpoint :: option(uri_string:uri_string()),
68-
jwks_uri :: option(uri_string:uri_string()),
69-
ssl_options :: option(list())
70-
}).
71-
72-
-type oauth_provider() :: #oauth_provider{}.
73-
74-
-record(access_token_request, {
75-
client_id :: string() | binary(),
76-
client_secret :: string() | binary(),
77-
scope :: string() | binary() | undefined,
78-
timeout :: option(integer())
79-
}).
80-
81-
-type access_token_request() :: #access_token_request{}.
82-
83-
-record(successful_access_token_response, {
84-
access_token :: binary(),
85-
token_type :: binary(),
86-
refresh_token :: option(binary()), % A refresh token SHOULD NOT be included
87-
% .. for client-credentials flow.
88-
% https://www.rfc-editor.org/rfc/rfc6749#section-4.4.3
89-
expires_in :: option(integer())
90-
}).
91-
92-
-type successful_access_token_response() :: #successful_access_token_response{}.
93-
94-
-record(unsuccessful_access_token_response, {
95-
error :: integer(),
96-
error_description :: binary() | string() | undefined
97-
}).
98-
99-
-type unsuccessful_access_token_response() :: #unsuccessful_access_token_response{}.
100-
101-
-record(refresh_token_request, {
102-
client_id :: string() | binary(),
103-
client_secret :: string() | binary(),
104-
scope :: string() | binary() | undefined,
105-
refresh_token :: binary(),
106-
timeout :: option(integer())
107-
}).
108-
109-
-type refresh_token_request() :: #refresh_token_request{}.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
%% This Source Code Form is subject to the terms of the Mozilla Public
2+
%% License, v. 2.0. If a copy of the MPL was not distributed with this
3+
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
4+
%%
5+
%% Copyright (c) 2020-2023 VMware, Inc. or its affiliates. All rights reserved.
6+
%%
7+
8+
%% Matches the option type in rabbit_types without introducing a dependency
9+
%% on that module and RabbitMQ core (rabbit_common)
10+
-type(option(T) :: T | 'none' | 'undefined').
11+
12+
-type oauth_provider_id() :: root | binary().
13+
14+
-record(openid_configuration, {
15+
issuer :: option(uri_string:uri_string()),
16+
token_endpoint :: option(uri_string:uri_string()),
17+
authorization_endpoint :: option(uri_string:uri_string()),
18+
end_session_endpoint :: option(uri_string:uri_string()),
19+
jwks_uri :: option(uri_string:uri_string())
20+
}).
21+
-type openid_configuration() :: #openid_configuration{}.
22+
23+
-record(oauth_provider, {
24+
id :: oauth_provider_id(),
25+
issuer :: option(uri_string:uri_string()),
26+
discovery_endpoint :: option(uri_string:uri_string()),
27+
token_endpoint :: option(uri_string:uri_string()),
28+
authorization_endpoint :: option(uri_string:uri_string()),
29+
end_session_endpoint :: option(uri_string:uri_string()),
30+
jwks_uri :: option(uri_string:uri_string()),
31+
ssl_options :: option(list())
32+
}).
33+
34+
-type query_list() :: [{unicode:chardata(), unicode:chardata() | true}].
35+
36+
-type oauth_provider() :: #oauth_provider{}.
37+
38+
-record(access_token_request, {
39+
client_id :: string() | binary(),
40+
client_secret :: string() | binary(),
41+
scope :: option(string() | binary()),
42+
extra_parameters :: option(query_list()),
43+
timeout :: option(integer())
44+
}).
45+
46+
-type access_token_request() :: #access_token_request{}.
47+
48+
-record(successful_access_token_response, {
49+
access_token :: binary(),
50+
token_type :: binary(),
51+
%% Note: a refresh token SHOULD NOT be included
52+
%% ... for client-credentials flow.
53+
%% See https://www.rfc-editor.org/rfc/rfc6749#section-4.4.3
54+
refresh_token :: option(binary()),
55+
expires_in :: option(integer())
56+
}).
57+
58+
-type successful_access_token_response() :: #successful_access_token_response{}.
59+
60+
-record(unsuccessful_access_token_response, {
61+
error :: integer(),
62+
error_description :: binary() | string() | undefined
63+
}).
64+
65+
-type unsuccessful_access_token_response() :: #unsuccessful_access_token_response{}.
66+
67+
-record(refresh_token_request, {
68+
client_id :: string() | binary(),
69+
client_secret :: string() | binary(),
70+
scope :: string() | binary() | undefined,
71+
refresh_token :: binary(),
72+
timeout :: option(integer())
73+
}).
74+
75+
-type refresh_token_request() :: #refresh_token_request{}.

0 commit comments

Comments
 (0)