Skip to content

Keycloak 26.4 returns a different error response on a token request without Client Assertion (private_key_jwt client authentication) from Keycloak 26.3 does #43269

Closed

Description

@tnorimat

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

oidc

Describe the bug

When a client using private_key_jwt as its client authentication method send a token request without Client Assertion, Keycloak 26.4.0 returns a error response, but this response is different from the one by Keycloak 26.3.

Due to this issue, Keycloak 26.4.0 cannot pass OIDF conformance tests while Keycloak 26.3 can pass.

Version

26.4.0

Regression

  • The issue is a regression

Expected behavior

Keycloak 26.3.5 can pass this OIDF conformance test, therefore, the following token response from the token endpoint of Keycloak 26.3.5 is a right response:

response_status_code: 400 BAD_REQUEST
response_status_text: Bad Request
response_body:
{"error":"invalid_client","error_description":"Parameter client_assertion_type is missing"}

Actual behavior

Keycloak 26.4.0 cannot this OIDF conformance test. The token response from Keycloak 26.4.0 is as follows:

response_status_code: 400 BAD_REQUEST
response_status_text: Bad Request
response_body:
{"error":"unauthorized_client","error_description":"Unexpected error when authenticating client"}

How to Reproduce?

  1. As a client authentication method, private_key_jwt is set to a client.
  2. This client send a token request without Client Assertion (instead, adding client_id parameter) to a token endpoint of Keycloak.

Anything else?

The error response is changed, so it might be considered as breaking change.

Due to this issue Keycloak 26.4.0 cannot pass the following OIDF conformance testing:

  • FAPI 1.0 Advanced Final (w/ private_key_jwt as client authentication method)
  • FAPI 2.0 Security Profile Final (w/ private_key_jwt as client authentication method))
  • FAPI 2.0 Message Signing Final (w/ private_key_jwt as client authentication method)
  • FAPI 2.0 Security Profile Implementer’s Draft version 2 (w/ private_key_jwt as client authentication method)
  • FAPI 2.0 Message Signing Implementer’s Draft version 1 (w/ private_key_jwt as client authentication method)
  • FAPI-CIBA (w/ private_key_jwt as client authentication method)
  • UK Open Banking (w/ private_key_jwt as client authentication method)
  • Australia Consumer Data Right (w/ private_key_jwt as client authentication method)
  • Open Finance Brazil (w/ private_key_jwt as client authentication method)

Activity

  1. added theissue type on Oct 7, 2025
  2. added
    kind/bug
    on Oct 7, 2025
  3. added
    area/oidc
    on Oct 7, 2025
  4. VinodAnandan commented on Oct 7, 2025

    @VinodAnandan
    Contributor

    @tnorimat Thank you, Takashi, for identifying this and creating the issue.

    @tnorimat @thomasdarimont @francis-pouatcha @mposolda @stianst : I’d like to propose that we prioritise maintaining OpenID conformance as a key part of Keycloak’s release assurance. We’re seeing an increasing number of financial institutions adopting Keycloak for their FAPI and Open Banking use cases. Any regressions in conformance can lead to significant challenges, from broken third-party provider (TPP) integrations to potential regulatory implications for these institutions.

    To provide confidence to our adopters that new Keycloak versions won’t break existing conformance, I suggest implementing an automated test workflow that triggers either post-merge to main & supported version branches or on a nightly schedule. This workflow would automatically run the OpenID conformance tests and create issues for any failures detected, ensuring timely visibility and resolution. I hope this would strengthen Keycloak’s reliability for critical use cases and demonstrate our commitment to standard conformance and interoperability.

  5. thomasdarimont commented on Oct 8, 2025

    @thomasdarimont
    Contributor

    In Keycloak 26.3.5 JWTClientAuthenticator explicitly called validator.clientAssertionParametersValidation()
    https://github.com/keycloak/keycloak/blob/26.3.5/services/src/main/java/org/keycloak/authentication/authenticators/client/JWTClientAuthenticator.java#L67

    The method:
    https://github.com/keycloak/keycloak/blob/26.3.5/services/src/main/java/org/keycloak/authentication/authenticators/client/JWTClientValidator.java#L79
    is now missing in Keycloak 26.4.0 (got refactored to a simple presence check without throwing an error). This is the cause of the issue.

    This can be tested by creating a client with Signed JWT Auth and client_credentials grant:

    curl -v -d grant_type=client_credentials -d client_id=client-jwt-demo http://localhost:8081/realms/clientjwt-test/protocol/openid-connect/token
    
  6. thomasdarimont commented on Oct 8, 2025

    @thomasdarimont
    Contributor

    Perhaps we can just add the method again. Do we need the same logic for the Spiffe functionality?

  7. thomasdarimont commented on Oct 8, 2025

    @thomasdarimont
    Contributor

    I added PR #43281 with a fix.

    With this the proper error is returned:

    $ curl -v -d grant_type=client_credentials -d client_id=client-jwt-demo http://localhost:8081/realms/clientjwt-test/protocol/openid-connect/token
    * Host localhost:8081 was resolved.
    * IPv6: ::1
    * IPv4: 127.0.0.1
    *   Trying [::1]:8081...
    * Connected to localhost (::1) port 8081
    > POST /realms/clientjwt-test/protocol/openid-connect/token HTTP/1.1
    > Host: localhost:8081
    > User-Agent: curl/8.7.1
    > Accept: */*
    > Content-Length: 55
    > Content-Type: application/x-www-form-urlencoded
    >
    * upload completely sent off: 55 bytes
    < HTTP/1.1 400 Bad Request
    < Cache-Control: no-store
    < Pragma: no-cache
    < content-length: 91
    < Content-Type: application/json
    < Referrer-Policy: no-referrer
    < Strict-Transport-Security: max-age=31536000; includeSubDomains
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: SAMEORIGIN
    <
    * Connection #0 to host localhost left intact
    {"error":"invalid_client","error_description":"Parameter client_assertion_type is missing"}%
    
  8. thomasdarimont commented on Oct 8, 2025

    @thomasdarimont
    Contributor

    I was wondering why this bug wasn't detected by this test org.keycloak.testsuite.oauth.ClientAuthSignedJWTTest#testMissingClientAssertionType

    See:
    https://github.com/keycloak/keycloak/blob/main/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/oauth/ClientAuthSignedJWTTest.java#L422

    It turns out those tests don't send a client_id in the request and therefore the actual error is never triggered...

  9. 2 remaining items

  10. added
    priority/blocker
    and removed
    priority/important
    on Oct 8, 2025
  11. added this to the 26.5.0 milestone on Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/oidckind/bugpriority/blockerrelease/26.4.1release/26.5.0team/core-clients

Type

Fields

No fields configured for bug.

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions