8000 [OID4VCI] Remove deprecated constants used in the old testsuite - Part3 by tdiesler · Pull Request #46948 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,6 @@ public class CredentialScopeModel implements ClientScopeModel {
*/
public static final String VC_KEY_ATTESTATION_REQUIRED_USER_AUTH = "vc.key_attestations_required.user_authentication";

// [TODO] Remove deprecated constants used in the old testsuite
@Deprecated public static final String CONFIGURATION_ID = VC_CONFIGURATION_ID;
@Deprecated public static final String CREDENTIAL_IDENTIFIER = VC_IDENTIFIER;
@Deprecated public static final String CONTEXTS = VC_CONTEXTS;
@Deprecated public static final String EXPIRY_IN_SECONDS = VC_EXPIRY_IN_SECONDS;
@Deprecated public static final Integer EXPIRY_IN_SECONDS_DEFAULT = VC_EXPIRY_IN_SECONDS_DEFAULT;
@Deprecated public static final String FORMAT = VC_FORMAT;
@Deprecated public static final String ISSUER_DID = VC_ISSUER_DID;
@Deprecated public static final String KEY_ATTESTATION_REQUIRED = VC_KEY_ATTESTATION_REQUIRED;
@Deprecated public static final String KEY_ATTESTATION_REQUIRED_KEY_STORAGE = VC_KEY_ATTESTATION_REQUIRED_KEY_STORAGE;
@Deprecated public static final String KEY_ATTESTATION_REQUIRED_USER_AUTH = VC_KEY_ATTESTATION_REQUIRED_USER_AUTH;
@Deprecated public static final String TYPES = VC_SUPPORTED_TYPES;

/**
* the actual object that is represented by this scope
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void testAttestationProofWithMultipleTrustedKeys() {
@Test
public void testCredentialIssuanceWithAttestationProof() {
final String scopeName = jwtTypeCredentialClientScope.getName();
String configIdFromScope = jwtTypeCredentialClientScope.getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String configIdFromScope = jwtTypeCredentialClientScope.getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);
final String credConfigId = configIdFromScope != null ? configIdFromScope : scopeName;
CredentialIssuer credentialIssuer = getCredentialIssuerMetadata();
OID4VCAuthorizationDetail authDetail = new OID4VCAuthorizationDetail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public void testCompleteFlowWithClaimsValidationAuthorizationCode_credentialRequ

// Perform authorization code flow to get authorization code (includes authorization_details)
AccessTokenResponse tokenResponse = authzCodeFlow(ctx);
String credentialConfigurationId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String credentialConfigurationId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);

// Clear events before credential request
events.clear();
Expand Down Expand Up @@ -293,7 +293,7 @@ public void testCompleteFlow_mandatoryClaimsInAuthzDetailsParameter() throws Exc
// Perform authorization code flow to get authorization code
AccessTokenResponse tokenResponse = authzCodeFlow(ctx);
String credentialIdentifier = assertTokenResponse(tokenResponse);
String credentialConfigurationId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String credentialConfigurationId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);

// Clear events before credential request
events.clear();
Expand Down Expand Up @@ -351,7 +351,7 @@ public void testCorrectAccessTokenUsed() throws Exception {

// Request with mandatory lastName will fail as user does not have "lastName"
String credentialIdentifier = assertTokenResponse(tokenResponseWithMandatoryLastName);
String credentialConfigurationId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String credentialConfigurationId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);

Oid4vcCredentialRequest credentialRequest = getCredentialRequest(ctx, credRequestSupplier, tokenResponseWithMandatoryLastName, credentialConfigurationId, credentialIdentifier);
Oid4vcCredentialResponse credentialResponse = credentialRequest.send();
Expand Down Expand Up @@ -410,7 +410,7 @@ public void testCompleteFlow_mandatoryClaimsInAuthzDetailsParameterAndProtocolMa
// Perform authorization code flow to get authorization code
AccessTokenResponse tokenResponse = authzCodeFlow(ctx);
String credentialIdentifier = assertTokenResponse(tokenResponse);
String credentialConfigurationId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String credentialConfigurationId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);

// Clear events before credential request
events.clear();
Expand Down Expand Up @@ -573,7 +573,7 @@ public void testTokenExchangeWithoutAuthorizationDetails() throws Exception {
assertNotNull("authorization_details should be derived from requested OID4VC scope", authDetailsResponse);
assertFalse("authorization_details should not be empty", authDetailsResponse.isEmpty());
assertEquals("credential_configuration_id should match requested scope",
getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID),
getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID),
authDetailsResponse.get(0).getCredentialConfigurationId());
assertNotNull("credential_identifiers should be present", authDetailsResponse.get(0).getCredentialIdentifiers());
assertFalse("credential_identifiers should not be empty", authDetailsResponse.get(0).getCredentialIdentifiers().isEmpty());
Expand Down Expand Up @@ -927,7 +927,7 @@ private void testCompleteFlowWithClaimsValidationAuthorizationCode(BiFunction<St
// Perform authorization code flow to get authorization code
AccessTokenResponse tokenResponse = authzCodeFlow(ctx);
String credentialIdentifier = assertTokenResponse(tokenResponse);
String credentialConfigurationId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String credentialConfigurationId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);

// Request the actual credential using the identifier
Oid4vcCredentialRequest credentialRequest = getCredentialRequest(ctx, credentialRequestSupplier, tokenResponse, credentialConfigurationId, credentialIdentifier);
Expand Down Expand Up @@ -972,7 +972,7 @@ private AccessTokenResponse authzCodeFlow(Oid4vcTestContext ctx, List<ClaimsDesc

OID4VCAuthorizationDetail authDetail = new OID4VCAuthorizationDetail();
authDetail.setType(OPENID_CREDENTIAL);
authDetail.setCredentialConfigurationId(getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID));
authDetail.setCredentialConfigurationId(getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID));
authDetail.setClaims(claimsForAuthorizationDetailsParameter);
authDetail.setLocations(Collections.singletonList(ctx.credentialIssuer.getCredentialIssuer()));

Expand Down Expand Up @@ -1070,7 +1070,7 @@ protected OID4VCAuthorizationDetail createAuthorizationDetail(Oid4vcTestContext
authDetail.setType(OPENID_CREDENTIAL);
authDetail.setCredentialConfigurationId(credentialConfigurationId != null
? credentialConfigurationId
: getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID));
: getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID));
authDetail.setLocations(Collections.singletonList(ctx.credentialIssuer.getCredentialIssuer()));
return authDetail;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void testAuthorizationCodeFlowWithPARAndAuthorizationDetails() throws Exc
Oid4vcTestContext ctx = prepareOid4vcTestContext();

// Step 1: Create PAR request with authorization_details
String credentialConfigurationId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String credentialConfigurationId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);

// Create authorization details with claims
ClaimsDescription claim = new ClaimsDescription();
Expand Down Expand Up @@ -290,7 +290,7 @@ public void testAuthorizationCodeFlowWithPARButNoAuthorizationDetailsInTokenRequ
assertFalse("authorization_details should not be empty", authDetailsResponse.isEmpty());
OID4VCAuthorizationDetail firstAuthorization 9798 Detail = authDetailsResponse.get(0);
assertEquals("credential_configuration_id should match requested scope",
getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID),
getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID),
firstAuthorizationDetail.getCredentialConfigurationId());
assertNotNull("credential_identifiers should be present", firstAuthorizationDetail.getCredentialIdentifiers());
assertFalse("credential_identifiers should not be empty", firstAuthorizationDetail.getCredentialIdentifiers().isEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected static class Oid4vcTestContext {
protected Oid4vcTestContext prepareOid4vcTestContext(String token) throws Exception {
Oid4vcTestContext ctx = new Oid4vcTestContext();

String credentialConfigurationId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String credentialConfigurationId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);

// Clear events before credential offer URI request
events.clear();
Expand Down Expand Up @@ -182,7 +182,7 @@ public void testAuthorizationCodeFlowWithAuthorizationDetails() throws Exception

// Get credential_configuration_id
ClientScopeRepresentation credClientScope = getCredentialClientScope();
String credConfigId = credClientScope.getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String credConfigId = credClientScope.getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);

// Build authorization_details
OID4VCAuthorizationDetail authDetail = new OID4VCAuthorizationDetail();
Expand Down Expand Up @@ -297,7 +297,7 @@ public void testPreAuthorizedCodeWithAuthorizationDetailsCredentialConfiguration

OID4VCAuthorizationDetail authDetail = new OID4VCAuthorizationDetail();
authDetail.setType(OPENID_CREDENTIAL);
authDetail.setCredentialConfigurationId(getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID));
authDetail.setCredentialConfigurationId(getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID));
authDetail.setLocations(Collections.singletonList(ctx.credentialIssuer.getCredentialIssuer()));

List<OID4VCAuthorizationDetail> authDetails = List.of(authDetail);
Expand All @@ -322,7 +322,7 @@ public void testPreAuthorizedCodeWithAuthorizationDetailsCredentialConfiguration
assertEquals(1, authDetailsResponse.size());
OID4VCAuthorizationDetail authDetailResponse = authDetailsResponse.get(0);
assertEquals(OPENID_CREDENTIAL, authDetailResponse.getType());
assertEquals(getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID), authDetailResponse.getCredentialConfigurationId());
assertEquals(getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID), authDetailResponse.getCredentialConfigurationId());
assertNotNull(authDetailResponse.getCredentialIdentifiers());
assertEquals(1, authDetailResponse.getCredentialIdentifiers().size());
String firstIdentifier = authDetailResponse.getCredentialIdentifiers().get(0);
Expand Down Expand Up @@ -357,7 +357,7 @@ public void testPreAuthorizedCodeWithAuthorizationDetailsAndClaims() throws Exce

OID4VCAuthorizationDetail authDetail = new OID4VCAuthorizationDetail();
authDetail.setType(OPENID_CREDENTIAL);
authDetail.setCredentialConfigurationId(getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID));
authDetail.setCredentialConfigurationId(getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID));
authDetail.setClaims(Arrays.asList(claim));
authDetail.setLocations(Collections.singletonList(ctx.credentialIssuer.getCredentialIssuer()));

Expand All @@ -375,7 +375,7 @@ public void testPreAuthorizedCodeWithAuthorizationDetailsAndClaims() throws Exce
assertEquals(1, authDetailsResponse.size());
OID4VCAuthorizationDetail authDetailResponse = authDetailsResponse.get(0);
assertEquals(OPENID_CREDENTIAL, authDetailResponse.getType());
assertEquals(getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID), authDetailResponse.getCredentialConfigurationId());
assertEquals(getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID), authDetailResponse.getCredentialConfigurationId());
assertNotNull(authDetailResponse.getClaims());
assertEquals(1, authDetailResponse.getClaims().size());
ClaimsDescription responseClaim = authDetailResponse.getClaims().get(0);
Expand Down Expand Up @@ -407,7 +407,7 @@ public void testPreAuthorizedCodeWithUnsupportedClaims() throws Exception {

OID4VCAuthorizationDetail authDetail = new OID4VCAuthorizationDetail();
authDetail.setType(OPENID_CREDENTIAL);
authDetail.setCredentialConfigurationId(getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID));
authDetail.setCredentialConfigurationId(getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID));
authDetail.setClaims(Arrays.asList(claim));
authDetail.setLocations(Collections.singletonList(ctx.credentialIssuer.getCredentialIssuer()));

Expand Down Expand Up @@ -438,7 +438,7 @@ public void testPreAuthorizedCodeWithMandatoryClaimMissing() throws Exception {

OID4VCAuthorizationDetail authDetail = new OID4VCAuthorizationDetail();
authDetail.setType(OPENID_CREDENTIAL);
authDetail.setCredentialConfigurationId(getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID));
authDetail.setCredentialConfigurationId(getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID));
authDetail.setClaims(Arrays.asList(claim));
authDetail.setLocations(Collections.singletonList(ctx.credentialIssuer.getCredentialIssuer()));

Expand Down Expand Up @@ -469,7 +469,7 @@ public void testPreAuthorizedCodeWithComplexClaimsPath() throws Exception {

OID4VCAuthorizationDetail authDetail = new OID4VCAuthorizationDetail();
authDetail.setType(OPENID_CREDENTIAL);
authDetail.setCredentialConfigurationId(getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID));
authDetail.setCredentialConfigurationId(getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID));
authDetail.setClaims(Arrays.asList(claim));
authDetail.setLocations(Collections.singletonList(ctx.credentialIssuer.getCredentialIssuer()));

Expand Down Expand Up @@ -533,7 +533,7 @@ public void testPreAuthorizedCodeWithInvalidClaims() throws Exception {

OID4VCAuthorizationDetail authDetail = new OID4VCAuthorizationDetail();
authDetail.setType(OPENID_CREDENTIAL);
authDetail.setCredentialConfigurationId(getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID));
authDetail.setCredentialConfigurationId(getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID));
authDetail.setClaims(Arrays.asList(claim));
authDetail.setLocations(Collections.singletonList(ctx.credentialIssuer.getCredentialIssuer()));

Expand Down Expand Up @@ -846,7 +846,7 @@ public void testMultipleCredentialConfigurationsFromOffer() throws Exception {
@Test
public void testCompleteFlowWithClaimsValidation() throws Exception {
String token = getBearerToken(oauth, client, getCredentialClientScope().getName());
String credConfigId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String credConfigId = getCredentialClientScope().getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);
Oid4vcTestContext ctx = prepareOid4vcTestContext(token);

// Step 1: Request token with authorization details containing specific claims
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class OID4VCIssuerEndpointEncryptionTest extends OID4VCIssuerEndpointTest
@Test
public void testRequestCredentialWithEncryption() {
final String scopeName = jwtTypeCredentialClientScope.getName();
String credConfigId = jwtTypeCredentialClientScope.getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String credConfigId = jwtTypeCredentialClientScope.getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);
CredentialIssuer credentialIssuer = getCredentialIssuerMetadata();
OID4VCAuthorizationDetail authDetail = new OID4VCAuthorizationDetail();
authDetail.setType(OPENID_CREDENTIAL);
Expand Down Expand Up @@ -190,7 +190,7 @@ public void testUnencryptedRequestWhenEncryptionRequired() {
@Test
public void testEncryptedCredentialRequest() {
final String scopeName = jwtTypeCredentialClientScope.getName();
String credConfigId = jwtTypeCredentialClientScope.getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String credConfigId = jwtTypeCredentialClientScope.getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);
CredentialIssuer credentialIssuer = getCredentialIssuerMetadata();
OID4VCAuthorizationDetail authDetail = new OID4VCAuthorizationDetail();
authDetail.setType(OPENID_CREDENTIAL);
Expand Down Expand Up @@ -270,7 +270,7 @@ public void testEncryptedCredentialRequest() {
@Test
public void testEncryptedCredentialRequestWithCompression() {
final String scopeName = jwtTypeCredentialClientScope.getName();
String credConfigId = jwtTypeCredentialClientScope.getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String credConfigId = jwtTypeCredentialClientScope.getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);
CredentialIssuer credentialIssuer = getCredentialIssuerMetadata();
OID4VCAuthorizationDetail authDetail = new OID4VCAuthorizationDetail();
authDetail.setType(OPENID_CREDENTIAL);
Expand Down Expand Up @@ -389,7 +389,7 @@ public void testRequestCredentialWithIncompleteEncryptionParams() throws Throwab
public void testCredentialIssuanceWithEncryption() throws Exception {
// Integration test for the full credential issuance flow with encryption
String scopeName = jwtTypeCredentialClientScope.getName();
String credConfigId = jwtTypeCredentialClientScope.getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String credConfigId = jwtTypeCredentialClientScope.getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);
CredentialIssuer credentialIssuer = getCredentialIssuerMetadata();

testCredentialIssuanceWithAuthZCodeFlow(jwtTypeCredentialClientScope,
Expand Down Expand Up @@ -536,7 +536,7 @@ public void testRequestCredentialWithUnsupportedResponseCompression() {
@Test
public void testRequestCredentialWithInvalidJWK() throws Throwable {
final String scopeName = jwtTypeCredentialClientScope.getName();
String credConfigId = jwtTypeCredentialClientScope.getAttributes().get(CredentialScopeModel.CONFIGURATION_ID);
String credConfigId = jwtTypeCredentialClientScope.getAttributes().get(CredentialScopeModel.VC_CONFIGURATION_ID);
CredentialIssuer credentialIssuer = getCredentialIssuerMetadata();
OID4VCAuthorizationDetail authDetail = new OID4VCAuthorizationDetail();
authDetail.setType(OPENID_CREDENTIAL);
Expand Down
Loading
Loading
0