diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java index 27a10a52e..cb8c07e3c 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java @@ -95,4 +95,5 @@ private StringPool() { public static final String COMA_SEPARATOR = ", "; public static final String BLANK_SEPARATOR = " "; public static final String COLON_SEPARATOR = ":"; + public static final String UNDERSCORE = "_"; } diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/PresentationService.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/PresentationService.java index 0db76aec3..d3b09c055 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/PresentationService.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/PresentationService.java @@ -72,6 +72,7 @@ import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.BLANK_SEPARATOR; import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.COLON_SEPARATOR; import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.COMA_SEPARATOR; +import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.UNDERSCORE; import static org.eclipse.tractusx.managedidentitywallets.utils.TokenParsingUtils.getClaimsSet; import static org.eclipse.tractusx.managedidentitywallets.utils.TokenParsingUtils.getScope; @@ -301,11 +302,12 @@ public Map createVpWithRequiredScopes(SignedJWT innerJWT, boolea String[] scopeParts = scope.split(COLON_SEPARATOR); String vcType = scopeParts[1]; checkReadPermission(scopeParts[2]); + String vcTypeNoVersion = removeVersion(vcType); List credentials = - holdersCredentialRepository.getByHolderDidAndType(jwtClaimsSet.getIssuer(), vcType); + holdersCredentialRepository.getByHolderDidAndType(jwtClaimsSet.getIssuer(), vcTypeNoVersion); if ((null == credentials) || credentials.isEmpty()) { - missingVCTypes.add(vcType); + missingVCTypes.add(vcTypeNoVersion); } else { holdersCredentials.addAll(credentials); } @@ -333,4 +335,9 @@ private void checkMissingVcs(List missingVCTypes) { String.join(COMA_SEPARATOR, missingVCTypes))); } } + + private String removeVersion(String vcType) { + String[] parts = vcType.split(UNDERSCORE); + return (parts.length > 1) ? parts[0] : vcType; + } }