Add details about client assertion to event

Fixes #41405

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>
This commit is contained in:
Thomas Darimont
2025-07-30 20:50:27 +02:00
committed by GitHub
parent 2b019d711e
commit 97dfbd2c84
3 changed files with 14 additions and 0 deletions

View File

@@ -35,6 +35,7 @@ import org.keycloak.crypto.SignatureSignerContext;
import org.keycloak.events.Details;
import org.keycloak.events.Errors;
import org.keycloak.jose.jws.JWSBuilder;
import org.keycloak.jose.jws.JWSInput;
import org.keycloak.protocol.oidc.OIDCAdvancedConfigWrapper;
import org.keycloak.protocol.oidc.OIDCConfigAttributes;
import org.keycloak.representations.AccessToken;
@@ -71,6 +72,7 @@ public class ClientAuthSignedJWTTest extends AbstractClientAuthSignedJWTTest {
@Test
public void testServiceAccountAndLogoutSuccess() throws Exception {
String client1Jwt = getClient1SignedJWT();
JsonWebToken client1JsonWebToken = new JWSInput(client1Jwt).readJsonContent(JsonWebToken.class);
AccessTokenResponse response = doClientCredentialsGrantRequest(client1Jwt);
assertEquals(200, response.getStatusCode());
@@ -85,6 +87,9 @@ public class ClientAuthSignedJWTTest extends AbstractClientAuthSignedJWTTest {
.detail(Details.REFRESH_TOKEN_ID, refreshToken.getId())
.detail(Details.USERNAME, ServiceAccountConstants.SERVICE_ACCOUNT_USER_PREFIX + "client1")
.detail(Details.CLIENT_AUTH_METHOD, JWTClientAuthenticator.PROVIDER_ID)
.detail(Details.CLIENT_ASSERTION_ID, client1JsonWebToken.getId())
.detail(Details.CLIENT_ASSERTION_ISSUER, "client1")
.detail(Details.CLIENT_ASSERTION_SUB, "client1")
.assertEvent();
assertEquals(accessToken.getSessionState(), refreshToken.getSessionState());