Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some OAuth2 settings optional #12258

Merged
merged 64 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
7aca160
Deprecate resource req parameter from authorize endpoint
MarcialRosales Sep 9, 2024
4da4599
Minor refactor
MarcialRosales Sep 9, 2024
3cf5b7e
Reduce verbosity of some log statements
MarcialRosales Sep 10, 2024
6fb83af
Reduce logging verbosity
MarcialRosales Sep 10, 2024
2a3dcb3
WIP Refactor code
MarcialRosales Sep 11, 2024
7064969
WIP More refactoring
MarcialRosales Sep 12, 2024
9984eef
WIP Fix compilation errors
MarcialRosales Sep 13, 2024
91e4666
WIP Continue refactoring + clean up
MarcialRosales Sep 13, 2024
af4ce0b
WIP Fix compilation errors
MarcialRosales Sep 13, 2024
4576aaa
Refactor assertion function
MarcialRosales Sep 13, 2024
aecb86d
WIP Fix test cases
MarcialRosales Sep 13, 2024
158fa3b
WIP fix some test cases
MarcialRosales Sep 13, 2024
34f5d10
WIP fix more test cases
MarcialRosales Sep 13, 2024
66d9323
Simplify module names
MarcialRosales Sep 16, 2024
b5230f7
Fix some test cases
MarcialRosales Sep 16, 2024
2f0faec
Fix test cases
MarcialRosales Sep 16, 2024
5c2b90b
fix some test cases
MarcialRosales Sep 16, 2024
42a1a47
Fix test cases
MarcialRosales Sep 16, 2024
8339015
WIP Use resource_server() type
MarcialRosales Sep 16, 2024
c4e8521
Fix test cases
MarcialRosales Sep 17, 2024
9ecca5a
Fix test system test cases
MarcialRosales Sep 17, 2024
0f5f766
More test fixes + clean up + refactor
MarcialRosales Sep 17, 2024
54ac148
Fix issue and test
MarcialRosales Sep 17, 2024
b9217ae
Fix test cases and refactor rar and keycloak
MarcialRosales Sep 18, 2024
12b8c0d
Fix all test in unit_SUITE
MarcialRosales Sep 18, 2024
7792b70
Fix dialyzer errors
MarcialRosales Sep 18, 2024
5044e29
Add token endpoint params to schema
MarcialRosales Sep 18, 2024
0d4fb55
Remove unnecessary statement
MarcialRosales Sep 18, 2024
b339714
Test invalid token parameter config
MarcialRosales Sep 18, 2024
9f11f25
Fix test
MarcialRosales Sep 19, 2024
eb2fbc6
Improve format
MarcialRosales Sep 19, 2024
f61ba39
Add explicitly sub preferred_username
MarcialRosales Sep 19, 2024
0de61a9
WIP Build discovery_endpoint
MarcialRosales Sep 19, 2024
462c7e5
Fix test case
MarcialRosales Sep 19, 2024
9ec93c9
Clean up ct:log statements
MarcialRosales Sep 19, 2024
06edb55
Fix dialyzer error
MarcialRosales Sep 20, 2024
b2532e0
Modify management schema
MarcialRosales Sep 20, 2024
c7681c9
Send new params to management ui
MarcialRosales Sep 20, 2024
81342df
WIP Elminate defaults and take from config
MarcialRosales Sep 20, 2024
0e80bfb
Add auth and token endpoint params to authSettings
MarcialRosales Sep 23, 2024
94a9cf6
Test authSettings with extra endpoint params
MarcialRosales Sep 23, 2024
33da376
Teet extra token parans for additioal resource servers
MarcialRosales Sep 23, 2024
6d0e195
Fix schema issues
MarcialRosales Sep 23, 2024
6e74d8b
Always use list() type for urls
MarcialRosales Sep 24, 2024
4b7f8b2
Fix schema mapping issues
MarcialRosales Sep 24, 2024
c1e8279
Remove function
MarcialRosales Sep 24, 2024
966d5d4
Fix fucntion signature
MarcialRosales Sep 24, 2024
4142b73
Fix issue initializing oidc-client
MarcialRosales Sep 24, 2024
252b02c
Remove unnecessary log statements
MarcialRosales Sep 24, 2024
a882f8a
Fix error
MarcialRosales Sep 25, 2024
16cccd3
Remove some spaces
MarcialRosales Sep 27, 2024
f56324e
Remove wrong file
MarcialRosales Sep 27, 2024
ea6f194
OAuth 2 client: sync option/1 with rabbit_types, add a comment
michaelklishin Oct 4, 2024
d25e0f8
Refactoring
MarcialRosales Oct 4, 2024
0ec415a
Fix bazel misconfiguration
MarcialRosales Oct 7, 2024
743f663
Fix bazel configuration
MarcialRosales Oct 7, 2024
21a4a25
Run selenium job with Makefile
MarcialRosales Oct 8, 2024
e1e101d
Fix issue with docker image name
MarcialRosales Oct 8, 2024
d98eb17
Move also selenium authz tests to Makefile
MarcialRosales Oct 8, 2024
545abce
CQ: Fix shared store scanner missing messages
lhoguin Sep 26, 2024
541f053
Dependency Recon updated from 2.5.3 to 2.5.6
SimonUnge Oct 7, 2024
d63d70c
bazel run gazelle
web-flow Oct 8, 2024
e7f82a5
OAuth 2: add a missing dependency on rabbitmq_cli
michaelklishin Oct 8, 2024
c15f19f
OAuth 2: CLI is a build time dependency, not a runtime one
michaelklishin Oct 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions .github/workflows/test-authnz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,10 @@ jobs:
with:
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}

