8000 Set custom audiences per client in the jwt audience executor by rmartinc · Pull Request #46532 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Set custom audiences per client in the jwt audience executor - #46532

Merged
mposolda merged 3 commits into
keycloak:mainfrom
rmartinc:issue-46525
Mar 3, 2026
Merged

mposolda merged 3 commits into
keycloak:mainfrom
rmartinc:issue-46525

Conversation

@rmartinc
Copy link
Copy Markdown
Contributor

Closes #46525

PR that configures the valid audiences for the jwt authorization grant audience executor per client. Initially I thought about adding the option in the client, but, in that case, the executor is not needed at all (the grant execution knows the valid audience just using the client configuration). So I decided to finally add the configuration in the executor per client. Let me know what you think.

@rmartinc
rmartinc requested review from a team as code owners February 23, 2026 13:59
8000 @keycloak-github-bot keycloak-github-bot Bot added the team/ui label Feb 23, 2026
@graziang
Copy link
Copy Markdown
Contributor

@rmartinc The general idea is ok for me. I would keep the option to apply the audience also to all clients. Even if it’s not common, there could be a case where someone wants to just apply the audience to all clients, and configuring all of them in the map is not so easy.

@rmartinc
Copy link
Copy Markdown
Contributor Author

@graziang we are trying to avoid that, because we want the admin to configure the correct audience to the correct client. If you apply all audiences like before (to all clients managed by the policy), is like allowing the jwt authorization grant to all of them (because the ID token in google would be always the same one). Stian asked to restrict this behavior.

@mposolda
Copy link
Copy Markdown
Contributor

@rmartinc Sorry, but I recall what we discussed (and pretty sure what @stianst mentioned) is to rather not use client policies, but instead have some per-client configuration. The client policies are ideal for the cases, when some configuration (or restriction) applies to many various clients, but not when every client can have different setting as:

  • It doesn't scale (for 100 different clients, there would need to be 100 configuration entries in the client policy executor)
  • It doesn't work when there is client administrator of specific client foo . Client administrator will not be able to configure the desired audience is as he may not have permissions for edit client policies (as client policies are usually editable by realm administrator, but not by administrators of individual clients).

@rmartinc
rmartinc force-pushed the issue-46525 branch 2 times, most recently from ee137e3 to 326e32d Compare February 25, 2026 11:52
@rmartinc
Copy link
Copy Markdown
Contributor Author

Finally I used the MapComponent in the client. We can improve this (for example using a select for the IdP over the selected ones), but making the component work as I wanted took me a lot of time, so I don't want to spend more time on this. It's also rebased that was needed.

@rmartinc
Copy link
Copy Markdown
Contributor Author

I have changed the MapComponent to accept options for the key. Let's see.

@mposolda mposolda self-assigned this Feb 26, 2026
@mposolda mposolda 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.

@rmartinc Thanks! I hope this can be merged once tests are OK

@rmartinc
rmartinc commented Mar 2, 2026
Copy link
Copy Markdown
Contributor Author

I'm going to rebase this, I think that it's too old to just re-run it.

rmartinc added 3 commits March 2, 2026 17:44
Closes keycloak#46525

Signed-off-by: rmartinc <rmartinc@redhat.com>
Closes keycloak#46525

Signed-off-by: rmartinc <rmartinc@redhat.com>
Closes keycloak#46525

Signed-off-by: rmartinc <rmartinc@redhat.com>
@mposolda
mposolda merged commit 9a28dc3 into keycloak:main Mar 3, 2026
91 of 93 checks passed
sashyo pushed a commit to tide-foundation/keycloak-IGA that referenced this pull request Jul 20, 2026
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.

Improve the custom audiences executor to setup audiences per client

3 participants

0