Configurable may_act claim enforcement#50980
Conversation
There was a problem hiding this comment.
Pull request overview
Adds configurable may_act claim enforcement for token exchange delegation.
Changes:
- Adds mapper-driven claim matching with default
sub/issenforcement. - Removes enforcement metadata from generated
actclaims. - Adds documentation and delegation tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
TokenExchangeDelegationTest.java |
Tests configurable enforcement and fallback behavior. |
TokenExchangeDelegationProvider.java |
Implements generic claim enforcement. |
OIDCLoginProtocolFactory.java |
Adds the default enforcement mapper. |
token-exchange.adoc |
Documents enforced-claim configuration. |
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.forms.MultipleTabsLoginTest#testEmptyBaseUrlKeycloak CI - Forms IT (firefox) org.keycloak.testsuite.forms.MultipleTabsLoginTest#multipleTabsParallelLoginTestKeycloak CI - Forms IT (firefox) org.keycloak.testsuite.forms.BrowserFlowTest#testUserWithOneAdditionalFactorOtpSuccess |
Closes keycloak#50979 Signed-off-by: Martin Bartoš <mabartos@redhat.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
services/src/main/java/org/keycloak/protocol/oidc/tokenexchange/TokenExchangeDelegationProvider.java:177
- A present
nullvalue is treated as absent, somay_act: {"sub": null}passes the mandatory-key check and then skips the default actor binding entirely. Skip only claims whose key is absent, and reject a present null value as a mismatch.
if (mayActValue == null) {
continue;
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.forms.BrowserFlowTest#testUserWithOneAdditionalFactorOtpSuccess |
|
Put on hold for now based on the offline discussion. |
may_actclaim enforcement #50979sub/issvalidation invalidateMayAct()with a generic enforcement loop that compares any configured claim 1:1 betweenmay_actand the actor tokenHardcodedClaimmapper (may_act enforce_claims) on thedelegationclient scope - admins configure enforcement by simply editing the mapper's JSON value (e.g.["sub","iss","preferred_username"]), no server restart or realm config needed["sub","iss"]enforcement when the mapper is removed or the list is emptyenforce_claimsfrom the resultingactclaim to prevent leaking into the delegation chain@rmartinc @keycloak/core-authn Could you please check it? Thanks!