- name: Configure Bazel
run: |
if [ -n "${{ secrets.REMOTE_CACHE_BUCKET_NAME }}" ]; then
cat << EOF >> user.bazelrc
build --remote_cache=https://storage.googleapis.com/${{ secrets.REMOTE_CACHE_BUCKET_NAME }}
build --google_default_credentials

build --remote_download_toplevel
EOF
fi
cat << EOF >> user.bazelrc
build --color=yes
EOF

- name: Build & Load RabbitMQ OCI
run: |
bazelisk run packaging/docker-image:rabbitmq-amd64
make package-generic-unix
make docker-image

- name: Configure Docker Network
run: |
Expand All @@ -91,7 +78,8 @@ jobs:

- name: Run Suites
run: |
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq-amd64 \
IMAGE_TAG=$(find PACKAGES/rabbitmq-server-generic-unix-*.tar.xz | awk -F 'PACKAGES/rabbitmq-server-generic-unix-|.tar.xz' '{print $2}')
RABBITMQ_DOCKER_IMAGE=pivotalrabbitmq/rabbitmq:$IMAGE_TAG \
${SELENIUM_DIR}/run-suites.sh full-suite-authnz-messaging

- name: Upload Test Artifacts
Expand Down
22 changes: 5 additions & 17 deletions .github/workflows/test-management-ui-for-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,10 @@ jobs:
with:
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}

- name: Configure Bazel
run: |
if [ -n "${{ secrets.REMOTE_CACHE_BUCKET_NAME }}" ]; then
cat << EOF >> user.bazelrc
build --remote_cache=https://storage.googleapis.com/${{ secrets.REMOTE_CACHE_BUCKET_NAME }}
build --google_default_credentials

build --remote_download_toplevel
EOF
fi
cat << EOF >> user.bazelrc
build --color=yes
EOF

- name: Build & Load RabbitMQ OCI
run: |
bazelisk run packaging/docker-image:rabbitmq-amd64
make package-generic-unix
make docker-image

- name: Configure Docker Network
run: |
Expand All @@ -71,8 +58,9 @@ jobs:

- name: Run full ui suites on a standalone rabbitmq server
run: |
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq-amd64 \
${SELENIUM_DIR}/run-suites.sh
IMAGE_TAG=$(find PACKAGES/rabbitmq-server-generic-unix-*.tar.xz | awk -F 'PACKAGES/rabbitmq-server-generic-unix-|.tar.xz' '{print $2}')
RABBITMQ_DOCKER_IMAGE=pivotalrabbitmq/rabbitmq:$IMAGE_TAG \
${SELENIUM_DIR}/run-suites.sh short-suite-management-ui
mkdir -p /tmp/full-suite
mv /tmp/selenium/* /tmp/full-suite
mkdir -p /tmp/full-suite/logs
Expand Down
24 changes: 6 additions & 18 deletions .github/workflows/test-management-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,10 @@ jobs:
with:
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}

- name: Configure Bazel
run: |
if [ -n "${{ secrets.REMOTE_CACHE_BUCKET_NAME }}" ]; then
cat << EOF >> user.bazelrc
build --remote_cache=https://storage.googleapis.com/${{ secrets.REMOTE_CACHE_BUCKET_NAME }}
build --google_default_credentials

build --remote_download_toplevel
EOF
fi
cat << EOF >> user.bazelrc
build --color=yes
EOF

- name: Build & Load RabbitMQ OCI
run: |
bazelisk run packaging/docker-image:rabbitmq-amd64
make package-generic-unix
make docker-image

- name: Configure Docker Network
run: |
Expand All @@ -84,9 +71,10 @@ jobs:
docker build -t mocha-test --target test .

- name: Run short ui suite on a 3-node rabbitmq cluster
run: |
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq-amd64 \
ADDON_PROFILES=cluster ${SELENIUM_DIR}/run-suites.sh short-suite-management-ui
run: |
IMAGE_TAG=$(find PACKAGES/rabbitmq-server-generic-unix-*.tar.xz | awk -F 'PACKAGES/rabbitmq-server-generic-unix-|.tar.xz' '{print $2}')
RABBITMQ_DOCKER_IMAGE=pivotalrabbitmq/rabbitmq:$IMAGE_TAG \
${SELENIUM_DIR}/run-suites.sh short-suite-management-ui
mkdir -p /tmp/short-suite
mv /tmp/selenium/* /tmp/short-suite
mkdir -p /tmp/short-suite/logs
Expand Down
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ erlang_package.hex_package(
erlang_package.hex_package(
name = "recon",
build_file = "@rabbitmq-server//bazel:BUILD.recon",
sha256 = "6c6683f46fd4a1dfd98404b9f78dcabc7fcd8826613a89dcb984727a8c3099d7",
version = "2.5.3",
sha256 = "96c6799792d735cc0f0fd0f86267e9d351e63339cbe03df9d162010cefc26bb0",
version = "2.5.6",
)

erlang_package.hex_package(
Expand Down
38 changes: 16 additions & 22 deletions bazel/BUILD.recon
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,9 @@ erlang_bytecode(
"src/recon_rec.erl",
"src/recon_trace.erl",
],
outs = [
"ebin/recon.beam",
"ebin/recon_alloc.beam",
"ebin/recon_lib.beam",
"ebin/recon_map.beam",
"ebin/recon_rec.beam",
"ebin/recon_trace.beam",
],
hdrs = [],
hdrs = [":public_and_private_hdrs"],
app_name = "recon",
beam = [],
dest = "ebin",
erlc_opts = "//:erlc_opts",
)

Expand All @@ -57,20 +49,11 @@ filegroup(
],
)

filegroup(
name = "private_hdrs",
srcs = [],
)
filegroup(name = "private_hdrs")

filegroup(
name = "public_hdrs",
srcs = [],
)
filegroup(name = "public_hdrs")

filegroup(
name = "priv",
srcs = [],
)
filegroup(name = "priv")

filegroup(
name = "licenses",
Expand All @@ -96,12 +79,23 @@ filegroup(
erlang_app(
name = "erlang_app",
srcs = [":all_srcs"],
hdrs = [":public_hdrs"],
app_name = "recon",
beam_files = [":beam_files"],
extra_apps = ["syntax_tools"],
license_files = [":license_files"],
priv = [":priv"],
)

alias(
name = "recon",
actual = ":erlang_app",
visibility = ["//visibility:public"],
)

filegroup(
name = "license_files",
srcs = [
"LICENSE",
],
)
6 changes: 3 additions & 3 deletions deps/oauth2_client/app.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def all_srcs(name = "all_srcs"):
)
filegroup(
name = "public_hdrs",
srcs = ["include/oauth2_client.hrl"],
srcs = ["include/oauth2_client.hrl", "include/types.hrl"],
)
filegroup(
name = "license_files",
Expand All @@ -88,7 +88,7 @@ def test_suite_beam_files(name = "test_suite_beam_files"):
testonly = True,
srcs = ["test/system_SUITE.erl"],
outs = ["test/system_SUITE.beam"],
hdrs = ["include/oauth2_client.hrl"],
hdrs = ["include/oauth2_client.hrl", "include/types.hrl"],
app_name = "oauth2_client",
erlc_opts = "//:test_erlc_opts",
)
Expand All @@ -97,7 +97,7 @@ def test_suite_beam_files(name = "test_suite_beam_files"):
testonly = True,
srcs = ["test/unit_SUITE.erl"],
outs = ["test/unit_SUITE.beam"],
hdrs = ["include/oauth2_client.hrl"],
hdrs = ["include/oauth2_client.hrl", "include/types.hrl"],
app_name = "oauth2_client",
erlc_opts = "//:test_erlc_opts",
)
Expand Down
64 changes: 1 addition & 63 deletions deps/oauth2_client/include/oauth2_client.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
%% Copyright (c) 2020-2023 VMware, Inc. or its affiliates. All rights reserved.
%%

-include("types.hrl").

% define access token request common constants

Expand Down Expand Up @@ -44,66 +45,3 @@
-define(RESPONSE_END_SESSION_ENDPOINT, <<"end_session_endpoint">>).
-define(RESPONSE_JWKS_URI, <<"jwks_uri">>).
-define(RESPONSE_TLS_OPTIONS, <<"ssl_options">>).

%% The closest we have to a type import in Erlang
-type option(T) :: rabbit_types:option(T).

-type oauth_provider_id() :: root | binary().

-record(openid_configuration, {
issuer :: option(uri_string:uri_string()),
token_endpoint :: option(uri_string:uri_string()),
authorization_endpoint :: option(uri_string:uri_string()),
end_session_endpoint :: option(uri_string:uri_string()),
jwks_uri :: option(uri_string:uri_string())
}).
-type openid_configuration() :: #openid_configuration{}.

-record(oauth_provider, {
id :: oauth_provider_id(),
issuer :: option(uri_string:uri_string()),
token_endpoint :: option(uri_string:uri_string()),
authorization_endpoint :: option(uri_string:uri_string()),
end_session_endpoint :: option(uri_string:uri_string()),
jwks_uri :: option(uri_string:uri_string()),
ssl_options :: option(list())
}).

-type oauth_provider() :: #oauth_provider{}.

-record(access_token_request, {
client_id :: string() | binary(),
client_secret :: string() | binary(),
scope :: string() | binary() | undefined,
timeout :: option(integer())
}).

-type access_token_request() :: #access_token_request{}.

-record(successful_access_token_response, {
access_token :: binary(),
token_type :: binary(),
refresh_token :: option(binary()), % A refresh token SHOULD NOT be included
% .. for client-credentials flow.
% https://www.rfc-editor.org/rfc/rfc6749#section-4.4.3
expires_in :: option(integer())
}).

-type successful_access_token_response() :: #successful_access_token_response{}.

-record(unsuccessful_access_token_response, {
error :: integer(),
error_description :: binary() | string() | undefined
}).

-type unsuccessful_access_token_response() :: #unsuccessful_access_token_response{}.

-record(refresh_token_request, {
client_id :: string() | binary(),
client_secret :: string() | binary(),
scope :: string() | binary() | undefined,
refresh_token :: binary(),
timeout :: option(integer())
}).

-type refresh_token_request() :: #refresh_token_request{}.
75 changes: 75 additions & 0 deletions deps/oauth2_client/include/types.hrl
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
%% This Source Code Form is subject to the terms of the Mozilla Public
%% License, v. 2.0. If a copy of the MPL was not distributed with this
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
%%
%% Copyright (c) 2020-2023 VMware, Inc. or its affiliates. All rights reserved.
%%

%% Matches the option type in rabbit_types without introducing a dependency
%% on that module and RabbitMQ core (rabbit_common)
-type(option(T) :: T | 'none' | 'undefined').

-type oauth_provider_id() :: root | binary().

-record(openid_configuration, {
issuer :: option(uri_string:uri_string()),
token_endpoint :: option(uri_string:uri_string()),
authorization_endpoint :: option(uri_string:uri_string()),
end_session_endpoint :: option(uri_string:uri_string()),
jwks_uri :: option(uri_string:uri_string())
}).
-type openid_configuration() :: #openid_configuration{}.

-record(oauth_provider, {
id :: oauth_provider_id(),
issuer :: option(uri_string:uri_string()),
discovery_endpoint :: option(uri_string:uri_string()),
token_endpoint :: option(uri_string:uri_string()),
authorization_endpoint :: option(uri_string:uri_string()),
end_session_endpoint :: option(uri_string:uri_string()),
jwks_uri :: option(uri_string:uri_string()),
ssl_options :: option(list())
}).

-type query_list() :: [{unicode:chardata(), unicode:chardata() | true}].

-type oauth_provider() :: #oauth_provider{}.

-record(access_token_request, {
client_id :: string() | binary(),
client_secret :: string() | binary(),
scope :: option(string() | binary()),
extra_parameters :: option(query_list()),
timeout :: option(integer())
}).

-type access_token_request() :: #access_token_request{}.

-record(successful_access_token_response, {
access_token :: binary(),
token_type :: binary(),
%% Note: a refresh token SHOULD NOT be included
%% ... for client-credentials flow.
%% See https://www.rfc-editor.org/rfc/rfc6749#section-4.4.3
refresh_token :: option(binary()),
expires_in :: option(integer())
}).

-type successful_access_token_response() :: #successful_access_token_response{}.

-record(unsuccessful_access_token_response, {
error :: integer(),
error_description :: binary() | string() | undefined
}).

-type unsuccessful_access_token_response() :: #unsuccessful_access_token_response{}.

-record(refresh_token_request, {
client_id :: string() | binary(),
client_secret :: string() | binary(),
scope :: string() | binary() | undefined,
refresh_token :: binary(),
timeout :: option(integer())
}).

-type refresh_token_request() :: #refresh_token_request{}.
Loading
Loading