Skip to content

Enable configurable client_id parameter validation for federated client assertions#48026

Open
slaskawi wants to merge 3 commits intokeycloak:mainfrom
slaskawi:48024/optional_client_id_for_signed_jwts
Open

Enable configurable client_id parameter validation for federated client assertions#48026
slaskawi wants to merge 3 commits intokeycloak:mainfrom
slaskawi:48024/optional_client_id_for_signed_jwts

Conversation

@slaskawi
Copy link
Copy Markdown
Contributor

Summary

This Pull Request introduces a configurable client_id validation 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

…ient assertions

Signed-off-by: Sebastian Łaskawiec <[email protected]>
Copilot AI review requested due to automatic review settings April 14, 2026 07:33
@slaskawi slaskawi requested a review from a team as a code owner April 14, 2026 07:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 relax client_id vs sub validation when needed.
  • Thread a new clientIdParamValidationEnabled flag through FederatedJWTClientValidator instantiation (disabled for Kubernetes).
  • Extend Kubernetes client-auth tests and the HTTP request helper to cover requests that include client_id with 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().

Comment thread services/src/main/java/org/keycloak/broker/spiffe/SpiffeIdentityProvider.java Outdated
…tyProvider.java

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Sebastian Łaskawiec <[email protected]>
@slaskawi
Copy link
Copy Markdown
Contributor Author

Failures don't seem to be related

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.

Relax Client ID validation for the Signed JWT - Federated (Kubernetes Service Accounts)

2 participants