Repository navigation
Replies: 3 comments
Hi @eminwux , @yanxch have you find resolution for this issue, I trying to set jwks as client to keycloak but my service generate sub and iss: {
"iss": "https://gitlab.example.com",
"sub": "project_path:company/project:ref_type:branch:ref:main",
}In gitlab I cant change that values, but keycloak required that sub == iss, I dont know how to resolve it. |
|
This affects using lots of valid/different IDP's. This really feels like a bug, but if its just an enhancement, thats fine. Is there anything blocking a fix or is it just finding a developer with time? |
|
i'm facing the same issue, not exactly with this library, but i'm trying to understand the specs, since rfc7523 is not that clear about the jwt identity, i would like to share the following questions and maybe check if the idea of being issuer and verifier aligns with the specification
Any thoughts? |
Uh oh!
There was an error while loading. Please reload this page.
Hi Keycloak community,
I’ve encountered a problem while trying to authenticate between different Keycloak realms, and I’m hoping to initiate a discussion around it.
Here’s the situation: When I authenticate on realm
tenant, I receive an ID token that looks like this:{ "acr": "1", "at_hash": "Mn1M3ZigbMmZqPuPSf6k8A", "aud": "confidential", "auth_time": 0, "azp": "confidential", "clientAddress": "172.16.1.20", "clientHost": "172.16.1.20", "client_id": "confidential", "email_verified": false, "exp": 1725393297, "iat": 1725392997, "iss": "https://core1.domain/realms/tenant", "jti": "8be09fbf-387d-4916-bc23-69156a9fa5cf", "preferred_username": "service-account-confidential", "sub": "0db5d38c-e8cb-46cc-98f7-919c9ea04753", "typ": "ID" }As you can see, the
sub (subject)andiss (issuer)claims are different.The issue arises when I try to use this ID token on another client in a different realm (configured with Signed JWT).
I get the following error
The issuer should match the subject:I noticed that there has been a similar discussion in closed issue #15688 , where some contributors pointed out that while the spec does not explicitly require the
issandsubclaims to be identical, Keycloak's current implementation enforces this requirement (see RFC 7523, Section 3). This has been problematic for others as well, especially in scenarios where JWT tokens issued by third-party STS or across different realms in Keycloak need to be validated.There was a suggestion made by @pedroigor that this might be more of a feature request than a bug, given that allowing independent
issandsubclaims would require "mechanisms to trust only the values set in thetrustclaim". However, the current implementation goes beyond what the spec requires, which has caused issues in real-world scenarios, like the one I’m facing. I believe revisiting this issue and allowing for more flexibility in JWT client authentication would be beneficial for many users who need to integrate Keycloak with various identity providers or multi-realm environments.These are the code lines that are currently dictating this behavior:
https://github.com/pedroigor/keycloak/blob/2e8b1f191514559095b992440d18b12230ecab28/services/src/main/java/org/keycloak/authentication/authenticators/client/JWTClientAuthenticator.java#L108-L110
https://github.com/pedroigor/keycloak/blob/2e8b1f191514559095b992440d18b12230ecab28/services/src/main/java/org/keycloak/authentication/authenticators/client/JWTClientSecretAuthenticator.java#L101-L103
Looking forward to hearing your thoughts and any potential solutions!
Thanks,
Emiliano
All reactions