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

Added ability to use Issuer to receive Token Endpoint for the OAuth2ClientBuilder #1656

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

Lyphion
Copy link
Contributor

@Lyphion Lyphion commented Aug 23, 2024

Proposed Changes

Added an optional overload to the constructor of the OAuth2ClientBuilder to provide an Issuer instead of the Token Endpoint. When the OAuth2Client is build (using Build() or BuildAsync()) and no Token Endpoint is provided, the Token Endpoint will be fetched from the discovery page of the Issuer (must support OpenID Connect).

In addition I added some documentation for most of the methods in OAuth2Client, IOAuth2Client and OAuth2ClientBuilder.

Initial request and discussion was started here: #1653

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)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you're unsure about any of them, don't hesitate to ask on the
mailing list. We're here to help! This is simply a reminder of what we are
going to look for before merging your code.

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

Further Comments

The retrieval of the Token Endpoint is Async, when building the client with the synchronous method (Build()) the request is blocked until the Endpoint is received. Because of backwards compatibility I can't refactor it. I added an Async BuildAsync() method which does this more correctly. When providing the Token Endpoint directly nothing will be done while building.

Feel free to suggest some better methods.

My IDE suggested changes in PublicAPI.Shipped.txt and PublicAPI.Unshipped.txt. Please check if the changes in there are correct, because these files are new to me.

@lukebakken lukebakken self-requested a review August 26, 2024 15:03
@lukebakken lukebakken self-assigned this Aug 26, 2024
@lukebakken lukebakken added this to the 7.0.0 milestone Aug 26, 2024
@lukebakken
Copy link
Contributor

Thank you, I will find time to review this soon.

Added retrieving of Token Endpoint if only the Issuer is provided to the builder

Added some documentation to OAuth2Client and IOAuth2Client

Remove synchronous `Build` method.
@lukebakken
Copy link
Contributor

Thank you very, very much!

@lukebakken lukebakken merged commit daa5aaa into rabbitmq:main Sep 3, 2024
10 of 11 checks passed
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.

2 participants