refactor(oid4vc): remove notification ID handling and related endpoint (#44844)

Closes #44802


Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
This commit is contained in:
Awambeng
2025-12-12 14:38:01 +01:00
committed by GitHub
parent 0419d6711f
commit af8e905774
4 changed files with 0 additions and 73 deletions

View File

@@ -274,15 +274,6 @@ public class OID4VCIssuerEndpoint {
LOGGER.debugf("Client '%s' is enabled for OID4VCI features.", client.getClientId());
}
/**
* Generates a unique notification ID for use in CredentialResponse.
*
* @return a unique string identifier
*/
private String generateNotificationId() {
return SecretGenerator.getInstance().randomString();
}
/**
* the OpenId4VCI nonce-endpoint
*
@@ -782,7 +773,6 @@ public class OID4VCIssuerEndpoint {
// Generate credential response
CredentialResponse responseVO = new CredentialResponse();
responseVO.setNotificationId(generateNotificationId());
if (allProofs.isEmpty()) {
// Single issuance without proof

View File

@@ -49,9 +49,6 @@ public class CredentialIssuer {
@JsonProperty("authorization_servers")
private List<String> authorizationServers;
@JsonProperty("notification_endpoint")
private String notificationEndpoint;
@JsonProperty("batch_credential_issuance")
private BatchCredentialIssuance batchCredentialIssuance;
@@ -112,15 +109,6 @@ public class CredentialIssuer {
return this;
}
public String getNotificationEndpoint() {
return notificationEndpoint;
}
public CredentialIssuer setNotificationEndpoint(String notificationEndpoint) {
this.notificationEndpoint = notificationEndpoint;
return this;
}
public BatchCredentialIssuance getBatchCredentialIssuance() {
return batchCredentialIssuance;
}

View File

@@ -38,9 +38,6 @@ public class CredentialResponse {
@JsonProperty("transaction_id")
private String transactionId;
@JsonProperty("notification_id")
private String notificationId;
public List<Credential> getCredentials() {
return credentials;
}
@@ -67,16 +64,6 @@ public class CredentialResponse {
return this;
}
public String getNotificationId() {
return notificationId;
}
public CredentialResponse setNotificationId(String notificationId) {
this.notificationId = notificationId;
return this;
}
/**
* Inner class to represent a single credential object within the credentials array.
*/

View File

@@ -81,7 +81,6 @@ import static org.keycloak.OID4VCConstants.CREDENTIAL_SUBJECT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -595,40 +594,6 @@ public class OID4VCJWTIssuerEndpointTest extends OID4VCIssuerEndpointTest {
testCredentialIssuanceWithAuthZCodeFlow(sdJwtTypeCredentialClientScope, getAccessToken, sendCredentialRequest);
}
@Test
public void testRequestCredentialWithNotificationId() {
final String scopeName = jwtTypeCredentialClientScope.getName();
String credConfigId = jwtTypeCredentialClientScope.getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String token = getBearerToken(oauth, client, scopeName);
testingClient.server(TEST_REALM_NAME).run((session) -> {
BearerTokenAuthenticator authenticator = new BearerTokenAuthenticator(session);
authenticator.setTokenString(token);
OID4VCIssuerEndpoint issuerEndpoint = prepareIssuerEndpoint(session, authenticator);
CredentialRequest credentialRequest = new CredentialRequest()
.setCredentialConfigurationId(credConfigId);
String requestPayload = JsonSerialization.writeValueAsString(credentialRequest);
// First credential request
Response response1 = issuerEndpoint.requestCredential(requestPayload);
assertEquals("The credential request should be successful.", HttpStatus.SC_OK, response1.getStatus());
CredentialResponse credentialResponse1 = JsonSerialization.mapper.convertValue(
response1.getEntity(), CredentialResponse.class);
assertNotNull("Credential response should not be null", credentialResponse1);
assertNotNull("Credential should be present", credentialResponse1.getCredentials());
assertNotNull("Notification ID should be present", credentialResponse1.getNotificationId());
assertFalse("Notification ID should not be empty", credentialResponse1.getNotificationId().isEmpty());
// Second credential request
Response response2 = issuerEndpoint.requestCredential(requestPayload);
assertEquals("The second credential request should be successful.", HttpStatus.SC_OK, response2.getStatus());
CredentialResponse credentialResponse2 = JsonSerialization.mapper.convertValue(
response2.getEntity(), CredentialResponse.class);
assertNotEquals("Notification IDs should be unique",
credentialResponse1.getNotificationId(), credentialResponse2.getNotificationId());
});
}
/**
* This is testing the multiple credential issuance flow in a single call with proofs
*/
@@ -696,10 +661,7 @@ public class OID4VCJWTIssuerEndpointTest extends OID4VCIssuerEndpointTest {
"john@email.cz", vc.getCredentialSubject().getClaims().get("email"));
assertFalse("Only supported mappers should be evaluated",
vc.getCredentialSubject().getClaims().containsKey("AnotherCredentialType"));
}
assertNotNull("Notification ID should be present", credentialResponse.getNotificationId());
} catch (Exception e) {
throw new RuntimeException("Test failed due to: " + e.getMessage(), e);
}