Enable configurable client_id parameter validation for federated client assertions#48026
Open
slaskawi wants to merge 3 commits intokeycloak:mainfrom
Open
Enable configurable client_id parameter validation for federated client assertions#48026slaskawi wants to merge 3 commits intokeycloak:mainfrom
client_id parameter validation for federated client assertions#48026slaskawi wants to merge 3 commits intokeycloak:mainfrom
Conversation
…ient assertions Signed-off-by: Sebastian Łaskawiec <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-out for client_id form-parameter validation against the JWT sub when processing federated client assertions, and extends tests/utilities to send client_id alongside client_assertion when explicitly provided.
Changes:
- Add
isClientIdParamValidationEnabled()toggle (default enabled) to relaxclient_idvssubvalidation when needed. - Thread a new
clientIdParamValidationEnabledflag throughFederatedJWTClientValidatorinstantiation (disabled for Kubernetes). - Extend Kubernetes client-auth tests and the HTTP request helper to cover requests that include
client_idwith client assertions.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tests/utils-shared/src/main/java/org/keycloak/testsuite/util/oauth/AbstractHttpPostRequest.java |
Sends client_id with client assertions when explicitly set on the request builder. |
tests/base/src/test/java/org/keycloak/tests/client/authentication/external/KubernetesClientAuthTest.java |
Adds coverage for Kubernetes federated assertions when client_id is present/mismatched. |
services/src/main/java/org/keycloak/broker/spiffe/SpiffeIdentityProvider.java |
Updates validator construction for new flag (currently set to validate client_id). |
services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java |
Updates validator construction for new flag (keeps validation enabled). |
services/src/main/java/org/keycloak/broker/kubernetes/KubernetesIdentityProvider.java |
Disables client_id-param validation for Kubernetes assertions. |
services/src/main/java/org/keycloak/authentication/authenticators/client/FederatedJWTClientValidator.java |
Adds constructor flag and overrides isClientIdParamValidationEnabled(). |
services/src/main/java/org/keycloak/authentication/authenticators/client/AbstractJWTClientValidator.java |
Gates client_id mismatch failure behind isClientIdParamValidationEnabled(). |
…tyProvider.java Co-authored-by: Copilot <[email protected]> Signed-off-by: Sebastian Łaskawiec <[email protected]>
Contributor
Author
|
Failures don't seem to be related |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This Pull Request introduces a configurable
client_idvalidation for the Signed JWTs and disables it for Kubernetes Service Accounts.As per RFC 7523, the Client ID for Client Assertions is optional.
Related tickets
Closes #48024
Relates to keycloak/terraform-provider-keycloak#1542
Relates to keycloak/terraform-provider-keycloak#1552