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

Open
wants to merge 54 commits into
base: main
Choose a base branch
from

Conversation

MarcialRosales
Copy link
Contributor

@MarcialRosales MarcialRosales commented Sep 9, 2024

Proposed Changes

Implements features:

It is accompanied by this docs PR rabbitmq/rabbitmq-website#2056

Tasks:

  • Refactor oauth2 plugin so that the core logic uses oauth_provider and resource_server types rather than asking for each setting to the deprecated config module. Split config module into oauth_provider and resource_server modules.
  • Modify oauth2 schema to include discovery_endpoint_path and discovery_endpoint_params
  • Modify management schema to include oauth_authorization_endpoint_params and oauth_token_endpoint_params
  • Modify oauth2_client so that it also accepts params in the access_token_request and discovery_endpoint to the oauth_provider type. (TODO the WSR plugin should be updated to read these extra params and pass them to the access_token_request)
  • Modify management module that generates authSettings for the ui so that it includes the new schema settings
  • Modify javascript (helper.js) so that it initilizes oidc-client-ts with the new settings
  • Verify changes against keycloak + uaa
  • Verify changes against auth0
  • Verify changes against entra
  • Verify changes against okta

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)
  • Build system and/or CI

@MarcialRosales MarcialRosales self-assigned this Sep 9, 2024
@MarcialRosales MarcialRosales force-pushed the make-some-oauth2-settings-optional branch 3 times, most recently from 043520f to f6dd1e0 Compare September 12, 2024 17:22
@mergify mergify bot added the bazel label Sep 12, 2024
@MarcialRosales MarcialRosales force-pushed the make-some-oauth2-settings-optional branch 8 times, most recently from ecac15f to 3a210d7 Compare September 20, 2024 10:11
@MarcialRosales MarcialRosales force-pushed the make-some-oauth2-settings-optional branch 4 times, most recently from a216551 to 99838c3 Compare September 25, 2024 04:53
Improve logging
Fix an issue running selenium tests locally
WIP modify schema to configure queryParameters for
oauth2 endpoints
before implementing oidc endpoints parameters
split rabbit_oauth2_config into
- rabbit_oauth2_resource_server
- rabbit_oauth2_oauth_provider

and their respective test modules

Signing keys is an oauth provider
concern hence it stays with the
oauth_provider module.
Fixing test cases
Pending to add more scenarios whch
combine +2 resources with and without
verify_aud and with and without audience
in token
MarcialRosales and others added 17 commits September 27, 2024 09:35
WIP address a dialyzer error
to be able to set extra parameters
for authorize and token endpoints
Add javascript unit tests given that amount of
javascript code it is difficult to get good coverage
with just end-to-end tests
The tests are not running yet because i need to learn
how to use Babel to convert ES5 modules into NodeJs modules
otherwise it is not possible because all the source modules
use ES5 modules whereas tests run from node.js which requires
CommonJS
And fix selenium script to run
rabbitrmq locally
And location of cert files when running
multioauth test suites locally
@MarcialRosales MarcialRosales force-pushed the make-some-oauth2-settings-optional branch from 378bbb2 to 697b5a2 Compare September 27, 2024 07:35
@MarcialRosales MarcialRosales marked this pull request as ready for review September 27, 2024 11:06
Copy link
Member

@michaelklishin michaelklishin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarcialRosales we cannot use very generic modules names such as rar and oauth2, or keycloak.

We should continue using the rabbit_oauth2_ prefix in this plugin to avoid potential code path conflicts with external libraries, other plugins, and so on.

%% Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
%%

-module(resource_server).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very generic name, we should continue using rabbit_oauth2_ for prefix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I wanted to make it simpler but clearly I went over the line :) . Thanks Michael.

%%

% Rich Authorization Request
-module(rar).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very generic and short name, we should continue using rabbit_oauth2_ for prefix.

%% Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
%%

-module(oauth_provider).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very generic name, we should continue using rabbit_oauth2_ for prefix.

%% Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
%%

-module(keycloak).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very generic name, we should continue using rabbit_oauth2_ for prefix.

- Use rabbit_oauth2 prefix for modules which do not have it
- Ensure most lines stick to 80 column
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants