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

BE: Add logout with query parameters to generic OAuth provider #4249

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

oldium
Copy link

@oldium oldium commented Sep 19, 2023

The logout URL is taken from auto-detected endpoint from the provider's well known configuration address, but can be overridden by custom parameter logout-url. Query parameters are optional and are added only when the corresponding key is present. Default redirect URL is a base URL and can be overridden in custom parameters.

Also the final slash from the redirect URL can be removed when redirect-url-strip-slash is set to true/yes/on/1.

Example with all custom parameters:

custom-params:
  type: oauth
  logout-url: https://example.com/sso/logout
  client-id-key: clientId
  redirect-url-key: returnTo
  redirect-url: https://example.com/kafka-ui
  redirect-url-strip-slash: true
  • Breaking change? (if so, please describe the impact and migration path for existing application instances)

What changes did you make? (Give an overview)

I generalized original Cognito logout code and created common ancestor. I added new OAuth logout handling, which is generic enough to handle Cognito logout too, but I kept Cognito for simplicity of
configuration.

Is there anything you'd like reviewers to focus on?

I changed the calculation of redirect URL after logout to have the context path. For normal installation there is no change in behaviour (context path is root - "/").

How Has This Been Tested? (put an "x" (case-sensitive!) next to an item)

  • Manually (please, describe, if necessary)

Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (e.g. ENVIRONMENT VARIABLES)
  • My changes generate no new warnings (e.g. Sonar is happy)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

Check out Contributing and Code of Conduct

A picture of a cute animal (not mandatory but encouraged)
CatsKittyGIF

The logout URL is taken from auto-detected endpoint from the provider's
well known configuration address, but can be overridden by custom
parameter `logout-url`. Query parameters are optional and are added only
when the corresponding key is present. Default redirect URL is a base URL
and can be overridden in custom parameters.

Also the final slash from the redirect URL can be removed when
`redirect-url-strip-slash` is set to true/yes/on/1.

Example with all custom parameters:

```
custom-params:
  type: oauth
  logout-url: https://example.com/sso/logout
  client-id-key: clientId
  redirect-url-key: returnTo
  redirect-url: https://example.com/kafka-ui
  redirect-url-strip-slash: true
```

Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
@oldium oldium requested a review from a team as a code owner September 19, 2023 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant