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

feat: Added audience param to oauth request body (optional) #157

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

Conversation

davidvanwyk
Copy link

Often OAuth IDPs require an audience parameter to exist in the body of the client credentials flow (eg. Auth0). This makes this possible.

@davidvanwyk davidvanwyk requested review from a team as code owners April 11, 2023 16:13
@davidvanwyk
Copy link
Author

Unsure if this requires anything additional to be added, but I have done some testing locally and this seems to work as expected and simply adds &audience={audience_param} to the body.

Copy link
Contributor

@jeqo jeqo left a comment

Choose a reason for hiding this comment

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

@davidvanwyk thanks for this PR.

Do we know of any other provider implementing this field apart from Auth0? Looking for some reference, as seems to not be backed by a standard (some refer to this draft RFC: https://datatracker.ietf.org/doc/html/draft-tschofenig-oauth-audience-00 here https://stackoverflow.com/questions/45876960/how-to-specify-audience-for-an-oauth2-access-token)
Though, Auth0 may be enough providers to adopt this :)

About changes proposed, seems sensible to follow the same approach as scope which is also optional. If we agree that this field is a common one, I'd be happy with this implementation. Left some minor comments.

@@ -1 +1 @@
version=0.7.0-SNAPSHOT
version=0.7.1-SNAPSHOT
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe not related to this change?

@@ -47,6 +47,10 @@ public HttpRequest.Builder build(final HttpSinkConfig config) {
if (config.oauth2ClientScope() != null) {
accessTokenRequestBodyBuilder.add(encodeNameAndValue("scope", config.oauth2ClientScope()));
}
if (config.oauth2ClientAudience() != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add tests covering this new field?

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