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

OAuth 2.0: support IDP-initiated login in the management UI #6015

Merged
merged 17 commits into from Jan 3, 2023

Conversation

MarcialRosales
Copy link
Contributor

@MarcialRosales MarcialRosales commented Oct 4, 2022

Proposed Changes

Support "Identity Provider initiated login" workflow whereby a user comes to RabbitMQ with an access_token rather than coming without any and being redirected to the authorization server to get one. The http endpoint to login directly with an access token is POST /login with the token as the value of the form field access_token (here is the sample form used by our automated testing).

This PR must take into account the following flows :

  • login,
  • logout,
  • session expiry and
  • token expiry

It requires the following oauth2 related configuration settings in the management plugin :

  • oauth_enabled
  • oauth_provider_url : This is the URL of the idp where to redirect the user when the user clicks on the button "Click here to login" which is the landing page when Oauth2 is enabled. Although the idp may not necessarily be an oauth 2.0 provider but in practice, it is ultimately the entity responsible of granting token to users and redirecting them to RabbitMQ.
  • oauth_initiated_logon_type : This new setting configures the type of logon which can be one of these two:
    - service-provider initiated logon (sp_initiated term) which is the default value and corresponds to Oauth 2.0 authorization code flow.
    - identity-provider initiated logon (idp_initiated term)

It has been considered to use this PR to merge another 2 PRs very much related to the same area of code as this PR.

There is a documentation PR linked to this PR: rabbitmq/rabbitmq-website#1504

This PR introduces the following potential breaking change: With this PR the management UI no longer stores credentials (basic or token) on cookies. Instead it uses window.localStorage. Furthermore, and here it is the breaking change: if the window.localStorage is disabled, the management ui will not proceed with the login process. It will not fallback to cookies. This is because bearer tokens may be larger than 4Kb in length and browsers will not accept cookies whose value is greater than 4Kbytes.

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 changed the title OIDC idp initiated login OIDC idp initiated login in the management ui Oct 4, 2022
@mergify mergify bot added the make label Oct 4, 2022
@MarcialRosales MarcialRosales changed the title OIDC idp initiated login in the management ui OAuth 2.0 idp initiated login in the management ui Oct 5, 2022
@MarcialRosales MarcialRosales force-pushed the oidc_idp_initiated_login branch 2 times, most recently from 058e928 to 89f9d39 Compare October 20, 2022 07:29
@MarcialRosales MarcialRosales marked this pull request as ready for review October 20, 2022 08:48
@MarcialRosales MarcialRosales marked this pull request as draft October 26, 2022 10:44
@MarcialRosales MarcialRosales force-pushed the oidc_idp_initiated_login branch 2 times, most recently from 64cdb38 to 47f49fa Compare November 2, 2022 12:16
@MarcialRosales MarcialRosales force-pushed the oidc_idp_initiated_login branch 3 times, most recently from 3e90f1d to 35b7845 Compare November 14, 2022 06:18
@michaelklishin michaelklishin marked this pull request as ready for review November 14, 2022 07:39
@michaelklishin michaelklishin changed the title OAuth 2.0 idp initiated login in the management ui OAuth 2.0 IDP-initiated login in the management UI Nov 14, 2022
@michaelklishin michaelklishin changed the title OAuth 2.0 IDP-initiated login in the management UI OAuth 2.0: support IDP-initiated login in the management UI Nov 14, 2022
@PraveenNanda124

This comment was marked as spam.

@MarcialRosales MarcialRosales marked this pull request as draft December 5, 2022 08:48
@MarcialRosales MarcialRosales force-pushed the oidc_idp_initiated_login branch 2 times, most recently from be85e06 to 28e4212 Compare December 13, 2022 13:10
@MarcialRosales MarcialRosales marked this pull request as ready for review December 13, 2022 14:17
@michaelklishin michaelklishin added this to the 3.11.6 milestone Dec 16, 2022
michaelklishin and others added 17 commits January 2, 2023 07:15
(cherry picked from commit 042725d8364bac3fed40df4dcdb534728dd56576)
Configure preferred username from a token
Make client_secret optional
For OAuth2 idp initiated logon
Use window.localStorage. If it is disabled
Management UI should stop working rather than
falling back to cookies
import and export definitions
When running test remotely, the import
definition file must be transfered from
the test container onto the selenium container
wehre the browser runs
clicking on any area triggered
the download of the definitions
And enable hard session timeout which was
disabled by mistake when moved credentials
from cookies to local storage
This is to force GH Action run selenium tests.
for some reason it is not running it
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.

None yet

3 participants