Skip to content

feat(oauth): Support multiple values in the “aud” claim for JWT client assertions - #185

Merged
adutra merged 8 commits into
dremio:mainfrom
sji-buttercup:aud-field-multiple-value
Sep 25, 2025
Merged

feat(oauth): Support multiple values in the “aud” claim for JWT client assertions#185
adutra merged 8 commits into
dremio:mainfrom
sji-buttercup:aud-field-multiple-value

Conversation

@sji-buttercup

@sji-buttercup sji-buttercup commented Sep 24, 2025

Copy link
Copy Markdown
Contributor
  • Allow the audience field to be a single audience or a comma-separated list of audiences
  • Add unit tests for audience containing a single value or multiple values
  • Update doc

Manual tests were successful for both:

spark.sql.catalog.iceberg.rest.auth.oauth2.client-assertion.jwt.audience=https://auth1.example.com/token
spark.sql.catalog.iceberg.rest.auth.oauth2.client-assertion.jwt.audience=https://auth1.example.com/token,https://auth2.example.com/token

Now the audience will always be a list, but given that the oauth2-oidc-sdk will always convert one-element to a string when generating the assertion, I believe it should be fine:

		if (audStringList != null) {
			if (audStringList.size() == 1) {
				o.put("aud", audStringList.get(0));
			} else {
				o.put("aud", audStringList);
			}
		}

When I extract the claims set from the assertion with assertion.getJWTClaimsSet().toJSONObject(), I can see that for a single audience, it's still a single string instead of a list.

Fixes #184

@sji-buttercup sji-buttercup changed the title Support multiple values in the “aud” claim for JWT client assertions feat(oauth): Support multiple values in the “aud” claim for JWT client assertions Sep 24, 2025
@sji-buttercup
sji-buttercup force-pushed the aud-field-multiple-value branch from 26e6d66 to 2e54cc4 Compare September 24, 2025 20:47
@sji-buttercup
sji-buttercup marked this pull request as ready for review September 25, 2025 16:29

@adutra adutra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for the quick changes @sji-buttercup !

I left a few minor remarks but this is almost good to go. Thanks!

sji-buttercup and others added 4 commits September 25, 2025 12:50
…nfig/ClientAssertionConfig.java

Co-authored-by: Alexandre Dutra <adutra@apache.org>
Co-authored-by: Alexandre Dutra <adutra@apache.org>

@adutra adutra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for your contribution @sji-buttercup !

@adutra
adutra merged commit 802d471 into dremio:main Sep 25, 2025
6 checks passed
@adutra adutra added this to the 0.1.2 milestone Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Support multiple values in the “aud” claim for JWT client assertions

2 participants