From e605d608d9997796031f9831844bf8faec7616b9 Mon Sep 17 00:00:00 2001 From: Ronak Thacker Date: Wed, 19 Jul 2023 12:27:51 +0530 Subject: [PATCH 01/14] feat: test case added for VC expiry check while VP validate as JWT --- .../vp/PresentationTest.java | 90 +++++++++++++++++-- 1 file changed, 83 insertions(+), 7 deletions(-) diff --git a/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java b/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java index 4d5df7ca9..fc53ba6d6 100644 --- a/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java +++ b/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java @@ -42,6 +42,10 @@ import org.eclipse.tractusx.ssi.lib.exception.DidDocumentResolverNotRegisteredException; import org.eclipse.tractusx.ssi.lib.exception.JwtException; import org.eclipse.tractusx.ssi.lib.jwt.SignedJwtVerifier; +import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredential; +import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialBuilder; +import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialSubject; +import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialType; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -53,11 +57,10 @@ import org.springframework.http.*; import org.springframework.test.context.ContextConfiguration; +import java.net.URI; import java.text.ParseException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.time.Instant; +import java.util.*; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = {ManagedIdentityWalletsApplication.class}) @ContextConfiguration(initializers = {TestContextInitializer.class}) @@ -143,7 +146,7 @@ void validateVPAsJwtWithInvalidSignatureAndInValidAudienceAndExpiryDateValidatio } @Test - void validateVPAsJwtWithValidAudienceAndDateValidation() throws JsonProcessingException{ + void validateVPAsJwtWithValidAudienceAndDateValidation() throws JsonProcessingException { //create VP String bpn = UUID.randomUUID().toString(); String audience = "companyA"; @@ -159,6 +162,24 @@ void validateVPAsJwtWithValidAudienceAndDateValidation() throws JsonProcessingEx Assertions.assertTrue(Boolean.parseBoolean(map.get(StringPool.VALIDATE_JWT_EXPIRY_DATE).toString())); } + @Test + void validateVPAsJwtWithInValidVCDateValidation() throws JsonProcessingException { + //create VP + String bpn = UUID.randomUUID().toString(); + String audience = "companyA"; + + ResponseEntity vpResponse = getIssueVPRequestWithShortExpiry(bpn, audience); + Map body = vpResponse.getBody(); + + ResponseEntity> mapResponseEntity = presentationController.validatePresentation(body, audience, true, true); + + Map map = mapResponseEntity.getBody(); + Assertions.assertFalse(Boolean.parseBoolean(map.get(StringPool.VALID).toString())); + Assertions.assertTrue(Boolean.parseBoolean(map.get(StringPool.VALIDATE_AUDIENCE).toString())); + Assertions.assertFalse(Boolean.parseBoolean(map.get(StringPool.VALIDATE_EXPIRY_DATE).toString())); + Assertions.assertTrue(Boolean.parseBoolean(map.get(StringPool.VALIDATE_JWT_EXPIRY_DATE).toString())); + } + @Test void createPresentationAsJWT201() throws JsonProcessingException, ParseException { String bpn = UUID.randomUUID().toString(); @@ -176,8 +197,6 @@ void createPresentationAsJWT201() throws JsonProcessingException, ParseException } private ResponseEntity createBpnVCAsJwt(String bpn, String audience) throws JsonProcessingException { - String didWeb = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString(); - Map request = getIssueVPRequest(bpn); HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(bpn); @@ -269,4 +288,61 @@ private Map getIssueVPRequest(String bpn) throws JsonProcessingE request.put(StringPool.VERIFIABLE_CREDENTIALS, List.of(map)); return request; } + + @NotNull + private ResponseEntity getIssueVPRequestWithShortExpiry(String bpn, String audience) throws JsonProcessingException { + ResponseEntity response = TestUtils.createWallet(bpn, bpn, restTemplate); + Assertions.assertEquals(response.getStatusCode().value(), HttpStatus.CREATED.value()); + Wallet wallet = TestUtils.getWalletFromString(response.getBody()); + + //create VC + HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()); + String type = VerifiableCredentialType.MEMBERSHIP_CREDENTIAL; + Instant vcExpiry = Instant.now().minusSeconds(60); + ResponseEntity vcResponse = issueVC(wallet.getBpn(), wallet.getDid(), miwSettings.authorityWalletDid(), type, headers, miwSettings.vcContexts(), vcExpiry); + + + Map map = objectMapper.readValue(vcResponse.getBody(), Map.class); + + //create request + Map request = new HashMap<>(); + request.put(StringPool.HOLDER_IDENTIFIER, wallet.getDid()); + request.put(StringPool.VERIFIABLE_CREDENTIALS, List.of(map)); + + headers = AuthenticationUtils.getValidUserHttpHeaders(bpn); + headers.put(HttpHeaders.CONTENT_TYPE, List.of(MediaType.APPLICATION_JSON_VALUE)); + + HttpEntity entity = new HttpEntity<>(objectMapper.writeValueAsString(request), headers); + + ResponseEntity vpResponse = restTemplate.exchange(RestURI.API_PRESENTATIONS + "?asJwt={asJwt}&audience={audience}", HttpMethod.POST, entity, Map.class, true, audience); + return vpResponse; + } + + private ResponseEntity issueVC(String bpn, String holderDid, String issuerDid, String type, HttpHeaders headers, List contexts, Instant expiry) throws JsonProcessingException { + // Create VC without proof + //VC Bulider + VerifiableCredentialBuilder verifiableCredentialBuilder = + new VerifiableCredentialBuilder(); + + //VC Subject + VerifiableCredentialSubject verifiableCredentialSubject = new VerifiableCredentialSubject(Map.of(StringPool.TYPE, MIWVerifiableCredentialType.BPN_CREDENTIAL, + StringPool.ID, holderDid, + StringPool.BPN, bpn)); + + //Using Builder + VerifiableCredential credentialWithoutProof = + verifiableCredentialBuilder + .id(URI.create(issuerDid + "#" + UUID.randomUUID())) + .context(contexts) + .type(List.of(VerifiableCredentialType.VERIFIABLE_CREDENTIAL, type)) + .issuer(URI.create(issuerDid)) //issuer must be base wallet + .expirationDate(expiry) + .issuanceDate(Instant.now()) + .credentialSubject(verifiableCredentialSubject) + .build(); + + Map map = objectMapper.readValue(credentialWithoutProof.toJson(), Map.class); + HttpEntity entity = new HttpEntity<>(map, headers); + return restTemplate.exchange(RestURI.ISSUERS_CREDENTIALS + "?holderDid={did}", HttpMethod.POST, entity, String.class, holderDid); + } } \ No newline at end of file From 550cabb1b945861e2e0a88f9e1688c6e9293ffe6 Mon Sep 17 00:00:00 2001 From: Ronak Thacker Date: Wed, 19 Jul 2023 14:58:35 +0530 Subject: [PATCH 02/14] feat: swagger doc request example updated --- .../HoldersCredentialController.java | 34 ++--- .../IssuersCredentialController.java | 94 +++++++------- .../controller/PresentationController.java | 119 ++++++++---------- .../controller/WalletController.java | 34 ++--- 4 files changed, 143 insertions(+), 138 deletions(-) diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java index ace19aacd..8343c98ee 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java @@ -91,20 +91,26 @@ public ResponseEntity> getCredentials(@RequestPar @io.swagger.v3.oas.annotations.parameters.RequestBody(content = { @Content(examples = @ExampleObject(""" { - "id": "http://example.edu/credentials/333", - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://www.w3.org/2018/credentials/examples/v1" - ], - "type": [ - "VerifiableCredential", "University-Degree-Credential" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "issuanceDate": "2019-06-16T18:56:59Z", - "expirationDate": "2019-06-17T18:56:59Z", - "credentialSubject": [{ - "college": "Test-University" - }] + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "type": [ + "VerifiableCredential", + "BpnCredential" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z", + "issuanceDate": "2023-07-19T09:11:34Z", + "credentialSubject": [ + { + "bpn": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "BpnCredential" + } + ] } """)) }) diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java index 29c6f3012..db6b6d86d 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java @@ -175,38 +175,34 @@ public ResponseEntity issueFrameworkCredential(@Valid @Req @io.swagger.v3.oas.annotations.parameters.RequestBody(content = { @Content(examples = @ExampleObject(""" { - "credentialSubject": - [ - { - "bpn": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "type": "BpnCredential" - } - ], - "issuanceDate": "2023-07-14T11:05:44Z", - "id": "did:web:localhost:BPNL000000000000#f177b3e9-bbf9-45db-bc3d-80152abcb419", - "proof": - { - "created": "2023-07-14T11:05:48Z", - "jws": "eyJhbGciOiJFZERTQSJ9..C4oYBfTh11OKG0yV0qoCQxF6zZWZLb9dPXJCP6oCtpyB_sSc8o6cPhByKwf-0o7ElsUr0mh6AGPwGxdoOijfDw", - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#" - }, - "type": - [ - "VerifiableCredential", - "BpnCredential" - ], - "@context": - [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "expirationDate": "2023-09-30T18:30:00Z" - } + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "type": [ + "VerifiableCredential", + "BpnCredential" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z", + "issuanceDate": "2023-07-19T09:11:34Z", + "credentialSubject": [ + { + "bpn": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "BpnCredential" + } + ], + "proof": { + "created": "2023-07-19T09:11:39Z", + "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#" + } + } """)) }) public ResponseEntity> credentialsValidation(@RequestBody Map data, @@ -229,20 +225,26 @@ public ResponseEntity> credentialsValidation(@RequestBody Ma @io.swagger.v3.oas.annotations.parameters.RequestBody(content = { @Content(examples = @ExampleObject(""" { - "id": "http://example.edu/credentials/333", - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://www.w3.org/2018/credentials/examples/v1" - ], - "type": [ - "VerifiableCredential", "University-Degree-Credential" - ], - "issuer": "did:example:76e12ec712ebc6f1c221ebfeb1f", - "issuanceDate": "2019-06-16T18:56:59Z", - "expirationDate": "2019-06-17T18:56:59Z", - "credentialSubject": [{ - "college": "Test-University" - }] + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "type": [ + "VerifiableCredential", + "BpnCredential" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z", + "issuanceDate": "2023-07-19T09:11:34Z", + "credentialSubject": [ + { + "bpn": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "BpnCredential" + } + ] } """)) }) diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java index 81ec135dc..415a5d0be 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java @@ -67,42 +67,37 @@ public class PresentationController extends BaseController { @io.swagger.v3.oas.annotations.parameters.RequestBody(content = { @Content(examples = @ExampleObject(""" { - "holderIdentifier": "did:web:localhost:BPNL000000000000", "verifiableCredentials": [ { - "credentialSubject": - [ - { - "bpn": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "type": "BpnCredential" - } - ], - "issuanceDate": "2023-07-14T11:05:44Z", - "id": "did:web:localhost:BPNL000000000000#f177b3e9-bbf9-45db-bc3d-80152abcb419", - "proof": - { - "created": "2023-07-14T11:05:48Z", - "jws": "eyJhbGciOiJFZERTQSJ9..C4oYBfTh11OKG0yV0qoCQxF6zZWZLb9dPXJCP6oCtpyB_sSc8o6cPhByKwf-0o7ElsUr0mh6AGPwGxdoOijfDw", - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#" - }, - "type": - [ - "VerifiableCredential", - "BpnCredential" - ], - "@context": - [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "expirationDate": "2023-09-30T18:30:00Z" - } + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "type": [ + "VerifiableCredential", + "BpnCredential" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z", + "issuanceDate": "2023-07-19T09:11:34Z", + "credentialSubject": [ + { + "bpn": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "BpnCredential" + } + ], + "proof": { + "created": "2023-07-19T09:11:39Z", + "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#" + } + } ] } """)) @@ -132,7 +127,7 @@ public ResponseEntity> createPresentation(@RequestBody Map> createPresentation(@RequestBody Map createWallet(@Valid @RequestBody CreateWalletReque @io.swagger.v3.oas.annotations.parameters.RequestBody(content = { @Content(examples = @ExampleObject(""" { - "id": "http://example.edu/credentials/3732", + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://www.w3.org/2018/credentials/examples/v1" + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" ], "type": [ - "University-Degree-Credential", "VerifiableCredential" + "VerifiableCredential", + "BpnCredential" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z", + "issuanceDate": "2023-07-19T09:11:34Z", + "credentialSubject": [ + { + "bpn": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "BpnCredential" + } ], - "issuer": "did:example:76e12ec712ebc6f1c221ebfeb1f", - "issuanceDate": "2019-06-16T18:56:59Z", - "expirationDate": "2019-06-17T18:56:59Z", - "credentialSubject": [{ - "college": "Test-University" - }], "proof": { - "type": "Ed25519Signature2018", - "created": "2021-11-17T22:20:27Z", - "proofPurpose": "assertionMethod", - "verificationMethod": "did:example:76e12ec712ebc6f1c221ebfeb1f#key-1", - "jws": "eyJiNjQiOmZhbHNlLCJjcml0IjpbImI2NCJdLCJhbGciOiJFZERTQSJ9..JNerzfrK46Mq4XxYZEnY9xOK80xsEaWCLAHuZsFie1-NTJD17wWWENn_DAlA_OwxGF5dhxUJ05P6Dm8lcmF5Cg" + "created": "2023-07-19T09:11:39Z", + "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#" } } """)) From 80ced85250de8ac5b956e337ff8c5d18b59e1900 Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Wed, 19 Jul 2023 16:59:24 +0530 Subject: [PATCH 03/14] fix: validation erorr message not shown in reponse, docs: CGD-391: sample repomse added in wallet APIs --- .../config/ApplicationConfig.java | 31 +- .../config/ExceptionHandling.java | 65 ++- .../controller/WalletController.java | 447 +++++++++++++++++- 3 files changed, 515 insertions(+), 28 deletions(-) diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ApplicationConfig.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ApplicationConfig.java index 3cc57dcda..a8cb28daf 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ApplicationConfig.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ApplicationConfig.java @@ -26,24 +26,36 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.smartsensesolutions.java.commons.specification.SpecificationUtil; -import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.text.StringEscapeUtils; import org.springdoc.core.properties.SwaggerUiConfigProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.ReloadableResourceBundleMessageSource; +import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import java.nio.charset.StandardCharsets; + /** * The type Application config. */ @Configuration @Slf4j -@RequiredArgsConstructor public class ApplicationConfig implements WebMvcConfigurer { private final SwaggerUiConfigProperties properties; + private final String resourceBundlePath; + + @Autowired + public ApplicationConfig(@Value("${resource.bundle.path:classpath:i18n/language}") String resourceBundlePath, SwaggerUiConfigProperties properties) { + this.resourceBundlePath = resourceBundlePath; + this.properties = properties; + } /** * Object mapper object mapper. @@ -71,4 +83,19 @@ public void addViewControllers(ViewControllerRegistry registry) { log.info("Set landing page to path {}", StringEscapeUtils.escapeJava(redirectUri)); registry.addRedirectViewController("/", redirectUri); } + + @Bean + public MessageSource messageSource() { + ReloadableResourceBundleMessageSource bean = new ReloadableResourceBundleMessageSource(); + bean.setBasename(resourceBundlePath); + bean.setDefaultEncoding(StandardCharsets.UTF_8.name()); + return bean; + } + + @Bean + public LocalValidatorFactoryBean validator() { + LocalValidatorFactoryBean beanValidatorFactory = new LocalValidatorFactoryBean(); + beanValidatorFactory.setValidationMessageSource(messageSource()); + return beanValidatorFactory; + } } diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ExceptionHandling.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ExceptionHandling.java index b94233a3a..813a00fb4 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ExceptionHandling.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/ExceptionHandling.java @@ -21,13 +21,20 @@ package org.eclipse.tractusx.managedidentitywallets.config; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.ConstraintViolationException; import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.managedidentitywallets.exception.*; import org.springframework.http.HttpStatus; import org.springframework.http.ProblemDetail; +import org.springframework.validation.FieldError; +import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; -import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** @@ -35,7 +42,7 @@ */ @RestControllerAdvice @Slf4j -public class ExceptionHandling extends ResponseEntityExceptionHandler { +public class ExceptionHandling { /** * The constant TIMESTAMP. @@ -98,6 +105,37 @@ ProblemDetail handleBadDataException(BadDataException e) { return problemDetail; } + + /** + * Handle validation problem detail. + * + * @param e the e + * @return the problem detail + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + ProblemDetail handleValidation(MethodArgumentNotValidException e) { + ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(HttpStatus.BAD_REQUEST, e.getMessage()); + problemDetail.setTitle("Invalid data provided"); + problemDetail.setProperty(TIMESTAMP, System.currentTimeMillis()); + problemDetail.setProperty("errors", handleValidationError(e.getFieldErrors())); + return problemDetail; + } + + /** + * Handle validation problem detail. + * + * @param exception the exception + * @return the problem detail + */ + @ExceptionHandler(ConstraintViolationException.class) + ProblemDetail handleValidation(ConstraintViolationException exception) { + ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(HttpStatus.BAD_REQUEST, exception.getMessage()); + problemDetail.setTitle("Invalid data provided"); + problemDetail.setProperty(TIMESTAMP, System.currentTimeMillis()); + problemDetail.setProperty("errors", exception.getConstraintViolations().stream().map(ConstraintViolation::getMessage).toList()); + return problemDetail; + } + /** * Handle duplicate credential problem problem detail. * @@ -112,6 +150,12 @@ ProblemDetail handleDuplicateCredentialProblem(RuntimeException e) { return problemDetail; } + /** + * Handle not found credential problem detail. + * + * @param e the e + * @return the problem detail + */ @ExceptionHandler(CredentialNotFoundProblem.class) ProblemDetail handleNotFoundCredentialProblem(CredentialNotFoundProblem e) { ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(HttpStatus.NOT_FOUND, e.getMessage()); @@ -120,6 +164,12 @@ ProblemDetail handleNotFoundCredentialProblem(CredentialNotFoundProblem e) { return problemDetail; } + /** + * Handle exception problem detail. + * + * @param e the e + * @return the problem detail + */ @ExceptionHandler(Exception.class) ProblemDetail handleException(Exception e) { log.error("Error ", e); @@ -128,4 +178,15 @@ ProblemDetail handleException(Exception e) { problemDetail.setProperty(TIMESTAMP, System.currentTimeMillis()); return problemDetail; } + + /** + * @param fieldErrors errors + * @return ResponseEntity with error details + */ + private Map handleValidationError(List fieldErrors) { + + Map messages = new HashMap<>(); + fieldErrors.forEach(fieldError -> messages.put(fieldError.getField(), fieldError.getDefaultMessage())); + return messages; + } } diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/WalletController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/WalletController.java index d72ba2820..92aa0c7e6 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/WalletController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/WalletController.java @@ -25,6 +25,7 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -68,6 +69,88 @@ public class WalletController extends BaseController { """) }) }) + @ApiResponse(responseCode = "400", description = "The input does not comply to the syntax requirements", content = { + @Content(examples = { + @ExampleObject(name = "Response in case of invalid data provided", value = """ + { + "type": "about:blank", + "title": "Invalid data provided", + "status": 400, + "detail": "details", + "instance": "API endpoint", + "properties": + { + "timestamp": 1689760833962, + "errors": + { + "filed": "filed error message" + } + } + } + """) + }) + }) + @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "409", description = "The request could not be completed due to a conflict.", content = {@Content(examples = { + @ExampleObject(name = "Wallet already exist", value = """ + { + "type": "about:blank", + "title": "Wallet is already exists for bpn BPNL000000000001", + "status": 409, + "detail": "Wallet is already exists for bpn BPNL000000000001", + "instance": "/api/wallets", + "properties": { + "timestamp": 1689762639948 + } + } + """) + })}) + @ApiResponse(responseCode = "500", description = "Any other internal server error", content = {@Content(examples = { + @ExampleObject(name = "Internal server error", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 500, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "201", content = { + @Content(examples = { + @ExampleObject(name = "Success response", value = """ + { + "name": "companyA", + "did": "did:web:localhost:BPNL000000000501", + "bpn": "BPNL000000000501", + "algorithm": "ED25519", + "didDocument": { + "id": "did:web:localhost:BPNL000000000501", + "verificationMethod": [ + { + "controller": "did:web:localhost:BPNL000000000501", + "id": "did:web:localhost:BPNL000000000501#", + "publicKeyJwk": { + "crv": "Ed25519", + "kty": "OKP", + "x": "0Ap6FsX5UuRBIoOzxWtcFA2ymnqXw0U08Ino_mIuYM4" + }, + "type": "JsonWebKey2020" + } + ], + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://w3c.github.io/vc-jws-2020/contexts/v1" + ] + } + } + """) + }) + }) @Operation(summary = "Create Wallet", description = "Permission: **add_wallets** \n\n Create a wallet and store it") @PostMapping(path = RestURI.WALLETS, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity createWallet(@Valid @RequestBody CreateWalletRequest request) { @@ -87,32 +170,108 @@ public ResponseEntity createWallet(@Valid @RequestBody CreateWalletReque @io.swagger.v3.oas.annotations.parameters.RequestBody(content = { @Content(examples = @ExampleObject(""" { - "id": "http://example.edu/credentials/3732", - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://www.w3.org/2018/credentials/examples/v1" - ], - "type": [ - "University-Degree-Credential", "VerifiableCredential" - ], - "issuer": "did:example:76e12ec712ebc6f1c221ebfeb1f", - "issuanceDate": "2019-06-16T18:56:59Z", - "expirationDate": "2019-06-17T18:56:59Z", - "credentialSubject": [{ - "college": "Test-University" - }], - "proof": { - "type": "Ed25519Signature2018", - "created": "2021-11-17T22:20:27Z", - "proofPurpose": "assertionMethod", - "verificationMethod": "did:example:76e12ec712ebc6f1c221ebfeb1f#key-1", - "jws": "eyJiNjQiOmZhbHNlLCJjcml0IjpbImI2NCJdLCJhbGciOiJFZERTQSJ9..JNerzfrK46Mq4XxYZEnY9xOK80xsEaWCLAHuZsFie1-NTJD17wWWENn_DAlA_OwxGF5dhxUJ05P6Dm8lcmF5Cg" - } + "@context": + [ + "https://www.w3.org/2018/credentials/v1", + "https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#" + ], + "type": + [ + "LegalParticipant", "VerifiableCredential" + ], + "id": "did:web:localhost", + "issuer": "did:web:localhost", + "issuanceDate": "2023-05-04T07:36:03.633Z", + "credentialSubject": + { + "id": "https://localhost/.well-known/participant.json", + "type": "gx:LegalParticipant", + "gx:legalName": "Demo", + "gx:legalRegistrationNumber": + { + "gx:taxID": "113123123" + }, + "gx:headquarterAddress": + { + "gx:countrySubdivisionCode": "BE-BRU" + }, + "gx:legalAddress": + { + "gx:countrySubdivisionCode": "BE-BRU" + }, + "gx-terms-and-conditions:gaiaxTermsAndConditions": "70c1d713215f95191a11d38fe2341faed27d19e083917bc8732ca4fea4976700" + }, + "proof": + { + "type": "JsonWebSignature2020", + "created": "2023-05-04T07:36:04.079Z", + "proofPurpose": "assertionMethod", + "verificationMethod": "did:web:localhost", + "jws": "eyJhbGciOiJQUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..iHki8WC3nPfcSRkC_AV4tXh0ikfT7BLPTGc_0ecI8zontTmJLqwcpPfAt0PFsoo3SkZgc6j636z55jj5tagBc-OKoiDu7diWryNAnL9ASsmWJyrPhOKVARs6x6PxVaTFBuyCfAHZeipxmkcYfNB_jooIXO2HuRcL2odhsQHELkGc5IDD-aBMWyNpfVAaYQ-cCzvDflZQlsowziUKfMkBfwpwgMdXFIgKWYdDIRvzA-U-XiC11-6QV7tPeKsMguEU0F5bh8cCEm2rooqXtENcsM_7cqFdQoOyblJyM-agoz2LUTj9QIdn9_gnNkGN-2U7_qBJWmHkK1Hm_mHqcNeeQw" + } } """)) }) + @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "500", description = "Any other internal server error", content = {@Content(examples = { + @ExampleObject(name = "Internal server error", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 500, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "400", description = "The input does not comply to the syntax requirements", content = { + @Content(examples = { + @ExampleObject(name = "Response in case of invalid data provided", value = """ + { + "type": "about:blank", + "title": "title", + "status": 400, + "detail": "details", + "instance": "API endpoint", + "properties": + { + "timestamp": 1689760833962, + "errors": + { + } + } + } + """) + }) + }) + @ApiResponse(responseCode = "404", description = "Wallet not found with provided identifier", content = {@Content(examples = { + @ExampleObject(name = "Wallet not found with provided identifier", value = """ + { + "type": "about:blank", + "title": "Wallet not found for identifier did:web:localhost:BPNL0000000", + "status": 404, + "detail": "Wallet not found for identifier did:web:localhost:BPNL0000000", + "instance": "/api/wallets/did%3Aweb%3Alocalhost%3ABPNL0000000/credentials", + "properties": { + "timestamp": 1689765541959 + } + } + """) + })}) + @ApiResponse(responseCode = "201", description = "Success Response", content = {@Content(examples = { + @ExampleObject(name = "Success Response", value = """ + { + "message": "Credential with id did:web:localhost has been successfully stored" + } + """) + })}) public ResponseEntity> storeCredential(@RequestBody Map data, - @Parameter(description = "Did or BPN") @PathVariable(name = "identifier") String identifier, Principal principal) { + @Parameter(description = "Did or BPN", examples = {@ExampleObject(name = "bpn", value = "BPNL000000000000", description = "bpn"), @ExampleObject(description = "did", name = "did", value = "did:web:localhost:BPNL000000000000")}) @PathVariable(name = "identifier") String identifier, Principal principal) { + return ResponseEntity.status(HttpStatus.CREATED).body(service.storeCredential(data, identifier, getBPNFromToken(principal))); } @@ -123,12 +282,156 @@ public ResponseEntity> storeCredential(@RequestBody Map getWalletByIdentifier(@Parameter(description = "Did or BPN") @PathVariable(name = "identifier") String identifier, + public ResponseEntity getWalletByIdentifier(@Parameter(description = "Did or BPN", examples = {@ExampleObject(name = "bpn", value = "BPNL000000000501", description = "bpn"), @ExampleObject(description = "did", name = "did", value = "did:web:localhost:BPNL000000000501")}) @PathVariable(name = "identifier") String identifier, @RequestParam(name = "withCredentials", defaultValue = "false") boolean withCredentials, Principal principal) { - return ResponseEntity.status(HttpStatus.OK).body(service.getWalletByIdentifier(identifier, withCredentials, getBPNFromToken(principal))); } @@ -137,6 +440,102 @@ public ResponseEntity getWalletByIdentifier(@Parameter(description = "Di * * @return the wallets */ + @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "500", description = "Any other internal server error", content = {@Content(examples = { + @ExampleObject(name = "Internal server error", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 500, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "400", description = "The input does not comply to the syntax requirements", content = { + @Content(examples = { + @ExampleObject(name = "Response in case of invalid data provided", value = """ + { + "type": "about:blank", + "title": "title", + "status": 400, + "detail": "details", + "instance": "API endpoint", + "properties": + { + "timestamp": 1689760833962, + "errors": + { + } + } + } + """) + }) + }) + @ApiResponse(responseCode = "200", description = "Wallet list", content = { + @Content(examples = { + @ExampleObject(name = "Wallet list", value = """ + { + "content": [ + { + "name": "companyA", + "did": "did:web:localhost:BPNL000000000001", + "bpn": "BPNL000000000001", + "algorithm": "ED25519", + "didDocument": { + "id": "did:web:localhost:BPNL000000000001", + "verificationMethod": [ + { + "controller": "did:web:localhost:BPNL000000000001", + "id": "did:web:localhost:BPNL000000000001#", + "publicKeyJwk": { + "crv": "Ed25519", + "kty": "OKP", + "x": "mhph0ZSVk7cDVmazbaaC3jBDpphW4eNygAK9gHPlMow" + }, + "type": "JsonWebKey2020" + } + ], + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://w3c.github.io/vc-jws-2020/contexts/v1" + ] + } + } + ], + "pageable": { + "sort": { + "empty": false, + "sorted": true, + "unsorted": false + }, + "offset": 0, + "pageNumber": 0, + "pageSize": 1, + "paged": true, + "unpaged": false + }, + "totalElements": 3, + "totalPages": 3, + "last": false, + "size": 1, + "number": 0, + "sort": { + "empty": false, + "sorted": true, + "unsorted": false + }, + "first": true, + "numberOfElements": 1, + "empty": false + } + """) + }) + }) @Operation(summary = "List of wallets", description = "Permission: **view_wallets** \n\n Retrieve list of registered wallets") @GetMapping(path = RestURI.WALLETS, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity> getWallets(@RequestParam(required = false, defaultValue = "0") int pageNumber, From cba1d5fff6dacc7cd09ec89f072bfc1fc9e083fd Mon Sep 17 00:00:00 2001 From: Ronak Thacker Date: Wed, 19 Jul 2023 19:23:27 +0530 Subject: [PATCH 04/14] feat: updated swagger doc response sample and env file --- dev-assets/env-files/env.docker.dist | 2 +- dev-assets/env-files/env.local.dist | 2 +- .../controller/DidDocumentController.java | 113 +++- .../IssuersCredentialController.java | 496 ++++++++++++++++++ 4 files changed, 609 insertions(+), 4 deletions(-) diff --git a/dev-assets/env-files/env.docker.dist b/dev-assets/env-files/env.docker.dist index c1779fe6b..115032e7d 100644 --- a/dev-assets/env-files/env.docker.dist +++ b/dev-assets/env-files/env.docker.dist @@ -30,7 +30,7 @@ AUTHORITY_WALLET_NAME=Catena-X KEYCLOAK_REALM=miw_test VC_SCHEMA_LINK="https://www.w3.org/2018/credentials/v1, https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json" VC_EXPIRY_DATE=01-01-2025 -SUPPORTED_FRAMEWORK_VC_TYPES="cx-behavior-twin=Behavior Twin,cx-pcf=PCF,cx-quality=Quality,cx-resiliency=Resiliency,cx-sustainability=Sustainability,cx-traceability=ID_3.0_Trace" +SUPPORTED_FRAMEWORK_VC_TYPES="PcfCredential, SustainabilityCredential, QualityCredential, TraceabilityCredential, BehaviorTwinCredential, ResiliencyCredential" MIW_HOST_NAME=miw ######### DON'T MODIFY ANYTHING BELOW THIS LINE !!! ######### diff --git a/dev-assets/env-files/env.local.dist b/dev-assets/env-files/env.local.dist index 714576baa..bec945347 100644 --- a/dev-assets/env-files/env.local.dist +++ b/dev-assets/env-files/env.local.dist @@ -30,7 +30,7 @@ AUTHORITY_WALLET_NAME=Catena-X KEYCLOAK_REALM=miw_test VC_SCHEMA_LINK="https://www.w3.org/2018/credentials/v1, https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json" VC_EXPIRY_DATE=01-01-2025 -SUPPORTED_FRAMEWORK_VC_TYPES="cx-behavior-twin=Behavior Twin,cx-pcf=PCF,cx-quality=Quality,cx-resiliency=Resiliency,cx-sustainability=Sustainability,cx-traceability=ID_3.0_Trace" +SUPPORTED_FRAMEWORK_VC_TYPES="PcfCredential, SustainabilityCredential, QualityCredential, TraceabilityCredential, BehaviorTwinCredential, ResiliencyCredential" MIW_HOST_NAME=miw ######### DON'T MODIFY ANYTHING BELOW THIS LINE !!! ######### diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java index 1575f4b02..399964419 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java @@ -23,6 +23,9 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.eclipse.tractusx.managedidentitywallets.constant.RestURI; @@ -50,9 +53,62 @@ public class DidDocumentController { * @param identifier the identifier * @return the did document */ + @ApiResponse(responseCode = "500", description = "Any other internal server error", content = {@Content(examples = { + @ExampleObject(name = "Internal server error", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 500, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "404", description = "Wallet not found with provided bpn", content = {@Content(examples = { + @ExampleObject(name = "Wallet not found with provided bpn", value = """ + { + "type": "about:blank", + "title": "Wallet not found for identifier BPNL00000000000", + "status": 404, + "detail": "Wallet not found for identifier BPNL00000000000", + "instance": "/BPNL00000000000/did.json", + "properties": { + "timestamp": 1689767698010 + } + } + """) + })}) + @ApiResponse(responseCode = "200", description = "DID document", content = { + @Content(examples = { + @ExampleObject(name = " DID document", value = """ + { + "id": "did:web:localhost:BPNL000000000000", + "verificationMethod": [ + { + "controller": "did:web:localhost:BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000#", + "publicKeyJwk": { + "crv": "Ed25519", + "kty": "OKP", + "x": "wAOQvr92L1m7RwrpeOrgWByVYvWmhRr4fJbiMwHEIdY" + }, + "type": "JsonWebKey2020" + } + ], + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://w3c.github.io/vc-jws-2020/contexts/v1" + ] + } + """) + }) + }) @Operation(description = "Resolve the DID document for a given DID or BPN", summary = "Resolve DID Document") @GetMapping(path = RestURI.DID_DOCUMENTS, produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity getDidDocument(@Parameter(description = "Did or BPN") @PathVariable(name = "identifier") String identifier) { + public ResponseEntity getDidDocument(@Parameter(description = "Did or BPN",examples = {@ExampleObject(name = "bpn", value = "BPNL000000000000", description = "bpn"), @ExampleObject(description = "did", name = "did", value = "did:web:localhost:BPNL000000000000")}) @PathVariable(name = "identifier") String identifier) { return ResponseEntity.status(HttpStatus.OK).body(service.getDidDocument(identifier)); } @@ -62,9 +118,62 @@ public ResponseEntity getDidDocument(@Parameter(description = "Did * @param bpn the bpn * @return the did resolve */ + @ApiResponse(responseCode = "500", description = "Any other internal server error", content = {@Content(examples = { + @ExampleObject(name = "Internal server error", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 500, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "404", description = "Wallet not found with provided bpn", content = {@Content(examples = { + @ExampleObject(name = "Wallet not found with provided bpn", value = """ + { + "type": "about:blank", + "title": "Wallet not found for identifier BPNL00000000000", + "status": 404, + "detail": "Wallet not found for identifier BPNL00000000000", + "instance": "/BPNL00000000000/did.json", + "properties": { + "timestamp": 1689767698010 + } + } + """) + })}) + @ApiResponse(responseCode = "200", description = "DID document", content = { + @Content(examples = { + @ExampleObject(name = " DID document", value = """ + { + "id": "did:web:localhost:BPNL000000000000", + "verificationMethod": [ + { + "controller": "did:web:localhost:BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000#", + "publicKeyJwk": { + "crv": "Ed25519", + "kty": "OKP", + "x": "wAOQvr92L1m7RwrpeOrgWByVYvWmhRr4fJbiMwHEIdY" + }, + "type": "JsonWebKey2020" + } + ], + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://w3c.github.io/vc-jws-2020/contexts/v1" + ] + } + """) + }) + }) @Operation(description = "Resolve the DID document for a given BPN", summary = "Resolve DID Document") @GetMapping(path = RestURI.DID_RESOLVE, produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity getDidResolve(@Parameter(description = "Did or BPN") @PathVariable(name = "bpn") String bpn) { + public ResponseEntity getDidResolve(@Parameter(description = "BPN",examples = {@ExampleObject(name = "bpn", value = "BPNL000000000000", description = "bpn")}) @PathVariable(name = "bpn") String bpn) { return ResponseEntity.status(HttpStatus.OK).body(service.getDidDocument(bpn)); } } diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java index db6b6d86d..fcd11d4d5 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java @@ -25,6 +25,7 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import jakarta.validation.constraints.Max; @@ -79,6 +80,168 @@ public class IssuersCredentialController extends BaseController { * @return the credentials */ @Tag(name = API_TAG_VERIFIABLE_CREDENTIAL_ISSUER) + @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "500", description = "Any other internal server error", content = {@Content(examples = { + @ExampleObject(name = "Internal server error", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 500, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "400", description = "The input does not comply to the syntax requirements", content = { + @Content(examples = { + @ExampleObject(name = "Response in case of invalid data provided", value = """ + { + "type": "about:blank", + "title": "title", + "status": 400, + "detail": "details", + "instance": "API endpoint", + "properties": + { + "timestamp": 1689760833962, + "errors": + { + } + } + } + """) + }) + }) + @ApiResponse(responseCode = "200", description = "Issuer credential list", content = { + @Content(examples = { + @ExampleObject(name = "Issuer credential list", value = """ + { + "content": [ + { + "credentialSubject": [ + { + "bpn": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "BpnCredential" + } + ], + "issuanceDate": "2023-07-19T09:27:42Z", + "id": "did:web:localhost:BPNL000000000000#ae364f71-f054-4d91-b579-f001bcb3e59e", + "proof": { + "created": "2023-07-19T09:27:44Z", + "jws": "eyJhbGciOiJFZERTQSJ9..evDHQfW4EzJUt2HnS_WlmO8FFtywTGnwyywtCE7WP41my4Iscpqr4tbuVOqnZg85b4U8L3_ut8_pEONIhbExCQ", + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#" + }, + "type": [ + "VerifiableCredential", + "BpnCredential" + ], + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z" + }, + { + "credentialSubject": [ + { + "contractTemplate": "https://public.catena-x.org/contracts/", + "holderIdentifier": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "items": [ + "BpnCredential" + ], + "type": "SummaryCredential" + } + ], + "issuanceDate": "2023-07-19T09:11:39Z", + "id": "did:web:localhost:BPNL000000000000#3b032840-3cd8-4e69-9a96-f1a0ccf1e689", + "proof": { + "created": "2023-07-19T09:11:41Z", + "jws": "eyJhbGciOiJFZERTQSJ9..YvoFhDip3TQAfZUIu0yc843oA4uGTg049dMFt_GoaMmPjiNB_B1EFOL-gDpwjIxTYNlGOO_CLp9qStbzlDTNBg", + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#" + }, + "type": [ + "VerifiableCredential", + "SummaryCredential" + ], + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/SummaryVC.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z" + }, + { + "credentialSubject": [ + { + "bpn": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "BpnCredential" + } + ], + "issuanceDate": "2023-07-19T09:11:34Z", + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", + "proof": { + "created": "2023-07-19T09:11:39Z", + "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#" + }, + "type": [ + "VerifiableCredential", + "BpnCredential" + ], + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z" + } + ], + "pageable": { + "sort": { + "empty": false, + "unsorted": false, + "sorted": true + }, + "offset": 0, + "pageNumber": 0, + "pageSize": 2147483647, + "paged": true, + "unpaged": false + }, + "last": true, + "totalPages": 1, + "totalElements": 3, + "first": true, + "size": 2147483647, + "number": 0, + "sort": { + "empty": false, + "unsorted": false, + "sorted": true + }, + "numberOfElements": 3, + "empty": false + } + """) + }) + }) @Operation(description = "Permission: **view_wallets** (The BPN of holderIdentifier must equal BPN of caller)\n\n Search verifiable credentials with filter criteria", summary = "Query Verifiable Credentials") @GetMapping(path = RestURI.ISSUERS_CREDENTIALS, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity> getCredentials(@RequestParam(required = false) String credentialId, @@ -106,6 +269,74 @@ public ResponseEntity> getCredentials(@RequestPar """)) }) @Tag(name = API_TAG_VERIFIABLE_CREDENTIAL_ISSUER) + @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "500", description = "Any other internal server error", content = {@Content(examples = { + @ExampleObject(name = "Internal server error", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 500, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "409", description = "The request could not be completed due to a conflict.", content = {@Content(examples = { + @ExampleObject(name = "MembershipCredential already exist", value = """ + { + "type": "about:blank", + "title": "Credential of type MembershipCredential is already exists ", + "status": 409, + "detail": "Credential of type MembershipCredential is already exists ", + "instance": "/api/credentials/issuer/membership", + "properties": { + "timestamp": 1689772483831 + } + } + """) + })}) + @ApiResponse(responseCode = "201", description = "Issuer credential", content = { + @Content(examples = { + @ExampleObject(name = "Membership credential", value = """ + { + "issuanceDate": "2023-07-19T13:13:53Z", + "credentialSubject": [ + { + "holderIdentifier": "BPNL000000000000", + "startTime": "2023-07-19T13:13:53.581081Z", + "memberOf": "Catena-X", + "id": "did:web:localhost:BPNL000000000000", + "type": "MembershipCredential", + "status": "Active" + } + ], + "id": "did:web:localhost:BPNL000000000000#0d6b6447-99de-4bc5-94f3-3ac0ae8ee188", + "proof": { + "proofPurpose": "proofPurpose", + "verificationMethod": "did:web:localhost:BPNL000000000000#", + "type": "JsonWebSignature2020", + "created": "2023-07-19T13:13:57Z", + "jws": "eyJhbGciOiJFZERTQSJ9..zt7SyONY1shO7N6KrabQJr9uNrToM1Bc4eagTQc1LxAfZ1v-SSp9Y-2cpZNDV8AR08r4L8VbtWrR9t2dNoAfDw" + }, + "type": [ + "VerifiableCredential", + "MembershipCredential" + ], + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z" + } + """) + }) + }) @Operation(summary = "Issue a Membership Verifiable Credential with base wallet issuer", description = "Permission: **update_wallets** (The BPN of base wallet must equal BPN of caller)\n\n Issue a verifiable credential by base wallet") @PostMapping(path = RestURI.CREDENTIALS_ISSUER_MEMBERSHIP, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity issueMembershipCredential(@Valid @RequestBody IssueMembershipCredentialRequest issueMembershipCredentialRequest, Principal principal) { @@ -131,6 +362,78 @@ public ResponseEntity issueMembershipCredential(@Valid @Re """)) }) @Tag(name = API_TAG_VERIFIABLE_CREDENTIAL_ISSUER) + @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "500", description = "Any other internal server error", content = {@Content(examples = { + @ExampleObject(name = "Internal server error", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 500, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "409", description = "The request could not be completed due to a conflict.", content = {@Content(examples = { + @ExampleObject(name = "DismantlerCredential already exist", value = """ + { + "type": "about:blank", + "title": "Credential of type DismantlerCredential is already exists ", + "status": 409, + "detail": "Credential of type DismantlerCredential is already exists ", + "instance": "/api/credentials/issuer/dismantler", + "properties": { + "timestamp": 1689773804746 + } + } + """) + })}) + @ApiResponse(responseCode = "201", description = "Dismantler Credential", content = { + @Content(examples = { + @ExampleObject(name = "Dismantler Credential", value = """ + { + "issuanceDate": "2023-07-19T13:35:33Z", + "credentialSubject": [ + { + "holderIdentifier": "BPNL000000000000", + "allowedVehicleBrands": [ + "Audi", + "Abarth", + "Alfa Romeo", + "Chrysler" + ], + "id": "did:web:localhost:BPNL000000000000", + "activityType": "vehicleDismantle", + "type": "DismantlerCredential" + } + ], + "id": "did:web:localhost:BPNL000000000000#5caac86c-8ef8-4aab-9d2b-fb18c62560a9", + "proof": { + "proofPurpose": "proofPurpose", + "verificationMethod": "did:web:localhost:BPNL000000000000#", + "type": "JsonWebSignature2020", + "created": "2023-07-19T13:35:38Z", + "jws": "eyJhbGciOiJFZERTQSJ9..UI82uq6iyqoaKjZIhJiV24v_Bqnj_7EqWiqZ3VWjqkoHLnr7JDtW5KVywWPl27j_baLBxxnM5jqjQdSK4rfbBg" + }, + "type": [ + "VerifiableCredential", + "DismantlerCredential" + ], + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z" + } + """) + }) + }) @Operation(summary = "Issue a Dismantler Verifiable Credential with base wallet issuer", description = "Permission: **update_wallets** (The BPN of base wallet must equal BPN of caller)\n\n Issue a verifiable credential by base wallet") @PostMapping(path = RestURI.CREDENTIALS_ISSUER_DISMANTLER, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity issueDismantlerCredential(@Valid @RequestBody IssueDismantlerCredentialRequest request, Principal principal) { @@ -156,6 +459,59 @@ public ResponseEntity issueDismantlerCredential(@Valid @Re }) @Tag(name = API_TAG_VERIFIABLE_CREDENTIAL_ISSUER) @Operation(summary = "Issue a Use Case Verifiable Credential with base wallet issuer", description = "Permission: **update_wallets** (The BPN of base wallet must equal BPN of caller)\n\n Issue a verifiable credential by base wallet") + @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "500", description = "Any other internal server error", content = {@Content(examples = { + @ExampleObject(name = "Internal server error", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 500, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "201", description = "Framework credential", content = { + @Content(examples = { + @ExampleObject(name = "Framework credential", value = """ + { + "issuanceDate": "2023-07-19T13:49:58Z", + "credentialSubject": [ + { + "holderIdentifier": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "BehaviorTwinCredential", + "contractTemplate": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", + "contractVersion": "1.0.0" + } + ], + "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", + "proof": { + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#", + "created": "2023-07-19T13:50:02Z", + "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" + }, + "type": [ + "VerifiableCredential", + "UseCaseFrameworkCondition" + ], + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z" + } + """) + }) + }) @PostMapping(path = RestURI.API_CREDENTIALS_ISSUER_FRAMEWORK, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity issueFrameworkCredential(@Valid @RequestBody IssueFrameworkCredentialRequest request, Principal principal) { return ResponseEntity.status(HttpStatus.CREATED).body(issuersCredentialService.issueFrameworkCredential(request, getBPNFromToken(principal))); @@ -169,6 +525,95 @@ public ResponseEntity issueFrameworkCredential(@Valid @Req * @return the response entity */ @Tag(name = API_TAG_VERIFIABLE_CREDENTIAL_VALIDATION) + @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "500", description = "Any other internal server error", content = {@Content(examples = { + @ExampleObject(name = "Internal server error", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 500, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "200", description = "Validate Verifiable Credentials", content = { + @Content(examples = { + @ExampleObject(name = "Verifiable Credentials without check expiry", value = """ + { + "valid": true, + "vc": { + "issuanceDate": "2023-07-19T09:11:34Z", + "credentialSubject": [ + { + "bpn": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "BpnCredential" + } + ], + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", + "proof": { + "created": "2023-07-19T09:11:39Z", + "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#" + }, + "type": [ + "VerifiableCredential", + "BpnCredential" + ], + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z" + } + } + """), + @ExampleObject(name = "Verifiable Credentials with check expiry", value = """ + { + "valid": true, + "vc": { + "issuanceDate": "2023-07-19T09:11:34Z", + "credentialSubject": [ + { + "bpn": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "BpnCredential" + } + ], + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", + "proof": { + "created": "2023-07-19T09:11:39Z", + "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#" + }, + "type": [ + "VerifiableCredential", + "BpnCredential" + ], + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z" + }, + "validateExpiryDate": true + } + """) + }) + }) @Operation(summary = "Validate Verifiable Credentials", description = "Permission: **view_wallets** OR **view_wallet** \n\n Validate Verifiable Credentials") @PostMapping(path = RestURI.CREDENTIALS_VALIDATION, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @@ -219,6 +664,57 @@ public ResponseEntity> credentialsValidation(@RequestBody Ma * @return the response entity */ @Tag(name = API_TAG_VERIFIABLE_CREDENTIAL_ISSUER) + @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "500", description = "Any other internal server error", content = {@Content(examples = { + @ExampleObject(name = "Internal server error", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 500, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "201", description = "Issuer credential", content = { + @Content(examples = { + @ExampleObject(name = "Issuer credential", value = """ + { + "issuanceDate": "2023-07-19T12:18:30Z", + "credentialSubject": [ + { + "bpn": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "BpnCredential" + } + ], + "id": "did:web:localhost:BPNL000000000000#ff084e7a-1b46-4a2f-a78d-3d701a0bd6e4", + "proof": { + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#", + "created": "2023-07-19T12:18:34Z", + "jws": "eyJhbGciOiJFZERTQSJ9..0Ua1vcTQAYwQY3PPuHr4RQxqW6iIngrHQQx1oPgk2uzqUpcbfY2YUxXAnbNA333-lSuvNhiV_1NLfBnCEcI2DQ" + }, + "type": [ + "VerifiableCredential", + "BpnCredential" + ], + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z" + } + """) + }) + }) @Operation(summary = "Issue Verifiable Credential", description = "Permission: **update_wallets** (The BPN of the base wallet must equal BPN of caller)\nIssue a verifiable credential with a given issuer DID") @PostMapping(path = RestURI.ISSUERS_CREDENTIALS, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) From c070e5b5910c41179a502185779208411d40788c Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Wed, 19 Jul 2023 19:39:58 +0530 Subject: [PATCH 05/14] docs: CGD-391: Example added for Wallet and holder VC API --- .../HoldersCredentialController.java | 285 +++++++++++++++++- .../controller/WalletController.java | 13 +- 2 files changed, 286 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java index 8343c98ee..941c498ab 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java @@ -25,6 +25,7 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Min; @@ -64,13 +65,149 @@ public class HoldersCredentialController extends BaseController { * @param principal the principal * @return the credentials */ + @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "500", description = "Any other internal server error", content = {@Content(examples = { + @ExampleObject(name = "Internal server error", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 500, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "404", description = "Wallet not found with caller BPN", content = {@Content(examples = { + @ExampleObject(name = "Wallet not found with caller BPN", value = """ + { + "type": "about:blank", + "title": "Wallet not found for identifier did:web:localhost:BPNL0000000", + "status": 404, + "detail": "Wallet not found for identifier did:web:localhost:BPNL0000000", + "instance": "/api/wallets/did%3Aweb%3Alocalhost%3ABPNL0000000/credentials", + "properties": { + "timestamp": 1689765541959 + } + } + """) + })}) + @ApiResponse(responseCode = "400", description = "The input does not comply to the syntax requirements", content = { + @Content(examples = { + @ExampleObject(name = "Response in case of invalid data provided", value = """ + { + "type": "about:blank", + "title": "title", + "status": 400, + "detail": "details", + "instance": "API endpoint", + "properties": + { + "timestamp": 1689760833962, + "errors": + { + } + } + } + """) + }) + }) + @ApiResponse(responseCode = "200", description = "Credential list", content = { + @Content(examples = { + @ExampleObject(name = "Credential list", value = """ + { + "content": + [ + { + "credentialSubject": + [ + { + "contractTemplate": "https://public.catena-x.org/contracts/", + "holderIdentifier": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "items": + [ + "BpnCredential" + ], + "type": "SummaryCredential" + } + ], + "issuanceDate": "2023-07-14T11:05:48Z", + "id": "did:web:localhost:BPNL000000000000#954d43de-ebed-481d-9e35-e3bbb311b8f5", + "proof": + { + "created": "2023-07-14T11:05:50Z", + "jws": "eyJhbGciOiJFZERTQSJ9..4xwFUCtP0xXVEo5_lXd90Vv-TWO2FijZut-HZ5cozAQseexj8EpTkK1erhFbf2Ua1kb8pi_H5At5HiPkTxSIAQ", + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#" + }, + "type": + [ + "VerifiableCredential", + "SummaryCredential" + ], + "@context": + [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/SummaryVC.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2023-09-30T18:30:00Z" + } + ], + "pageable": + { + "sort": + { + "empty": false, + "sorted": true, + "unsorted": false + }, + "offset": 0, + "pageNumber": 0, + "pageSize": 2147483647, + "paged": true, + "unpaged": false + }, + "totalElements": 1, + "totalPages": 1, + "last": true, + "size": 2147483647, + "number": 0, + "sort": + { + "empty": false, + "sorted": true, + "unsorted": false + }, + "first": true, + "numberOfElements": 1, + "empty": false + } + """) + }) + }) @Operation(description = "Permission: **view_wallets** OR **view_wallet** (The BPN of holderIdentifier must equal BPN of caller)\n\n Search verifiable credentials with filter criteria", summary = "Query Verifiable Credentials") @GetMapping(path = RestURI.CREDENTIALS, produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity> getCredentials(@RequestParam(required = false) String credentialId, - @RequestParam(required = false) String issuerIdentifier, - @RequestParam(required = false) List type, - @RequestParam(required = false, defaultValue = "createdAt") String sortColumn, - @RequestParam(required = false, defaultValue = "desc") String sortTpe, + public ResponseEntity> getCredentials(@Parameter(name = "credentialId", description = "Credential Id", examples = {@ExampleObject(name = "Credential Id", value = "did:web:localhost:BPNL000000000000#12528899-160a-48bd-ba15-f396c3959ae9")}) @RequestParam(required = false) String credentialId, + @Parameter(name = "issuerIdentifier", description = "Issuer identifier(did of BPN)", examples = {@ExampleObject(name = "bpn", value = "BPNL000000000501", description = "bpn"), @ExampleObject(description = "did", name = "did", value = "did:web:localhost:BPNL000000000501")}) @RequestParam(required = false) String issuerIdentifier, + @Parameter(name = "type", description = "Type of VC", examples = {@ExampleObject(name = "SummaryCredential", value = "SummaryCredential", description = "SummaryCredential"), @ExampleObject(description = "BpnCredential", name = "BpnCredential", value = "BpnCredential")}) @RequestParam(required = false) List type, + @Parameter(name = "sortColumn", description = "Sort column name", + examples = { + @ExampleObject(value = "createdAt", name = "creation date"), + @ExampleObject(value = "issuerDid", name = "Issuer did"), + @ExampleObject(value = "type", name = "Credential type"), + @ExampleObject(value = "credentialId", name = "Credential id"), + @ExampleObject(value = "selfIssued", name = "Self issued credential"), + @ExampleObject(value = "stored", name = "Stored credential") + } + ) @RequestParam(required = false, defaultValue = "createdAt") String sortColumn, + @Parameter(name = "sortTpe", description = "Sort order", examples = {@ExampleObject(value = "desc", name = "Descending order"), @ExampleObject(value = "asc", name = "Ascending order")}) @RequestParam(required = false, defaultValue = "desc") String sortTpe, @Min(0) @Max(Integer.MAX_VALUE) @Parameter(description = "Page number, Page number start with zero") @RequestParam(required = false, defaultValue = "0") int pageNumber, @Min(0) @Max(Integer.MAX_VALUE) @Parameter(description = "Number of records per page") @RequestParam(required = false, defaultValue = Integer.MAX_VALUE + "") int size, Principal principal) { @@ -85,9 +222,94 @@ public ResponseEntity> getCredentials(@RequestPar * @param principal the principal * @return the response entity */ + @ApiResponse(responseCode = "201", description = "Success Response", content = {@Content(examples = { + @ExampleObject(name = "Success Response", value = """ + { + "issuanceDate": "2023-07-19T13:41:52Z", + "credentialSubject": [ + { + "bpn": "BPNL000000000000", + "bankName": "Dummy Bank", + "id": "did:web:localhost:BPNL000000000000", + "type": "BankDetails", + "accountNumber": "123456789" + } + ], + "id": "did:web:localhost:BPNL000000000000#319a2641-9407-4c39-bf51-a4a109b59604", + "proof": { + "proofPurpose": "proofPurpose", + "verificationMethod": "did:web:localhost:BPNL000000000000#", + "type": "JsonWebSignature2020", + "created": "2023-07-19T13:41:54Z", + "jws": "eyJhbGciOiJFZERTQSJ9..fdqaAsPhQ5xZhQiRvWliDVXX-R9NzCvFXGUAOyQ8yE1hmf_4cvxS7JFuEojjsi3V-n66iiRCUFEXsnv56XPgDA" + }, + "type": [ + "VerifiableCredential", + "BankDetails" + ], + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z" + } + """) + })}) + @ApiResponse(responseCode = "404", description = "Wallet not found with caller BPN", content = {@Content(examples = { + @ExampleObject(name = "Wallet not found with caller BPN", value = """ + { + "type": "about:blank", + "title": "Wallet not found for identifier did:web:localhost:BPNL0000000501", + "status": 404, + "detail": "Wallet not found for identifier did:web:localhost:BPNL0000000501", + "instance": "/api/wallets/did%3Aweb%3Alocalhost%3ABPNL0000000501", + "properties": { + "timestamp": 1689764377224 + } + } + """) + })}) + @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "500", description = "Any other internal server error", content = {@Content(examples = { + @ExampleObject(name = "Internal server error", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 500, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "400", description = "The input does not comply to the syntax requirements", content = { + @Content(examples = { + @ExampleObject(name = "Response in case of invalid data provided", value = """ + { + "type": "about:blank", + "title": "Invalid data provided", + "status": 400, + "detail": "details", + "instance": "API endpoint", + "properties": + { + "timestamp": 1689760833962, + "errors": + { + "filed": "filed error message" + } + } + } + """) + }) + }) @Operation(summary = "Issue Verifiable Credential", description = "Permission: **update_wallets** OR **update_wallet** (The BPN of the issuer of the Verifiable Credential must equal BPN of caller)\nIssue a verifiable credential with a given issuer DID") @PostMapping(path = RestURI.CREDENTIALS, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) - @io.swagger.v3.oas.annotations.parameters.RequestBody(content = { @Content(examples = @ExampleObject(""" { @@ -99,7 +321,7 @@ public ResponseEntity> getCredentials(@RequestPar ], "type": [ "VerifiableCredential", - "BpnCredential" + "BankDetails" ], "issuer": "did:web:localhost:BPNL000000000000", "expirationDate": "2024-12-31T18:30:00Z", @@ -108,7 +330,9 @@ public ResponseEntity> getCredentials(@RequestPar { "bpn": "BPNL000000000000", "id": "did:web:localhost:BPNL000000000000", - "type": "BpnCredential" + "type": "BankDetails", + "accountNumber": "123456789", + "bankName":"Dummy Bank" } ] } @@ -125,9 +349,52 @@ public ResponseEntity issueCredential(@RequestBody Map deleteCredential(@RequestParam(name = "id") String credentialId, Principal principal) { + public ResponseEntity deleteCredential(@Parameter(name = "id", description = "Credential Id", examples = {@ExampleObject(name = "Credential Id", value = "did:web:localhost:BPNL000000000000#319a2641-9407-4c39-bf51-a4a109b59604")}) @RequestParam(name = "id") String credentialId, Principal principal) { holdersCredentialService.deleteCredential(credentialId, getBPNFromToken(principal)); return ResponseEntity.status(HttpStatus.NO_CONTENT).build(); } diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/WalletController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/WalletController.java index 8cc00c447..09d1b6cfb 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/WalletController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/WalletController.java @@ -538,10 +538,17 @@ public ResponseEntity getWalletByIdentifier(@Parameter(description = "Di }) @Operation(summary = "List of wallets", description = "Permission: **view_wallets** \n\n Retrieve list of registered wallets") @GetMapping(path = RestURI.WALLETS, produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity> getWallets(@RequestParam(required = false, defaultValue = "0") int pageNumber, - @RequestParam(required = false, defaultValue = Integer.MAX_VALUE + "") int size, + public ResponseEntity> getWallets(@Parameter(name = "pageNumber", description = "Page number, Page number start with zero") @RequestParam(required = false, defaultValue = "0") int pageNumber, + @Parameter(name = "size", description = "Number of records per page") @RequestParam(required = false, defaultValue = Integer.MAX_VALUE + "") int size, + @Parameter(name = "sortColumn", description = "Sort column name", examples = { + @ExampleObject(value = "createdAt", name = "Creation date"), + @ExampleObject(value = "name", name = "Wallet name"), + @ExampleObject(value = "did", name = "Wallet did"), + @ExampleObject(value = "bpn", name = "Wallet BPN") + } + ) @RequestParam(required = false, defaultValue = "createdAt") String sortColumn, - @RequestParam(required = false, defaultValue = "desc") String sortTpe) { + @Parameter(name = "sortTpe", description = "Sort order", examples = {@ExampleObject(value = "desc", name = "Descending order"), @ExampleObject(value = "asc", name = "Ascending order")}) @RequestParam(required = false, defaultValue = "desc") String sortTpe) { return ResponseEntity.status(HttpStatus.OK).body(service.getWallets(pageNumber, size, sortColumn, sortTpe)); } } \ No newline at end of file From e6179d170da340dc7c1d192c516b28778e15fd30 Mon Sep 17 00:00:00 2001 From: Ronak Thacker Date: Thu, 20 Jul 2023 12:18:09 +0530 Subject: [PATCH 06/14] feat: updated swagger doc --- .../controller/DidDocumentController.java | 16 +- .../IssuersCredentialController.java | 462 +++++++++++++++--- .../controller/PresentationController.java | 144 ++++++ 3 files changed, 535 insertions(+), 87 deletions(-) diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java index 399964419..f37ce855d 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java @@ -85,6 +85,10 @@ public class DidDocumentController { @Content(examples = { @ExampleObject(name = " DID document", value = """ { + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://w3c.github.io/vc-jws-2020/contexts/v1" + ], "id": "did:web:localhost:BPNL000000000000", "verificationMethod": [ { @@ -97,10 +101,6 @@ public class DidDocumentController { }, "type": "JsonWebKey2020" } - ], - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3c.github.io/vc-jws-2020/contexts/v1" ] } """) @@ -150,6 +150,10 @@ public ResponseEntity getDidDocument(@Parameter(description = "Did @Content(examples = { @ExampleObject(name = " DID document", value = """ { + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://w3c.github.io/vc-jws-2020/contexts/v1" + ], "id": "did:web:localhost:BPNL000000000000", "verificationMethod": [ { @@ -162,10 +166,6 @@ public ResponseEntity getDidDocument(@Parameter(description = "Did }, "type": "JsonWebKey2020" } - ], - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3c.github.io/vc-jws-2020/contexts/v1" ] } """) diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java index fcd11d4d5..6866f9752 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java @@ -122,6 +122,19 @@ public class IssuersCredentialController extends BaseController { { "content": [ { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:localhost:BPNL000000000000#ae364f71-f054-4d91-b579-f001bcb3e59e", + "type": [ + "VerifiableCredential", + "BpnCredential" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "issuanceDate": "2023-07-19T09:27:42Z", + "expirationDate": "2024-12-31T18:30:00Z", "credentialSubject": [ { "bpn": "BPNL000000000000", @@ -129,28 +142,27 @@ public class IssuersCredentialController extends BaseController { "type": "BpnCredential" } ], - "issuanceDate": "2023-07-19T09:27:42Z", - "id": "did:web:localhost:BPNL000000000000#ae364f71-f054-4d91-b579-f001bcb3e59e", "proof": { "created": "2023-07-19T09:27:44Z", "jws": "eyJhbGciOiJFZERTQSJ9..evDHQfW4EzJUt2HnS_WlmO8FFtywTGnwyywtCE7WP41my4Iscpqr4tbuVOqnZg85b4U8L3_ut8_pEONIhbExCQ", "proofPurpose": "proofPurpose", "type": "JsonWebSignature2020", "verificationMethod": "did:web:localhost:BPNL000000000000#" - }, + } + }, + { "type": [ "VerifiableCredential", - "BpnCredential" + "SummaryCredential" ], "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://catenax-ng.github.io/product-core-schemas/SummaryVC.json", "https://w3id.org/security/suites/jws-2020/v1" ], "issuer": "did:web:localhost:BPNL000000000000", + "issuanceDate": "2023-07-19T09:11:39Z", "expirationDate": "2024-12-31T18:30:00Z" - }, - { "credentialSubject": [ { "contractTemplate": "https://public.catena-x.org/contracts/", @@ -162,28 +174,28 @@ public class IssuersCredentialController extends BaseController { "type": "SummaryCredential" } ], - "issuanceDate": "2023-07-19T09:11:39Z", - "id": "did:web:localhost:BPNL000000000000#3b032840-3cd8-4e69-9a96-f1a0ccf1e689", "proof": { "created": "2023-07-19T09:11:41Z", "jws": "eyJhbGciOiJFZERTQSJ9..YvoFhDip3TQAfZUIu0yc843oA4uGTg049dMFt_GoaMmPjiNB_B1EFOL-gDpwjIxTYNlGOO_CLp9qStbzlDTNBg", "proofPurpose": "proofPurpose", "type": "JsonWebSignature2020", "verificationMethod": "did:web:localhost:BPNL000000000000#" - }, - "type": [ - "VerifiableCredential", - "SummaryCredential" - ], + } + }, + { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/SummaryVC.json", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", + "type": [ + "VerifiableCredential", + "BpnCredential" + ], "issuer": "did:web:localhost:BPNL000000000000", - "expirationDate": "2024-12-31T18:30:00Z" - }, - { + "issuanceDate": "2023-07-19T09:11:34Z", + "expirationDate": "2024-12-31T18:30:00Z", "credentialSubject": [ { "bpn": "BPNL000000000000", @@ -191,26 +203,13 @@ public class IssuersCredentialController extends BaseController { "type": "BpnCredential" } ], - "issuanceDate": "2023-07-19T09:11:34Z", - "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", "proof": { "created": "2023-07-19T09:11:39Z", "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", "proofPurpose": "proofPurpose", "type": "JsonWebSignature2020", "verificationMethod": "did:web:localhost:BPNL000000000000#" - }, - "type": [ - "VerifiableCredential", - "BpnCredential" - ], - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "expirationDate": "2024-12-31T18:30:00Z" + } } ], "pageable": { @@ -299,11 +298,58 @@ public ResponseEntity> getCredentials(@RequestPar } """) })}) + @ApiResponse(responseCode = "404", description = "Wallet not found with provided identifier", content = {@Content(examples = { + @ExampleObject(name = "Wallet not found with provided identifier", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 404, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "400", description = "The input does not comply to the syntax requirements", content = { + @Content(examples = { + @ExampleObject(name = "Response in case of invalid data provided", value = """ + { + "type": "about:blank", + "title": "Invalid data provided", + "status": 400, + "detail": "details", + "instance": "API endpoint", + "properties": + { + "timestamp": 1689760833962, + "errors": + { + "filed": "filed error message" + } + } + } + """) + }) + }) @ApiResponse(responseCode = "201", description = "Issuer credential", content = { @Content(examples = { @ExampleObject(name = "Membership credential", value = """ { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:localhost:BPNL000000000000#0d6b6447-99de-4bc5-94f3-3ac0ae8ee188", + "type": [ + "VerifiableCredential", + "MembershipCredential" + ], + "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T13:13:53Z", + "expirationDate": "2024-12-31T18:30:00Z", "credentialSubject": [ { "holderIdentifier": "BPNL000000000000", @@ -314,25 +360,13 @@ public ResponseEntity> getCredentials(@RequestPar "status": "Active" } ], - "id": "did:web:localhost:BPNL000000000000#0d6b6447-99de-4bc5-94f3-3ac0ae8ee188", "proof": { "proofPurpose": "proofPurpose", "verificationMethod": "did:web:localhost:BPNL000000000000#", "type": "JsonWebSignature2020", "created": "2023-07-19T13:13:57Z", "jws": "eyJhbGciOiJFZERTQSJ9..zt7SyONY1shO7N6KrabQJr9uNrToM1Bc4eagTQc1LxAfZ1v-SSp9Y-2cpZNDV8AR08r4L8VbtWrR9t2dNoAfDw" - }, - "type": [ - "VerifiableCredential", - "MembershipCredential" - ], - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "expirationDate": "2024-12-31T18:30:00Z" + } } """) }) @@ -392,11 +426,58 @@ public ResponseEntity issueMembershipCredential(@Valid @Re } """) })}) + @ApiResponse(responseCode = "404", description = "Wallet not found with provided identifier", content = {@Content(examples = { + @ExampleObject(name = "Wallet not found with provided identifier", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 404, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "400", description = "The input does not comply to the syntax requirements", content = { + @Content(examples = { + @ExampleObject(name = "Response in case of invalid data provided", value = """ + { + "type": "about:blank", + "title": "Invalid data provided", + "status": 400, + "detail": "details", + "instance": "API endpoint", + "properties": + { + "timestamp": 1689760833962, + "errors": + { + "filed": "filed error message" + } + } + } + """) + }) + }) @ApiResponse(responseCode = "201", description = "Dismantler Credential", content = { @Content(examples = { @ExampleObject(name = "Dismantler Credential", value = """ { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:localhost:BPNL000000000000#5caac86c-8ef8-4aab-9d2b-fb18c62560a9", + "type": [ + "VerifiableCredential", + "DismantlerCredential" + ], + "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T13:35:33Z", + "expirationDate": "2024-12-31T18:30:00Z", "credentialSubject": [ { "holderIdentifier": "BPNL000000000000", @@ -411,25 +492,13 @@ public ResponseEntity issueMembershipCredential(@Valid @Re "type": "DismantlerCredential" } ], - "id": "did:web:localhost:BPNL000000000000#5caac86c-8ef8-4aab-9d2b-fb18c62560a9", "proof": { "proofPurpose": "proofPurpose", "verificationMethod": "did:web:localhost:BPNL000000000000#", "type": "JsonWebSignature2020", "created": "2023-07-19T13:35:38Z", "jws": "eyJhbGciOiJFZERTQSJ9..UI82uq6iyqoaKjZIhJiV24v_Bqnj_7EqWiqZ3VWjqkoHLnr7JDtW5KVywWPl27j_baLBxxnM5jqjQdSK4rfbBg" - }, - "type": [ - "VerifiableCredential", - "DismantlerCredential" - ], - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "expirationDate": "2024-12-31T18:30:00Z" + } } """) }) @@ -475,11 +544,58 @@ public ResponseEntity issueDismantlerCredential(@Valid @Re } """) })}) + @ApiResponse(responseCode = "404", description = "Wallet not found with provided identifier", content = {@Content(examples = { + @ExampleObject(name = "Wallet not found with provided identifier", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 404, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "400", description = "The input does not comply to the syntax requirements", content = { + @Content(examples = { + @ExampleObject(name = "Response in case of invalid data provided", value = """ + { + "type": "about:blank", + "title": "Invalid data provided", + "status": 400, + "detail": "details", + "instance": "API endpoint", + "properties": + { + "timestamp": 1689760833962, + "errors": + { + "filed": "filed error message" + } + } + } + """) + }) + }) @ApiResponse(responseCode = "201", description = "Framework credential", content = { @Content(examples = { - @ExampleObject(name = "Framework credential", value = """ + @ExampleObject(name = "BehaviorTwin credential", value = """ { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", + "type": [ + "VerifiableCredential", + "UseCaseFrameworkCondition" + ], + "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T13:49:58Z", + "expirationDate": "2024-12-31T18:30:00Z", "credentialSubject": [ { "holderIdentifier": "BPNL000000000000", @@ -489,25 +605,178 @@ public ResponseEntity issueDismantlerCredential(@Valid @Re "contractVersion": "1.0.0" } ], + "proof": { + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#", + "created": "2023-07-19T13:50:02Z", + "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" + } + } + """), + @ExampleObject(name = "Pcf Credential", value = """ + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", + "type": [ + "VerifiableCredential", + "UseCaseFrameworkCondition" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "issuanceDate": "2023-07-19T13:49:58Z", + "expirationDate": "2024-12-31T18:30:00Z", + "credentialSubject": [ + { + "holderIdentifier": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "PcfCredential", + "contractTemplate": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", + "contractVersion": "1.0.0" + } + ], "proof": { "proofPurpose": "proofPurpose", "type": "JsonWebSignature2020", "verificationMethod": "did:web:localhost:BPNL000000000000#", "created": "2023-07-19T13:50:02Z", "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" - }, + } + } + """), + @ExampleObject(name = "Sustainability Credential", value = """ + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", + "type": [ + "VerifiableCredential", + "UseCaseFrameworkCondition" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "issuanceDate": "2023-07-19T13:49:58Z", + "expirationDate": "2024-12-31T18:30:00Z", + "credentialSubject": [ + { + "holderIdentifier": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "SustainabilityCredential", + "contractTemplate": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", + "contractVersion": "1.0.0" + } + ], + "proof": { + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#", + "created": "2023-07-19T13:50:02Z", + "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" + } + } + """), + @ExampleObject(name = "Quality Credential", value = """ + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", "type": [ "VerifiableCredential", "UseCaseFrameworkCondition" ], + "issuer": "did:web:localhost:BPNL000000000000", + "issuanceDate": "2023-07-19T13:49:58Z", + "expirationDate": "2024-12-31T18:30:00Z", + "credentialSubject": [ + { + "holderIdentifier": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "QualityCredential", + "contractTemplate": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", + "contractVersion": "1.0.0" + } + ], + "proof": { + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#", + "created": "2023-07-19T13:50:02Z", + "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" + } + } + """), + @ExampleObject(name = "Traceability Credential", value = """ + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", + "type": [ + "VerifiableCredential", + "UseCaseFrameworkCondition" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "issuanceDate": "2023-07-19T13:49:58Z", + "expirationDate": "2024-12-31T18:30:00Z", + "credentialSubject": [ + { + "holderIdentifier": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "TraceabilityCredential", + "contractTemplate": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", + "contractVersion": "1.0.0" + } + ], + "proof": { + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#", + "created": "2023-07-19T13:50:02Z", + "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" + } + } + """), + @ExampleObject(name = "Resiliency Credential", value = """ + { "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], + "id": "did:web:localhost:BPNL000000000000#46a8c5e6-b195-4ec9-85cd-665c57d296ab", + "type": [ + "VerifiableCredential", + "UseCaseFrameworkCondition" + ], "issuer": "did:web:localhost:BPNL000000000000", - "expirationDate": "2024-12-31T18:30:00Z" + "issuanceDate": "2023-07-19T13:49:58Z", + "expirationDate": "2024-12-31T18:30:00Z", + "credentialSubject": [ + { + "holderIdentifier": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "ResiliencyCredential", + "contractTemplate": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", + "contractVersion": "1.0.0" + } + ], + "proof": { + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#", + "created": "2023-07-19T13:50:02Z", + "jws": "eyJhbGciOiJFZERTQSJ9..IkfgC6Gn9sOT1uu1zMiDIIqw6pV4Z8axkKvphegsCVWT9uo0HZp4J9L1ILxR-huINGR5QlGIKiVuLGB5kKDOAQ" + } } """) }) @@ -620,19 +889,19 @@ public ResponseEntity issueFrameworkCredential(@Valid @Req @io.swagger.v3.oas.annotations.parameters.RequestBody(content = { @Content(examples = @ExampleObject(""" { - "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", "type": [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", - "expirationDate": "2024-12-31T18:30:00Z", "issuanceDate": "2023-07-19T09:11:34Z", + "expirationDate": "2024-12-31T18:30:00Z", "credentialSubject": [ { "bpn": "BPNL000000000000", @@ -680,11 +949,58 @@ public ResponseEntity> credentialsValidation(@RequestBody Ma } """) })}) + @ApiResponse(responseCode = "404", description = "Wallet not found with provided identifier", content = {@Content(examples = { + @ExampleObject(name = "Wallet not found with provided identifier", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 404, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "400", description = "The input does not comply to the syntax requirements", content = { + @Content(examples = { + @ExampleObject(name = "Response in case of invalid data provided", value = """ + { + "type": "about:blank", + "title": "Invalid data provided", + "status": 400, + "detail": "details", + "instance": "API endpoint", + "properties": + { + "timestamp": 1689760833962, + "errors": + { + "filed": "filed error message" + } + } + } + """) + }) + }) @ApiResponse(responseCode = "201", description = "Issuer credential", content = { @Content(examples = { @ExampleObject(name = "Issuer credential", value = """ { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:localhost:BPNL000000000000#ff084e7a-1b46-4a2f-a78d-3d701a0bd6e4", + "type": [ + "VerifiableCredential", + "BpnCredential" + ], + "issuer": "did:web:localhost:BPNL000000000000", "issuanceDate": "2023-07-19T12:18:30Z", + "expirationDate": "2024-12-31T18:30:00Z", "credentialSubject": [ { "bpn": "BPNL000000000000", @@ -692,25 +1008,13 @@ public ResponseEntity> credentialsValidation(@RequestBody Ma "type": "BpnCredential" } ], - "id": "did:web:localhost:BPNL000000000000#ff084e7a-1b46-4a2f-a78d-3d701a0bd6e4", "proof": { "proofPurpose": "proofPurpose", "type": "JsonWebSignature2020", "verificationMethod": "did:web:localhost:BPNL000000000000#", "created": "2023-07-19T12:18:34Z", "jws": "eyJhbGciOiJFZERTQSJ9..0Ua1vcTQAYwQY3PPuHr4RQxqW6iIngrHQQx1oPgk2uzqUpcbfY2YUxXAnbNA333-lSuvNhiV_1NLfBnCEcI2DQ" - }, - "type": [ - "VerifiableCredential", - "BpnCredential" - ], - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "expirationDate": "2024-12-31T18:30:00Z" + } } """) }) @@ -721,19 +1025,19 @@ public ResponseEntity> credentialsValidation(@RequestBody Ma @io.swagger.v3.oas.annotations.parameters.RequestBody(content = { @Content(examples = @ExampleObject(""" { - "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", "type": [ "VerifiableCredential", "BpnCredential" ], "issuer": "did:web:localhost:BPNL000000000000", - "expirationDate": "2024-12-31T18:30:00Z", "issuanceDate": "2023-07-19T09:11:34Z", + "expirationDate": "2024-12-31T18:30:00Z", "credentialSubject": [ { "bpn": "BPNL000000000000", @@ -744,7 +1048,7 @@ public ResponseEntity> credentialsValidation(@RequestBody Ma } """)) }) - public ResponseEntity issueCredentialUsingBaseWallet(@RequestParam String holderDid, @RequestBody Map data, Principal principal) { + public ResponseEntity issueCredentialUsingBaseWallet(@Parameter(description = "Holder DID", examples = {@ExampleObject(description = "did", name = "did", value = "did:web:localhost:BPNL000000000000")}) @RequestParam(name = "holderDid") String holderDid, @RequestBody Map data, Principal principal) { return ResponseEntity.status(HttpStatus.CREATED).body(issuersCredentialService.issueCredentialUsingBaseWallet(holderDid, data, getBPNFromToken(principal))); } } diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java index 415a5d0be..f3912f903 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/PresentationController.java @@ -25,6 +25,7 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.eclipse.tractusx.managedidentitywallets.constant.RestURI; @@ -62,6 +63,89 @@ public class PresentationController extends BaseController { */ @Tag(name = API_TAG_VERIFIABLE_PRESENTATIONS_GENERATION) @Operation(summary = "Create Verifiable Presentation", description = "Permission: **update_wallets** OR **update_wallet** (The BPN of the issuer of the Verifiable Presentation must equal to BPN of caller) \n\n Create a verifiable presentation from a list of verifiable credentials, signed by the holder") + @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "403", description = "The request could not be completed due to a forbidden access", content = {@Content(examples = {})}) + @ApiResponse(responseCode = "500", description = "Any other internal server error", content = {@Content(examples = { + @ExampleObject(name = "Internal server error", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 500, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "404", description = "Wallet not found with provided identifier", content = {@Content(examples = { + @ExampleObject(name = "Wallet not found with provided identifier", value = """ + { + "type": "about:blank", + "title": "Error Title", + "status": 404, + "detail": "Error Details", + "instance": "API endpoint", + "properties": { + "timestamp": 1689762476720 + } + } + """) + })}) + @ApiResponse(responseCode = "200", description = "Verifiable Presentation", content = { + @Content(examples = { + @ExampleObject(name = "VP as Json-LD", value = """ + { + "vp": { + "@context": [ + "https://www.w3.org/2018/credentials/v1" + ], + "id": "did:web:localhost:BPNL000000000000#b2e69e47-95f3-48ff-af30-eaaab36431d5", + "type": [ + "VerifiablePresentation" + ], + "verifiableCredential": [ + { + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "type": [ + "VerifiableCredential", + "BpnCredential" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z", + "issuanceDate": "2023-07-19T09:11:34Z", + "credentialSubject": [ + { + "bpn": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "BpnCredential" + } + ], + "proof": { + "created": "2023-07-19T09:11:39Z", + "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#" + } + } + ] + } + } + """), + @ExampleObject(name = "VP as JWT", value = """ + { + "vp": "eyJraWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwidHlwIjoiSldUIiwiYWxnIjoiRWREU0EifQ.eyJzdWIiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwiYXVkIjoic21hcnQiLCJpc3MiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIiwidnAiOnsiaWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwIzM4ZTU2ZTg1LTNkODQtNGEyNS1iZjg1LWFiMjRlYzY4MmMwOSIsInR5cGUiOlsiVmVyaWZpYWJsZVByZXNlbnRhdGlvbiJdLCJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ2ZXJpZmlhYmxlQ3JlZGVudGlhbCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vY2F0ZW5heC1uZy5naXRodWIuaW8vcHJvZHVjdC1jb3JlLXNjaGVtYXMvYnVzaW5lc3NQYXJ0bmVyRGF0YS5qc29uIiwiaHR0cHM6Ly93M2lkLm9yZy9zZWN1cml0eS9zdWl0ZXMvandzLTIwMjAvdjEiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIkJwbkNyZWRlbnRpYWwiXSwiaWQiOiJkaWQ6d2ViOmxvY2FsaG9zdDpCUE5MMDAwMDAwMDAwMDAwI2Y3M2UzNjMxLWJhODctNGEwMy1iZWEzLWIyODcwMDA1Njg3OSIsImlzc3VlciI6ImRpZDp3ZWI6bG9jYWxob3N0OkJQTkwwMDAwMDAwMDAwMDAiLCJpc3N1YW5jZURhdGUiOiIyMDIzLTA3LTE5VDA5OjExOjM0WiIsImV4cGlyYXRpb25EYXRlIjoiMjAyNC0xMi0zMVQxODozMDowMFoiLCJjcmVkZW50aWFsU3ViamVjdCI6eyJpZCI6ImRpZDp3ZWI6bG9jYWxob3N0OkJQTkwwMDAwMDAwMDAwMDAiLCJicG4iOiJCUE5MMDAwMDAwMDAwMDAwIiwidHlwZSI6IkJwbkNyZWRlbnRpYWwifSwicHJvb2YiOnsicHJvb2ZQdXJwb3NlIjoicHJvb2ZQdXJwb3NlIiwidHlwZSI6Ikpzb25XZWJTaWduYXR1cmUyMDIwIiwidmVyaWZpY2F0aW9uTWV0aG9kIjoiZGlkOndlYjpsb2NhbGhvc3Q6QlBOTDAwMDAwMDAwMDAwMCMiLCJjcmVhdGVkIjoiMjAyMy0wNy0xOVQwOToxMTozOVoiLCJqd3MiOiJleUpoYkdjaU9pSkZaRVJUUVNKOS4uZmRuMnFVODVhdU9sdGRIRExkSEk3c0pWVjFaUGRmdHBpWGRfbmRYTjBkRmdTRFdpSXJTY2REMDN3dHZLTHFfSC1zaFFXZmgyUlllTW1ybEV6QWhmRHcifX19LCJleHAiOjE2ODk4MzQ4MDUsImp0aSI6ImIwODYzOWZiLWQ5MWEtNGUwZS1iNmY4LTYzYjdhMzQ1ZTRhZiJ9.80x0AB-OauefdeZfx1cwhitdVKRvCRFeFzYwU73DL7y4w34vu6BdfHWLBGjkwELxkQEoFfiTPOqtuyqhtsyDBg" + } + """) + }) + }) @PostMapping(path = RestURI.API_PRESENTATIONS, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @io.swagger.v3.oas.annotations.parameters.RequestBody(content = { @@ -120,6 +204,66 @@ public ResponseEntity> createPresentation(@RequestBody Map Date: Thu, 20 Jul 2023 15:00:22 +0530 Subject: [PATCH 07/14] docs: CGD-391: Sample response added for API, code refactor as per sonar --- .../HoldersCredentialController.java | 212 +++++++-------- .../IssuersCredentialController.java | 164 ++++++++++-- .../controller/WalletController.java | 246 +++++++++--------- .../service/HoldersCredentialService.java | 4 +- .../service/IssuersCredentialService.java | 4 +- .../service/PresentationService.java | 12 +- .../vc/MembershipHoldersCredentialTest.java | 2 +- .../vc/PresentationValidationTest.java | 50 ++-- 8 files changed, 418 insertions(+), 276 deletions(-) diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java index 941c498ab..0d42b3694 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java @@ -118,84 +118,84 @@ public class HoldersCredentialController extends BaseController { @ApiResponse(responseCode = "200", description = "Credential list", content = { @Content(examples = { @ExampleObject(name = "Credential list", value = """ - { - "content": - [ - { - "credentialSubject": - [ - { - "contractTemplate": "https://public.catena-x.org/contracts/", - "holderIdentifier": "BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000", - "items": - [ - "BpnCredential" - ], - "type": "SummaryCredential" - } - ], - "issuanceDate": "2023-07-14T11:05:48Z", - "id": "did:web:localhost:BPNL000000000000#954d43de-ebed-481d-9e35-e3bbb311b8f5", - "proof": - { - "created": "2023-07-14T11:05:50Z", - "jws": "eyJhbGciOiJFZERTQSJ9..4xwFUCtP0xXVEo5_lXd90Vv-TWO2FijZut-HZ5cozAQseexj8EpTkK1erhFbf2Ua1kb8pi_H5At5HiPkTxSIAQ", - "proofPurpose": "proofPurpose", - "type": "JsonWebSignature2020", - "verificationMethod": "did:web:localhost:BPNL000000000000#" - }, - "type": - [ - "VerifiableCredential", - "SummaryCredential" - ], - "@context": - [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/SummaryVC.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "expirationDate": "2023-09-30T18:30:00Z" - } - ], - "pageable": - { - "sort": - { - "empty": false, - "sorted": true, - "unsorted": false - }, - "offset": 0, - "pageNumber": 0, - "pageSize": 2147483647, - "paged": true, - "unpaged": false - }, - "totalElements": 1, - "totalPages": 1, - "last": true, - "size": 2147483647, - "number": 0, - "sort": - { - "empty": false, - "sorted": true, - "unsorted": false - }, - "first": true, - "numberOfElements": 1, - "empty": false - } + { + "content": + [ + { + "@context": + [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/SummaryVC.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:localhost:BPNL000000000000#954d43de-ebed-481d-9e35-e3bbb311b8f5", + "type": + [ + "VerifiableCredential", + "SummaryCredential" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "issuanceDate": "2023-07-14T11:05:48Z", + "expirationDate": "2023-09-30T18:30:00Z", + "credentialSubject": + [ + { + "contractTemplate": "https://public.catena-x.org/contracts/", + "holderIdentifier": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "items": + [ + "BpnCredential" + ], + "type": "SummaryCredential" + } + ], + "proof": + { + "created": "2023-07-14T11:05:50Z", + "jws": "eyJhbGciOiJFZERTQSJ9..4xwFUCtP0xXVEo5_lXd90Vv-TWO2FijZut-HZ5cozAQseexj8EpTkK1erhFbf2Ua1kb8pi_H5At5HiPkTxSIAQ", + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#" + } + } + ], + "pageable": + { + "sort": + { + "empty": false, + "sorted": true, + "unsorted": false + }, + "offset": 0, + "pageNumber": 0, + "pageSize": 2147483647, + "paged": true, + "unpaged": false + }, + "totalElements": 1, + "totalPages": 1, + "last": true, + "size": 2147483647, + "number": 0, + "sort": + { + "empty": false, + "sorted": true, + "unsorted": false + }, + "first": true, + "numberOfElements": 1, + "empty": false + } """) }) }) @Operation(description = "Permission: **view_wallets** OR **view_wallet** (The BPN of holderIdentifier must equal BPN of caller)\n\n Search verifiable credentials with filter criteria", summary = "Query Verifiable Credentials") @GetMapping(path = RestURI.CREDENTIALS, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity> getCredentials(@Parameter(name = "credentialId", description = "Credential Id", examples = {@ExampleObject(name = "Credential Id", value = "did:web:localhost:BPNL000000000000#12528899-160a-48bd-ba15-f396c3959ae9")}) @RequestParam(required = false) String credentialId, - @Parameter(name = "issuerIdentifier", description = "Issuer identifier(did of BPN)", examples = {@ExampleObject(name = "bpn", value = "BPNL000000000501", description = "bpn"), @ExampleObject(description = "did", name = "did", value = "did:web:localhost:BPNL000000000501")}) @RequestParam(required = false) String issuerIdentifier, + @Parameter(name = "issuerIdentifier", description = "Issuer identifier(did of BPN)", examples = {@ExampleObject(name = "bpn", value = "BPNL000000000000", description = "bpn"), @ExampleObject(description = "did", name = "did", value = "did:web:localhost:BPNL000000000000")}) @RequestParam(required = false) String issuerIdentifier, @Parameter(name = "type", description = "Type of VC", examples = {@ExampleObject(name = "SummaryCredential", value = "SummaryCredential", description = "SummaryCredential"), @ExampleObject(description = "BpnCredential", name = "BpnCredential", value = "BpnCredential")}) @RequestParam(required = false) List type, @Parameter(name = "sortColumn", description = "Sort column name", examples = { @@ -224,37 +224,41 @@ public ResponseEntity> getCredentials(@Parameter( */ @ApiResponse(responseCode = "201", description = "Success Response", content = {@Content(examples = { @ExampleObject(name = "Success Response", value = """ - { - "issuanceDate": "2023-07-19T13:41:52Z", - "credentialSubject": [ - { - "bpn": "BPNL000000000000", - "bankName": "Dummy Bank", - "id": "did:web:localhost:BPNL000000000000", - "type": "BankDetails", - "accountNumber": "123456789" - } - ], - "id": "did:web:localhost:BPNL000000000000#319a2641-9407-4c39-bf51-a4a109b59604", - "proof": { - "proofPurpose": "proofPurpose", - "verificationMethod": "did:web:localhost:BPNL000000000000#", - "type": "JsonWebSignature2020", - "created": "2023-07-19T13:41:54Z", - "jws": "eyJhbGciOiJFZERTQSJ9..fdqaAsPhQ5xZhQiRvWliDVXX-R9NzCvFXGUAOyQ8yE1hmf_4cvxS7JFuEojjsi3V-n66iiRCUFEXsnv56XPgDA" - }, - "type": [ - "VerifiableCredential", - "BankDetails" - ], - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "issuer": "did:web:localhost:BPNL000000000000", - "expirationDate": "2024-12-31T18:30:00Z" - } + { + "@context": + [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:localhost:BPNL000000000000#319a2641-9407-4c39-bf51-a4a109b59604", + "type": + [ + "VerifiableCredential", + "BankDetails" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "issuanceDate": "2023-07-19T13:41:52Z", + "expirationDate": "2024-12-31T18:30:00Z", + "credentialSubject": + [ + { + "bpn": "BPNL000000000000", + "bankName": "Dummy Bank", + "id": "did:web:localhost:BPNL000000000000", + "type": "BankDetails", + "accountNumber": "123456789" + } + ], + "proof": + { + "proofPurpose": "proofPurpose", + "verificationMethod": "did:web:localhost:BPNL000000000000#", + "type": "JsonWebSignature2020", + "created": "2023-07-19T13:41:54Z", + "jws": "eyJhbGciOiJFZERTQSJ9..fdqaAsPhQ5xZhQiRvWliDVXX-R9NzCvFXGUAOyQ8yE1hmf_4cvxS7JFuEojjsi3V-n66iiRCUFEXsnv56XPgDA" + } + } """) })}) @ApiResponse(responseCode = "404", description = "Wallet not found with caller BPN", content = {@Content(examples = { @@ -313,12 +317,12 @@ public ResponseEntity> getCredentials(@Parameter( @io.swagger.v3.oas.annotations.parameters.RequestBody(content = { @Content(examples = @ExampleObject(""" { - "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", "@context": [ "https://www.w3.org/2018/credentials/v1", "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", "https://w3id.org/security/suites/jws-2020/v1" ], + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", "type": [ "VerifiableCredential", "BankDetails" diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java index 6866f9752..474814e72 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java @@ -243,13 +243,20 @@ public class IssuersCredentialController extends BaseController { }) @Operation(description = "Permission: **view_wallets** (The BPN of holderIdentifier must equal BPN of caller)\n\n Search verifiable credentials with filter criteria", summary = "Query Verifiable Credentials") @GetMapping(path = RestURI.ISSUERS_CREDENTIALS, produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity> getCredentials(@RequestParam(required = false) String credentialId, - @RequestParam(required = false) String holderIdentifier, - @RequestParam(required = false) List type, + public ResponseEntity> getCredentials(@Parameter(name = "credentialId", description = "Credential Id", examples = {@ExampleObject(name = "Credential Id", value = "did:web:localhost:BPNL000000000000#12528899-160a-48bd-ba15-f396c3959ae9")}) @RequestParam(required = false) String credentialId, + @Parameter(name = "holderIdentifier", description = "Holder identifier(did of BPN)", examples = {@ExampleObject(name = "bpn", value = "BPNL000000000001", description = "bpn"), @ExampleObject(description = "did", name = "did", value = "did:web:localhost:BPNL000000000001")}) @RequestParam(required = false) String holderIdentifier, + @Parameter(name = "type", description = "Type of VC", examples = {@ExampleObject(name = "SummaryCredential", value = "SummaryCredential", description = "SummaryCredential"), @ExampleObject(description = "BpnCredential", name = "BpnCredential", value = "BpnCredential")}) @RequestParam(required = false) List type, @Min(0) @Max(Integer.MAX_VALUE) @Parameter(description = "Page number, Page number start with zero") @RequestParam(required = false, defaultValue = "0") int pageNumber, @Min(0) @Max(Integer.MAX_VALUE) @Parameter(description = "Number of records per page") @RequestParam(required = false, defaultValue = Integer.MAX_VALUE + "") int size, - @RequestParam(required = false, defaultValue = "createdAt") String sortColumn, - @RequestParam(required = false, defaultValue = "desc") String sortTpe, Principal principal) { + @Parameter(name = "sortColumn", description = "Sort column name", + examples = { + @ExampleObject(value = "createdAt", name = "creation date"), + @ExampleObject(value = "holderDid", name = "Holder did"), + @ExampleObject(value = "type", name = "Credential type"), + @ExampleObject(value = "credentialId", name = "Credential id") + } + ) @RequestParam(required = false, defaultValue = "createdAt") String sortColumn, + @Parameter(name = "sortTpe", description = "Sort order", examples = {@ExampleObject(value = "desc", name = "Descending order"), @ExampleObject(value = "asc", name = "Ascending order")}) @RequestParam(required = false, defaultValue = "desc") String sortTpe, Principal principal) { return ResponseEntity.status(HttpStatus.OK).body(issuersCredentialService.getCredentials(credentialId, holderIdentifier, type, sortColumn, sortTpe, pageNumber, size, getBPNFromToken(principal))); } @@ -516,16 +523,70 @@ public ResponseEntity issueDismantlerCredential(@Valid @Re * @param principal the principal * @return the response entity */ - @io.swagger.v3.oas.annotations.parameters.RequestBody(content = { - @Content(examples = @ExampleObject(""" - { - "holderIdentifier": "BPNL000000000000", - "type": "BehaviorTwinCredential", - "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", - "contract-version": "1.0.0" - } - """)) - }) + + @io.swagger.v3.oas.annotations.parameters.RequestBody( + content = { + @Content(examples = { + @ExampleObject(name = "BehaviorTwinCredential", value = """ + { + "holderIdentifier": "BPNL000000000000", + "type": "BehaviorTwinCredential", + "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", + "contract-version": "1.0.0" + } + """), + @ExampleObject(name = "PcfCredential", value = """ + { + "holderIdentifier": "BPNL000000000000", + "type": "PcfCredential", + "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", + "contract-version": "1.0.0" + } + """), + @ExampleObject(name = "SustainabilityCredential", value = """ + { + "holderIdentifier": "BPNL000000000000", + "type": "SustainabilityCredential", + "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", + "contract-version": "1.0.0" + } + """), + @ExampleObject(name = "QualityCredential", value = """ + { + "holderIdentifier": "BPNL000000000000", + "type": "QualityCredential", + "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", + "contract-version": "1.0.0" + } + """), + @ExampleObject(name = "TraceabilityCredential", value = """ + { + "holderIdentifier": "BPNL000000000000", + "type": "TraceabilityCredential", + "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", + "contract-version": "1.0.0" + } + """), + @ExampleObject(name = "BehaviorTwinCredential", value = """ + { + "holderIdentifier": "BPNL000000000000", + "type": "BehaviorTwinCredential", + "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", + "contract-version": "1.0.0" + } + """), + @ExampleObject(name = "ResiliencyCredential", value = """ + { + "holderIdentifier": "BPNL000000000000", + "type": "ResiliencyCredential", + "contract-template": "https://public.catena-x.org/contracts/traceabilty.v1.pdf", + "contract-version": "1.0.0" + } + """) + + }) + } + ) @Tag(name = API_TAG_VERIFIABLE_CREDENTIAL_ISSUER) @Operation(summary = "Issue a Use Case Verifiable Credential with base wallet issuer", description = "Permission: **update_wallets** (The BPN of base wallet must equal BPN of caller)\n\n Issue a verifiable credential by base wallet") @ApiResponse(responseCode = "401", description = "The request could not be completed due to a failed authorization.", content = {@Content(examples = {})}) @@ -849,6 +910,7 @@ public ResponseEntity issueFrameworkCredential(@Valid @Req @ExampleObject(name = "Verifiable Credentials with check expiry", value = """ { "valid": true, + "validateExpiryDate": true, "vc": { "issuanceDate": "2023-07-19T09:11:34Z", "credentialSubject": [ @@ -877,8 +939,76 @@ public ResponseEntity issueFrameworkCredential(@Valid @Req ], "issuer": "did:web:localhost:BPNL000000000000", "expirationDate": "2024-12-31T18:30:00Z" - }, - "validateExpiryDate": true + } + } + """), + @ExampleObject(name = "Verifiable expired credentials with check expiry ", value = """ + { + "valid": false, + "validateExpiryDate": false, + "vc": { + "issuanceDate": "2023-07-19T09:11:34Z", + "credentialSubject": [ + { + "bpn": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "BpnCredential" + } + ], + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", + "proof": { + "created": "2023-07-19T09:11:39Z", + "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhfDw", + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#" + }, + "type": [ + "VerifiableCredential", + "BpnCredential" + ], + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2022-12-31T18:30:00Z" + } + } + """), + @ExampleObject(name = "Verifiable Credentials with invalid signature", value = """ + { + "valid": false, + "vc": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://catenax-ng.github.io/product-core-schemas/businessPartnerData.json", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:localhost:BPNL000000000000#f73e3631-ba87-4a03-bea3-b28700056879", + "type": [ + "VerifiableCredential", + "BpnCredential" + ], + "issuer": "did:web:localhost:BPNL000000000000", + "expirationDate": "2024-12-31T18:30:00Z" + "issuanceDate": "2023-07-19T09:11:34Z", + "credentialSubject": [ + { + "bpn": "BPNL000000000000", + "id": "did:web:localhost:BPNL000000000000", + "type": "BpnCredential" + } + ], + "proof": { + "created": "2023-07-19T09:11:39Z", + "jws": "eyJhbGciOiJFZERTQSJ9..fdn2qU85auOltdHDLdHI7sJVV1ZPdftpiXd_ndXN0dFgSDWiIrScdD03wtvKLq_H-shQWfh2RYeMmrlEzAhf", + "proofPurpose": "proofPurpose", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:localhost:BPNL000000000000#" + }, + } } """) }) diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/WalletController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/WalletController.java index 09d1b6cfb..1ad61c46e 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/WalletController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/WalletController.java @@ -124,30 +124,34 @@ public class WalletController extends BaseController { @Content(examples = { @ExampleObject(name = "Success response", value = """ { - "name": "companyA", - "did": "did:web:localhost:BPNL000000000501", - "bpn": "BPNL000000000501", - "algorithm": "ED25519", - "didDocument": { - "id": "did:web:localhost:BPNL000000000501", - "verificationMethod": [ - { - "controller": "did:web:localhost:BPNL000000000501", - "id": "did:web:localhost:BPNL000000000501#", - "publicKeyJwk": { - "crv": "Ed25519", - "kty": "OKP", - "x": "0Ap6FsX5UuRBIoOzxWtcFA2ymnqXw0U08Ino_mIuYM4" - }, - "type": "JsonWebKey2020" - } - ], - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3c.github.io/vc-jws-2020/contexts/v1" - ] - } - } + "name": "companyA", + "did": "did:web:localhost:BPNL000000000001", + "bpn": "BPNL000000000501", + "algorithm": "ED25519", + "didDocument": + { + "@context": + [ + "https://www.w3.org/ns/did/v1", + "https://w3c.github.io/vc-jws-2020/contexts/v1" + ], + "id": "did:web:localhost:BPNL000000000001", + "verificationMethod": + [ + { + "controller": "did:web:localhost:BPNL000000000001", + "id": "did:web:localhost:BPNL000000000001#", + "publicKeyJwk": + { + "crv": "Ed25519", + "kty": "OKP", + "x": "0Ap6FsX5UuRBIoOzxWtcFA2ymnqXw0U08Ino_mIuYM4" + }, + "type": "JsonWebKey2020" + } + ] + } + } """) }) }) @@ -175,18 +179,18 @@ public ResponseEntity createWallet(@Valid @RequestBody CreateWalletReque "https://www.w3.org/2018/credentials/v1", "https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#" ], + "id": "did:web:localhost.in#123456789", "type": [ - "LegalParticipant","VerifiableCredential" + "VerifiableCredential", "LegalParticipant" ], - "id": "did:web:hella.proofsense.in", - "issuer": "did:web:hella.proofsense.in", + "issuer": "did:web:localhost.in", "issuanceDate": "2023-05-04T07:36:03.633Z", "credentialSubject": { - "id": "https://hella.proofsense.in/.well-known/participant.json", + "id": "https://localhost/.well-known/participant.json", "type": "gx:LegalParticipant", - "gx:legalName": "Hella", + "gx:legalName": "Sample Company", "gx:legalRegistrationNumber": { "gx:taxID": "113123123" @@ -206,7 +210,7 @@ public ResponseEntity createWallet(@Valid @RequestBody CreateWalletReque "type": "JsonWebSignature2020", "created": "2023-05-04T07:36:04.079Z", "proofPurpose": "assertionMethod", - "verificationMethod": "did:web:hella.proofsense.in", + "verificationMethod": "did:web:localhost", "jws": "eyJhbGciOiJQUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..iHki8WC3nPfcSRkC_AV4tXh0ikfT7BLPTGc_0ecI8zontTmJLqwcpPfAt0PFsoo3SkZgc6j636z55jj5tagBc-OKoiDu7diWryNAnL9ASsmWJyrPhOKVARs6x6PxVaTFBuyCfAHZeipxmkcYfNB_jooIXO2HuRcL2odhsQHELkGc5IDD-aBMWyNpfVAaYQ-cCzvDflZQlsowziUKfMkBfwpwgMdXFIgKWYdDIRvzA-U-XiC11-6QV7tPeKsMguEU0F5bh8cCEm2rooqXtENcsM_7cqFdQoOyblJyM-agoz2LUTj9QIdn9_gnNkGN-2U7_qBJWmHkK1Hm_mHqcNeeQw" } } @@ -252,9 +256,9 @@ public ResponseEntity createWallet(@Valid @RequestBody CreateWalletReque @ExampleObject(name = "Wallet not found with provided identifier", value = """ { "type": "about:blank", - "title": "Wallet not found for identifier did:web:localhost:BPNL0000000", + "title": "Wallet not found for identifier did:web:localhost:BPNL000000044001", "status": 404, - "detail": "Wallet not found for identifier did:web:localhost:BPNL0000000", + "detail": "Wallet not found for identifier did:web:localhost:BPNL000000044001", "instance": "/api/wallets/did%3Aweb%3Alocalhost%3ABPNL0000000/credentials", "properties": { "timestamp": 1689765541959 @@ -265,12 +269,12 @@ public ResponseEntity createWallet(@Valid @RequestBody CreateWalletReque @ApiResponse(responseCode = "201", description = "Success Response", content = {@Content(examples = { @ExampleObject(name = "Success Response", value = """ { - "message": "Credential with id did:web:localhost has been successfully stored" + "message": "Credential with id did:web:localhost#123456789 has been successfully stored" } """) })}) public ResponseEntity> storeCredential(@RequestBody Map data, - @Parameter(description = "Did or BPN", examples = {@ExampleObject(name = "bpn", value = "BPNL000000000000", description = "bpn"), @ExampleObject(description = "did", name = "did", value = "did:web:localhost:BPNL000000000000")}) @PathVariable(name = "identifier") String identifier, Principal principal) { + @Parameter(description = "Did or BPN", examples = {@ExampleObject(name = "bpn", value = "BPNL000000000001", description = "bpn"), @ExampleObject(description = "did", name = "did", value = "did:web:localhost:BPNL000000000001")}) @PathVariable(name = "identifier") String identifier, Principal principal) { return ResponseEntity.status(HttpStatus.CREATED).body(service.storeCredential(data, identifier, getBPNFromToken(principal))); } @@ -339,97 +343,101 @@ public ResponseEntity> storeCredential(@RequestBody Map getWalletByIdentifier(@Parameter(description = "Did or BPN", examples = {@ExampleObject(name = "bpn", value = "BPNL000000000501", description = "bpn"), @ExampleObject(description = "did", name = "did", value = "did:web:localhost:BPNL000000000501")}) @PathVariable(name = "identifier") String identifier, + public ResponseEntity getWalletByIdentifier(@Parameter(description = "Did or BPN", examples = {@ExampleObject(name = "bpn", value = "BPNL000000000001", description = "bpn"), @ExampleObject(description = "did", name = "did", value = "did:web:localhost:BPNL000000000001")}) @PathVariable(name = "identifier") String identifier, @RequestParam(name = "withCredentials", defaultValue = "false") boolean withCredentials, Principal principal) { return ResponseEntity.status(HttpStatus.OK).body(service.getWalletByIdentifier(identifier, withCredentials, getBPNFromToken(principal))); @@ -487,6 +495,10 @@ public ResponseEntity getWalletByIdentifier(@Parameter(description = "Di "bpn": "BPNL000000000001", "algorithm": "ED25519", "didDocument": { + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://w3c.github.io/vc-jws-2020/contexts/v1" + ], "id": "did:web:localhost:BPNL000000000001", "verificationMethod": [ { @@ -499,10 +511,6 @@ public ResponseEntity getWalletByIdentifier(@Parameter(description = "Di }, "type": "JsonWebKey2020" } - ], - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3c.github.io/vc-jws-2020/contexts/v1" ] } } diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/HoldersCredentialService.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/HoldersCredentialService.java index 356bcd1a1..3944bd6e9 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/HoldersCredentialService.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/HoldersCredentialService.java @@ -105,11 +105,11 @@ public PageImpl getCredentials(String credentialId, String //Holder must be caller of API Wallet holderWallet = commonService.getWalletByIdentifier(callerBPN); - filterRequest.appendCriteria(StringPool.HOLDER_DID, Operator.EQUALS, holderWallet.getDid().toString()); + filterRequest.appendCriteria(StringPool.HOLDER_DID, Operator.EQUALS, holderWallet.getDid()); if (StringUtils.hasText(issuerIdentifier)) { Wallet issuerWallet = commonService.getWalletByIdentifier(issuerIdentifier); - filterRequest.appendCriteria(StringPool.ISSUER_DID, Operator.EQUALS, issuerWallet.getDid().toString()); + filterRequest.appendCriteria(StringPool.ISSUER_DID, Operator.EQUALS, issuerWallet.getDid()); } if (StringUtils.hasText(credentialId)) { diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java index 3f2309c33..e561f57d7 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java @@ -448,10 +448,10 @@ public Map credentialsValidation(Map data, boole boolean valid = proofValidation.verifiyProof(verifiableCredential); - Map response = new HashMap<>(); + Map response = new TreeMap<>(); //check expiry - boolean dateValidation = commonService.validateExpiry(withCredentialExpiryDate, verifiableCredential, response); + boolean dateValidation = CommonService.validateExpiry(withCredentialExpiryDate, verifiableCredential, response); response.put(StringPool.VALID, valid && dateValidation); response.put("vc", verifiableCredential); 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 296b64fd0..a5d4ac6fb 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/PresentationService.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/PresentationService.java @@ -191,7 +191,7 @@ public Map validatePresentation(Map vp, boolean boolean validCredential = true; boolean validateExpiryDate = true; try { - final ObjectMapper mapper = new ObjectMapper(); + ObjectMapper mapper = new ObjectMapper(); Map claims = mapper.readValue(signedJWT.getPayload().toBytes(), Map.class); String vpClaim = mapper.writeValueAsString(claims.get("vp")); @@ -199,7 +199,7 @@ public Map validatePresentation(Map vp, boolean VerifiablePresentation presentation = jsonLdSerializer.deserializePresentation(new SerializedVerifiablePresentation(vpClaim)); for (VerifiableCredential credential : presentation.getVerifiableCredentials()) { - validateExpiryDate = commonService.validateExpiry(withCredentialExpiryDate, credential, response); + validateExpiryDate = CommonService.validateExpiry(withCredentialExpiryDate, credential, response); if (!validateCredential(credential)) { validCredential = false; } @@ -265,12 +265,12 @@ private boolean validateAudience(String audience, SignedJWT signedJWT) { private boolean validateCredential(VerifiableCredential credential) throws UnsupportedSignatureTypeException { - final DidDocumentResolverRegistry didDocumentResolverRegistry = new DidDocumentResolverRegistryImpl(); + DidDocumentResolverRegistry didDocumentResolverRegistry = new DidDocumentResolverRegistryImpl(); didDocumentResolverRegistry.register( new DidWebDocumentResolver(HttpClient.newHttpClient(), new DidWebParser(), miwSettings.enforceHttps())); - final String proofType = credential.getProof().getType(); - final LinkedDataProofValidation linkedDataProofValidation; + String proofType = credential.getProof().getType(); + LinkedDataProofValidation linkedDataProofValidation; if (SignatureType.ED21559.toString().equals(proofType)) { linkedDataProofValidation = LinkedDataProofValidation.newInstance( SignatureType.ED21559, @@ -285,7 +285,7 @@ private boolean validateCredential(VerifiableCredential credential) throw new UnsupportedSignatureTypeException(proofType); } - final boolean isValid = linkedDataProofValidation.verifiyProof(credential); + boolean isValid = linkedDataProofValidation.verifiyProof(credential); if (isValid) { log.debug("Credential validation result: (valid: {}, credential-id: {})", isValid, credential.getId()); } else { diff --git a/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/MembershipHoldersCredentialTest.java b/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/MembershipHoldersCredentialTest.java index 4669fadbc..c68e14d4d 100644 --- a/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/MembershipHoldersCredentialTest.java +++ b/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/MembershipHoldersCredentialTest.java @@ -354,6 +354,6 @@ private VerifiableCredential getVerifiableCredential(ResponseEntity resp private void validateTypes(VerifiableCredential verifiableCredential) { Assertions.assertTrue(verifiableCredential.getTypes().contains(MIWVerifiableCredentialType.MEMBERSHIP_CREDENTIAL)); - Assertions.assertEquals(verifiableCredential.getCredentialSubject().get(0).get(StringPool.MEMBER_OF), "Test-X"); + Assertions.assertEquals("Test-X", verifiableCredential.getCredentialSubject().get(0).get(StringPool.MEMBER_OF)); } } diff --git a/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java b/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java index f9b10a9b8..50753dfae 100644 --- a/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java +++ b/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/PresentationValidationTest.java @@ -62,7 +62,7 @@ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = {ManagedIdentityWalletsApplication.class}) @ContextConfiguration(initializers = {TestContextInitializer.class}) @Disabled("Disabled until Membership Credentials are Json-LD compliant") -public class PresentationValidationTest { +class PresentationValidationTest { private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); @@ -89,23 +89,23 @@ public class PresentationValidationTest { public void setup() { bpnOperator = miwSettings.authorityWalletBpn(); - final CreateWalletRequest createWalletRequest = new CreateWalletRequest(); + CreateWalletRequest createWalletRequest = new CreateWalletRequest(); createWalletRequest.setBpn(bpnTenant_1); createWalletRequest.setName("My Test Tenant Wallet"); - final Wallet tenantWallet = walletService.createWallet(createWalletRequest); + Wallet tenantWallet = walletService.createWallet(createWalletRequest); tenant_1 = DidParser.parse(tenantWallet.getDid()); - final CreateWalletRequest createWalletRequest2 = new CreateWalletRequest(); + CreateWalletRequest createWalletRequest2 = new CreateWalletRequest(); createWalletRequest2.setBpn(bpnTenant_2); createWalletRequest2.setName("My Test Tenant Wallet"); - final Wallet tenantWallet2 = walletService.createWallet(createWalletRequest2); + Wallet tenantWallet2 = walletService.createWallet(createWalletRequest2); tenant_2 = DidParser.parse(tenantWallet2.getDid()); - final IssueMembershipCredentialRequest issueMembershipCredentialRequest = new IssueMembershipCredentialRequest(); + IssueMembershipCredentialRequest issueMembershipCredentialRequest = new IssueMembershipCredentialRequest(); issueMembershipCredentialRequest.setBpn(bpnTenant_1); membershipCredential_1 = issuersCredentialService.issueMembershipCredential(issueMembershipCredentialRequest, bpnOperator); - final IssueMembershipCredentialRequest issueMembershipCredentialRequest2 = new IssueMembershipCredentialRequest(); + IssueMembershipCredentialRequest issueMembershipCredentialRequest2 = new IssueMembershipCredentialRequest(); issueMembershipCredentialRequest2.setBpn(bpnTenant_2); membershipCredential_2 = issuersCredentialService.issueMembershipCredential(issueMembershipCredentialRequest2, bpnOperator); } @@ -127,49 +127,49 @@ public void cleanUp(){ } @Test - public void testSuccessfulValidation() { - final Map presentation = createPresentationJwt(membershipCredential_1, tenant_1); + void testSuccessfulValidation() { + Map presentation = createPresentationJwt(membershipCredential_1, tenant_1); VerifiablePresentationValidationResponse response = validateJwtOfCredential(presentation); Assertions.assertTrue(response.valid); } @Test - public void testValidationFailureOfCredentialWitInvalidExpirationDate() { + void testValidationFailureOfCredentialWitInvalidExpirationDate() { // test is related to this old issue where the signature check still succeeded // https://github.com/eclipse-tractusx/SSI-agent-lib/issues/4 - final VerifiableCredential copyCredential = new VerifiableCredential(membershipCredential_1); + VerifiableCredential copyCredential = new VerifiableCredential(membershipCredential_1); // e.g. an attacker tries to extend the validity of a verifiable credential copyCredential.put(VerifiableCredential.EXPIRATION_DATE, "2500-09-30T22:00:00Z"); - final Map presentation = createPresentationJwt(copyCredential, tenant_1); + Map presentation = createPresentationJwt(copyCredential, tenant_1); VerifiablePresentationValidationResponse response = validateJwtOfCredential(presentation); Assertions.assertFalse(response.valid); } @Test @SneakyThrows - public void testValidationFailureOfPresentationPayloadManipulation() { - final Map presentation = createPresentationJwt(membershipCredential_1, tenant_1); + void testValidationFailureOfPresentationPayloadManipulation() { + Map presentation = createPresentationJwt(membershipCredential_1, tenant_1); - final String jwt = (String) presentation.get(StringPool.VP); - final String payload = jwt.split("\\.")[1]; + String jwt = (String) presentation.get(StringPool.VP); + String payload = jwt.split("\\.")[1]; Base64.Decoder decoder = Base64.getUrlDecoder(); Base64.Encoder encoder = Base64.getUrlEncoder(); - final byte[] payloadDecoded = decoder.decode(payload); - final Map payloadMap = OBJECT_MAPPER.readValue(payloadDecoded, Map.class); + byte[] payloadDecoded = decoder.decode(payload); + Map payloadMap = OBJECT_MAPPER.readValue(payloadDecoded, Map.class); // replace with credential of another tenant - final VerifiablePresentation newPresentation = new VerifiablePresentationBuilder() + VerifiablePresentation newPresentation = new VerifiablePresentationBuilder() .context(List.of(VerifiablePresentation.DEFAULT_CONTEXT)) .id(URI.create(UUID.randomUUID().toString())) .type(List.of(VerifiablePresentationType.VERIFIABLE_PRESENTATION)) .verifiableCredentials(List.of(membershipCredential_2)) .build(); payloadMap.put("vp", newPresentation); - final String newPayloadJson = OBJECT_MAPPER.writeValueAsString(payloadMap); - final String newPayloadEncoded = encoder.encodeToString(newPayloadJson.getBytes()); + String newPayloadJson = OBJECT_MAPPER.writeValueAsString(payloadMap); + String newPayloadEncoded = encoder.encodeToString(newPayloadJson.getBytes()); - final String newJwt = jwt.split("\\.")[0] + "." + newPayloadEncoded + "." + jwt.split("\\.")[2]; + String newJwt = jwt.split("\\.")[0] + "." + newPayloadEncoded + "." + jwt.split("\\.")[2]; VerifiablePresentationValidationResponse response = validateJwtOfCredential(Map.of( StringPool.VP, newJwt @@ -180,11 +180,11 @@ public void testValidationFailureOfPresentationPayloadManipulation() { @SneakyThrows private VerifiablePresentationValidationResponse validateJwtOfCredential(Map presentationJwt) { - final HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()); + HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(miwSettings.authorityWalletBpn()); headers.set("Content-Type", "application/json"); - final HttpEntity entity = new HttpEntity<>(presentationJwt, headers); + HttpEntity entity = new HttpEntity<>(presentationJwt, headers); - final ResponseEntity response = restTemplate.exchange(RestURI.API_PRESENTATIONS_VALIDATION + "?asJwt=true", HttpMethod.POST, entity, String.class); + ResponseEntity response = restTemplate.exchange(RestURI.API_PRESENTATIONS_VALIDATION + "?asJwt=true", HttpMethod.POST, entity, String.class); if (response.getStatusCode().is2xxSuccessful()) { return OBJECT_MAPPER.readValue(response.getBody(), VerifiablePresentationValidationResponse.class); From d85cfa9a9dfac4355b47f04844a28eb144eced56 Mon Sep 17 00:00:00 2001 From: Nitin <45592624+nitin-vavdiya@users.noreply.github.com> Date: Wed, 26 Jul 2023 14:18:16 +0530 Subject: [PATCH 08/14] Update src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java Co-authored-by: Maximilian Schmidt (ZF Friedrichshafen AG) <104348964+maximilianschmidt-zf@users.noreply.github.com> --- .../controller/DidDocumentController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java index f37ce855d..164ea9c96 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java @@ -93,7 +93,7 @@ public class DidDocumentController { "verificationMethod": [ { "controller": "did:web:localhost:BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000#", + "id": "did:web:localhost:BPNL000000000000", "publicKeyJwk": { "crv": "Ed25519", "kty": "OKP", From a39ff1c7171e048e3393fc090710f1c58aa53b04 Mon Sep 17 00:00:00 2001 From: Nitin <45592624+nitin-vavdiya@users.noreply.github.com> Date: Wed, 26 Jul 2023 14:18:23 +0530 Subject: [PATCH 09/14] Update src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java Co-authored-by: Maximilian Schmidt (ZF Friedrichshafen AG) <104348964+maximilianschmidt-zf@users.noreply.github.com> --- .../controller/DidDocumentController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java index 164ea9c96..bc3331a39 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/DidDocumentController.java @@ -158,7 +158,7 @@ public ResponseEntity getDidDocument(@Parameter(description = "Did "verificationMethod": [ { "controller": "did:web:localhost:BPNL000000000000", - "id": "did:web:localhost:BPNL000000000000#", + "id": "did:web:localhost:BPNL000000000000", "publicKeyJwk": { "crv": "Ed25519", "kty": "OKP", From 85785dc0888c58a141c2a307d69a093aff5397d2 Mon Sep 17 00:00:00 2001 From: Nitin Vavdiya Date: Wed, 26 Jul 2023 17:06:01 +0530 Subject: [PATCH 10/14] refactor: CGD-401 and CGD-399: logs added, xss protection added, removed secret from config file --- dev-assets/env-files/env.docker.dist | 2 +- dev-assets/env-files/env.local.dist | 2 +- .../config/security/SecurityConfig.java | 1 + .../service/IssuersCredentialService.java | 1 + .../service/PresentationService.java | 5 ++++- .../service/WalletService.java | 4 ++-- src/main/resources/application.yaml | 12 ++++++------ .../config/TestContextInitializer.java | 2 ++ 8 files changed, 18 insertions(+), 11 deletions(-) diff --git a/dev-assets/env-files/env.docker.dist b/dev-assets/env-files/env.docker.dist index 115032e7d..cfb131f3d 100644 --- a/dev-assets/env-files/env.docker.dist +++ b/dev-assets/env-files/env.docker.dist @@ -23,7 +23,7 @@ KC_HOSTNAME=keycloak # Docker: App config KEYCLOAK_CLIENT_ID=miw_private_client -ENCRYPTION_KEY= +ENCRYPTION_KEY=Woh9waid4Ei5eez0aitieghoow9so4oe AUTHORITY_WALLET_BPN=BPNL000000000000 AUTHORITY_WALLET_DID=did:web:localhost:BPNL000000000000 AUTHORITY_WALLET_NAME=Catena-X diff --git a/dev-assets/env-files/env.local.dist b/dev-assets/env-files/env.local.dist index bec945347..ac7dbe4dc 100644 --- a/dev-assets/env-files/env.local.dist +++ b/dev-assets/env-files/env.local.dist @@ -23,7 +23,7 @@ KC_HOSTNAME=localhost # Docker: App config KEYCLOAK_CLIENT_ID=miw_private_client -ENCRYPTION_KEY= +ENCRYPTION_KEY=Woh9waid4Ei5eez0aitieghoow9so4oe AUTHORITY_WALLET_BPN=BPNL000000000000 AUTHORITY_WALLET_DID=did:web:localhost:BPNL000000000000 AUTHORITY_WALLET_NAME=Catena-X diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/security/SecurityConfig.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/security/SecurityConfig.java index d8db323a2..0fb84a1f6 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/security/SecurityConfig.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/config/security/SecurityConfig.java @@ -64,6 +64,7 @@ public class SecurityConfig { public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http.cors(Customizer.withDefaults()) .csrf(AbstractHttpConfigurer::disable) + .headers(httpSecurityHeadersConfigurer -> httpSecurityHeadersConfigurer.xssProtection(Customizer.withDefaults()).contentSecurityPolicy(contentSecurityPolicyConfig -> contentSecurityPolicyConfig.policyDirectives("script-src 'self'"))) .sessionManagement(sessionManagement -> sessionManagement.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) .authorizeHttpRequests(authorizeHttpRequests -> authorizeHttpRequests.requestMatchers(new AntPathRequestMatcher("/")).permitAll() // forwards to swagger .requestMatchers(new AntPathRequestMatcher("/docs/api-docs/**")).permitAll() diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java index e561f57d7..cd0b64be1 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java @@ -522,6 +522,7 @@ private void updateSummeryCredentials(DidDocument issuerDidDocument, byte[] issu log.debug("No summery VC found for did ->{}, checking in issuer", StringEscapeUtils.escapeJava(holderDid)); } else { //delete old summery VC from holder table, delete only not stored VC + log.debug("Deleting older summary VC fir bpn -{}", holderBpn); holdersCredentialRepository.deleteAll(vcs); } 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 a5d4ac6fb..8df2a8950 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/PresentationService.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/PresentationService.java @@ -124,7 +124,7 @@ public Map createPresentation(Map data, boolean Map response = new HashMap<>(); if (asJwt) { - + log.debug("Creating VP as JWT for bpn ->{}", callerBpn); Validate.isFalse(StringUtils.hasText(audience)).launch(new BadDataException("Audience needed to create VP as JWT")); //Issuer of VP is holder of VC @@ -142,6 +142,7 @@ public Map createPresentation(Map data, boolean response.put(StringPool.VP, presentation.serialize()); } else { + log.debug("Creating VP as JSON-LD for bpn ->{}", callerBpn); VerifiablePresentationBuilder verifiablePresentationBuilder = new VerifiablePresentationBuilder(); @@ -172,6 +173,7 @@ public Map validatePresentation(Map vp, boolean Map response = new HashMap<>(); if (asJwt) { + log.debug("Validating VP as JWT"); //verify as jwt Validate.isNull(vp.get(StringPool.VP)).launch(new BadDataException("Can not find JWT")); String jwt = vp.get(StringPool.VP).toString(); @@ -216,6 +218,7 @@ public Map validatePresentation(Map vp, boolean } } else { + log.debug("Validating VP as json-ld"); throw new BadDataException("Validation of VP in form of JSON-LD is not supported"); } diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/WalletService.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/WalletService.java index d073c781e..bab1f7ede 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/WalletService.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/WalletService.java @@ -133,6 +133,7 @@ public Map storeCredential(Map data, String iden .stored(true) //credential is stored(not issued by MIW) .credentialId(verifiableCredential.getId().toString()) .build()); + log.debug("VC type of {} stored for bpn ->{} with id-{}", cloneTypes, callerBpn, verifiableCredential.getId()); return Map.of("message", String.format("Credential with id %s has been successfully stored", verifiableCredential.getId())); } @@ -225,8 +226,7 @@ private Wallet createWallet(CreateWalletRequest request, boolean authority) { DidDocument didDocument = didDocumentBuilder.build(); //modify context URLs List context = didDocument.getContext(); - List mutableContext = new ArrayList<>(); - mutableContext.addAll(context); + List mutableContext = new ArrayList<>(context); miwSettings.didDocumentContextUrls().forEach(uri -> { if (!mutableContext.contains(uri)) { mutableContext.add(uri); diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 15bd84c9b..269aab7ba 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -11,9 +11,9 @@ spring: application: name: miw datasource: - url: jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5432}/${DB_NAME:miw}?useSSL=${USE_SSL:false} - username: ${DB_USER_NAME:root} - password: ${DB_PASSWORD:smart} + url: jdbc:postgresql://${DB_HOST}:${DB_PORT:5432}/${DB_NAME}?useSSL=${USE_SSL} + username: ${DB_USER_NAME} + password: ${DB_PASSWORD} initialization-mode: always hikari: maximumPoolSize: ${DB_POOL_SIZE:10} @@ -31,7 +31,7 @@ spring: springdoc: swagger-ui: oauth: - clientId: ${KEYCLOAK_MIW_PUBLIC_CLIENT:miw_public} #It should be public client created in keycloak + clientId: ${KEYCLOAK_MIW_PUBLIC_CLIENT} #It should be public client created in keycloak disable-swagger-default-url: true path: /ui/swagger-ui show-common-extensions: true @@ -71,7 +71,7 @@ logging: miw: host: ${MIW_HOST_NAME:localhost} - encryptionKey: ${ENCRYPTION_KEY:Woh9waid4Ei5eez0aitieghoow9so4oe} + encryptionKey: ${ENCRYPTION_KEY} authorityWalletBpn: ${AUTHORITY_WALLET_BPN:BPNL000000000000} authorityWalletName: ${AUTHORITY_WALLET_NAME:Catena-X} authorityWalletDid: ${AUTHORITY_WALLET_DID:did:web:localhost:BPNL000000000000} @@ -85,7 +85,7 @@ miw: security: enabled: true realm: ${KEYCLOAK_REALM:miw_test} - clientId: ${KEYCLOAK_CLIENT_ID:miw_private_client} + clientId: ${KEYCLOAK_CLIENT_ID} auth-server-url: ${AUTH_SERVER_URL:http://localhost:8081} auth-url: ${miw.security.auth-server-url}/realms/${miw.security.realm}/protocol/openid-connect/auth token-url: ${miw.security.auth-server-url}/realms/${miw.security.realm}/protocol/openid-connect/token diff --git a/src/test/java/org/eclipse/tractusx/managedidentitywallets/config/TestContextInitializer.java b/src/test/java/org/eclipse/tractusx/managedidentitywallets/config/TestContextInitializer.java index f4e72bfec..019ee6031 100644 --- a/src/test/java/org/eclipse/tractusx/managedidentitywallets/config/TestContextInitializer.java +++ b/src/test/java/org/eclipse/tractusx/managedidentitywallets/config/TestContextInitializer.java @@ -43,6 +43,7 @@ public void initialize(ConfigurableApplicationContext applicationContext) { "server.port=" + port, "miw.host: localhost:${server.port}", "miw.enforceHttps=false", + "miw.encryptionKey=Woh9waid4Ei5eez0aitieghoow9so4oe", "miw.authorityWalletBpn: BPNL000000000000", "miw.authorityWalletName: Test-X", "miw.authorityWalletDid: did:web:localhost%3A${server.port}:BPNL000000000000", @@ -52,6 +53,7 @@ public void initialize(ConfigurableApplicationContext applicationContext) { "spring.datasource.username=sa", "spring.datasource.password=password", "miw.security.auth-server-url=" + authServerUrl, + "miw.security.clientId=miw_private_client ", "miw.security.auth-url=${miw.security.auth-server-url}realms/${miw.security.realm}/protocol/openid-connect/auth", "miw.security.token-url=${miw.security.auth-server-url}realms/${miw.security.realm}/protocol/openid-connect/token", "miw.security.refresh-token-url=${miw.security.token-url}", From d3fe69af5093f4026f769d4f4a16877d3a245137 Mon Sep 17 00:00:00 2001 From: Ronak Thacker Date: Thu, 27 Jul 2023 13:44:24 +0530 Subject: [PATCH 11/14] fix: removed recret from code --- dev-assets/env-files/env.docker.dist | 2 +- dev-assets/env-files/env.local.dist | 2 +- .../config/TestContextInitializer.java | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dev-assets/env-files/env.docker.dist b/dev-assets/env-files/env.docker.dist index cfb131f3d..115032e7d 100644 --- a/dev-assets/env-files/env.docker.dist +++ b/dev-assets/env-files/env.docker.dist @@ -23,7 +23,7 @@ KC_HOSTNAME=keycloak # Docker: App config KEYCLOAK_CLIENT_ID=miw_private_client -ENCRYPTION_KEY=Woh9waid4Ei5eez0aitieghoow9so4oe +ENCRYPTION_KEY= AUTHORITY_WALLET_BPN=BPNL000000000000 AUTHORITY_WALLET_DID=did:web:localhost:BPNL000000000000 AUTHORITY_WALLET_NAME=Catena-X diff --git a/dev-assets/env-files/env.local.dist b/dev-assets/env-files/env.local.dist index ac7dbe4dc..bec945347 100644 --- a/dev-assets/env-files/env.local.dist +++ b/dev-assets/env-files/env.local.dist @@ -23,7 +23,7 @@ KC_HOSTNAME=localhost # Docker: App config KEYCLOAK_CLIENT_ID=miw_private_client -ENCRYPTION_KEY=Woh9waid4Ei5eez0aitieghoow9so4oe +ENCRYPTION_KEY= AUTHORITY_WALLET_BPN=BPNL000000000000 AUTHORITY_WALLET_DID=did:web:localhost:BPNL000000000000 AUTHORITY_WALLET_NAME=Catena-X diff --git a/src/test/java/org/eclipse/tractusx/managedidentitywallets/config/TestContextInitializer.java b/src/test/java/org/eclipse/tractusx/managedidentitywallets/config/TestContextInitializer.java index 019ee6031..d52327f02 100644 --- a/src/test/java/org/eclipse/tractusx/managedidentitywallets/config/TestContextInitializer.java +++ b/src/test/java/org/eclipse/tractusx/managedidentitywallets/config/TestContextInitializer.java @@ -27,23 +27,27 @@ import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; import java.net.ServerSocket; +import java.util.Base64; public class TestContextInitializer implements ApplicationContextInitializer { private static final int port = findFreePort(); private static final KeycloakContainer KEYCLOAK_CONTAINER = new KeycloakContainer().withRealmImportFile("miw-test-realm.json"); + @SneakyThrows @Override public void initialize(ConfigurableApplicationContext applicationContext) { KEYCLOAK_CONTAINER.start(); String authServerUrl = KEYCLOAK_CONTAINER.getAuthServerUrl(); - + SecretKey secretKey = KeyGenerator.getInstance("AES").generateKey(); TestPropertyValues.of( "server.port=" + port, "miw.host: localhost:${server.port}", "miw.enforceHttps=false", - "miw.encryptionKey=Woh9waid4Ei5eez0aitieghoow9so4oe", + "miw.encryptionKey="+ Base64.getEncoder().encodeToString(secretKey.getEncoded()), "miw.authorityWalletBpn: BPNL000000000000", "miw.authorityWalletName: Test-X", "miw.authorityWalletDid: did:web:localhost%3A${server.port}:BPNL000000000000", From 0ba1142069bf2abd85f90aaa12a7f2f9d371a89d Mon Sep 17 00:00:00 2001 From: Peter Motzko Date: Thu, 27 Jul 2023 10:25:32 +0200 Subject: [PATCH 12/14] feat(devel): add task for generating CHANGELOG.md file --- Taskfile.yaml | 6 ++++++ dev-assets/tasks/darwin/check-tools.yaml | 7 +++++++ dev-assets/tasks/linux/check-tools.yaml | 7 +++++++ dev-assets/tasks/windows/check-tools.yaml | 7 +++++++ 4 files changed, 27 insertions(+) diff --git a/Taskfile.yaml b/Taskfile.yaml index ee94b7299..13a829da3 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -42,6 +42,12 @@ tasks: cmds: - task: check:check-all + changelog: + desc: Generate Changelog + cmds: + - rm -f CHANGELOG.md + - git-changelog -o CHANGELOG.md -c conventional -t keepachangelog . + clean-all: desc: Cleans everything... cmds: diff --git a/dev-assets/tasks/darwin/check-tools.yaml b/dev-assets/tasks/darwin/check-tools.yaml index 600e174ad..7835864f3 100644 --- a/dev-assets/tasks/darwin/check-tools.yaml +++ b/dev-assets/tasks/darwin/check-tools.yaml @@ -29,6 +29,7 @@ tasks: - task: check-docker-compose - task: check-java - task: check-jq + - task: check-git-changelog ignore_error: true check-helm: @@ -70,6 +71,12 @@ tasks: cmds: - ./check_bin.sh jq https://jqlang.github.io/jq/ + check-git-changelog: + dir: dev-assets/tasks/darwin + silent: true + cmds: + - ./check_bin.sh git-changelog https://pypi.org/project/git-changelog/#description + check-java: dir: dev-assets/tasks/darwin silent: true diff --git a/dev-assets/tasks/linux/check-tools.yaml b/dev-assets/tasks/linux/check-tools.yaml index decd5f077..c96344c32 100644 --- a/dev-assets/tasks/linux/check-tools.yaml +++ b/dev-assets/tasks/linux/check-tools.yaml @@ -29,6 +29,7 @@ tasks: - task: check-docker-compose - task: check-java - task: check-jq + - task: check-git-changelog ignore_error: true check-helm: @@ -67,6 +68,12 @@ tasks: cmds: - ./check_bin.sh jq https://jqlang.github.io/jq/ + check-git-changelog: + dir: dev-assets/tasks/linux + silent: true + cmds: + - ./check_bin.sh git-changelog https://pypi.org/project/git-changelog/#description + check-java: dir: dev-assets/tasks/linux silent: true diff --git a/dev-assets/tasks/windows/check-tools.yaml b/dev-assets/tasks/windows/check-tools.yaml index 14b79386a..ed2df50c8 100644 --- a/dev-assets/tasks/windows/check-tools.yaml +++ b/dev-assets/tasks/windows/check-tools.yaml @@ -29,6 +29,7 @@ tasks: - task: check-docker-compose - task: check-java - task: check-jq + - task: check-git-changelog ignore_error: true check-helm: @@ -67,6 +68,12 @@ tasks: cmds: - echo "task 'check-prereq' not implemented for windows!" + check-git-changelog: + dir: dev-assets/tasks/windows + silent: true + cmds: + - echo "task 'check-prereq' not implemented for windows!" + check-java: dir: dev-assets/tasks/windows silent: true From fd18113d4c57270b78ba06a0363e1ba2ea888f0f Mon Sep 17 00:00:00 2001 From: Peter Motzko Date: Thu, 27 Jul 2023 10:26:59 +0200 Subject: [PATCH 13/14] chore(doc): update CHANGELOG.md --- CHANGELOG.md | 304 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 264 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 040455683..e5fc29e37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,55 +1,279 @@ # Changelog + All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + + +## Unreleased + +[Compare with latest](https://github.com/catenax-ng/tx-managed-identity-wallets/compare/managed-identity-wallets-0.7.5...HEAD) + +### Features + +- add task for generating CHANGELOG.md file ([0ba1142](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/0ba1142069bf2abd85f90aaa12a7f2f9d371a89d) by Peter Motzko). +- add GH Action for DAST scanning ([8ff4e1a](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/8ff4e1abf37334ead3e4fd14a3df7aead1f43ec4) by Peter Motzko). +- update Helm chart Readme and corresponding Readme-template ([ada59c2](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/ada59c2ee2fa6744afe1a2b759644589b1c700bd) by Peter Motzko). +- update Helm chart description ([73235a8](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/73235a88b1ba48a1880dc74554b3cfe71b614650) by Peter Motzko). +- add helm-docs documentation ([24c0fcd](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/24c0fcd63cc33b6255c51abcab3fc157f814bb1f) by Peter Motzko). +- remove predefined annotation for ingress ([2d8d81b](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/2d8d81bc025d3f4921e333cf229502046945ea94) by Peter Motzko). +- add one more folder depth to helm unittest in Taskfile ([967afc1](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/967afc1c0216951a9635185dca1f8c38c4e66100) by Peter Motzko). +- add helm values for local deployment ([895c506](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/895c506f941a4d658c6fcb092fa04494f042d0a5) by Peter Motzko). +- add simple backup of database to a PV ([680e09f](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/680e09fd18bf95518244f0a92c181d0264837aa6) by Peter Motzko). +- add tests for env and secrets in values ([e7a17b4](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/e7a17b4b4014cd0e518b78dc88358b62b0caabbc) by Peter Motzko). +- added end user documentation ([83ae886](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/83ae88672a1dd28c31ca987e73ef84fd85fa366f) by Ronak Thacker). +- added administrator documentation ([1931fa0](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/1931fa0a8f1afd01249dbcbeecfa09b1cb739f83) by Ronak Thacker). +- adjust trivy GH Action ([ee2f548](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/ee2f54884289ad308c87b7e93b5be0c739ed55bd) by Peter Motzko). +- remove manual trigger from veracode.yaml ([fab2f10](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/fab2f1075b339933152c78ac09ec43bc2a284c71) by Peter Motzko). +- update KICS.yaml to fit current application ([af214cd](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/af214cd80cc30f9cd0e0d0b40748ca0fdaf5b1df) by Peter Motzko). +- update README.md by using current helm-docs template ([74e8bf9](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/74e8bf9cfa60d035f2baf4fafe3e3b972e2e485f) by Peter Motzko). +- add Helm chart Readme template for helm-docs ([a96ca4c](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/a96ca4c6ace3c47f051007b8ae7b04c2b670adf1) by Peter Motzko). +- update chart description and add homepage link and keywords ([5b7b6b4](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/5b7b6b484f83462469b71dc931ff9291492b7f7b) by Peter Motzko). +- check expiry of VC while VP validate support added and test cases updated ([3c1d965](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/3c1d965f913b1da7f0f5d58c99e89ea36c58fffc) by Ronak Thacker). +- updated context url of did document and test case ([0b05e15](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/0b05e15bfd9e366d80c9004f0b3e9b5aea255438) by Ronak Thacker). +- Extend Mac user information ([403362d](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/403362d2e7cb4f4e87b3b940415fb3d88dfab2f0) by Peter Motzko). +- CGD-347: manage log level at runtime ([1676bc3](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/1676bc311f005f5207241d3138d690f05fb19131) by Nitin Vavdiya). +- Uncomment KC_HOSTNAME in env.docker.dist and env.local.dist (is required, not optional) ([aaeefc6](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/aaeefc61546d4ed3fa6fe0c91527e73d17068f45) by Peter Motzko). +- Add DEV_ENVIRONMENT variable to env.docker.dist and env.local.dist ([a0ed2a4](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/a0ed2a4d7a51b14e3c22d1b6740c9dbebe648a49) by Peter Motzko). +- CGD-368: Check expiry date of VC during validation ([37bee28](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/37bee283777f081b82120cf6437da19260f901b3) by Nitin Vavdiya). +- replace check for "docker compose" plugin ([d75c719](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/d75c71903f69f9f62dad4ae2aa97e7be2fc525d4) by Peter Motzko). +- remove docker compose selection -> fixed to new V2 version ([aab42bc](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/aab42bc1590e62f0410c789da435614c127921a2) by Peter Motzko). +- mark important content in README.md ([43dec2d](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/43dec2d1918296a17117070bb4e4c6d279bcc71f) by Peter Motzko). +- document COMPOSE_COMMAND env ([a6fc918](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/a6fc91812ad9065c1f5011597deb1bc6fd9b545a) by Peter Motzko). +- use COMPOSE_COMMAND env from env.* to execute the available docker compose binary ([931e69f](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/931e69fd02a0ada7c5b0827eaaf5aa140b5f07af) by Peter Motzko). +- add COMPOSE_COMMAND to env.*.dist to configure the available docker compose binary ([1893a64](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/1893a6484bd0150d7d2ac3e5cb2e45e221403b2f) by Peter Motzko). +- run Helm unittests ([f11f824](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/f11f8246da65fa17b0a4f4fac59ae67e42b709de) by Peter Motzko). +- suppress task header in output ([87aff68](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/87aff685c7b6db40cd701d3b7f51101e4b02e0c4) by Peter Motzko). +- add missing tasks and rename working dir ([27c2b03](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/27c2b03325004932c317c96989733c0a88ef4785) by Peter Motzko). +- show install link provided as parameter ([cb7ae41](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/cb7ae41b21e6a3acbafcf98dcc09000514b298d1) by Peter Motzko). +- add default labels to secret ([dfe107d](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/dfe107dcd54fd44ad87e56ab799ee78a7f39a0ec) by Peter Motzko). +- add tests for dev stage and put tests in subfolder for each stage ([ecbe7e5](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/ecbe7e5d9765c7336914801001444905d8f84529) by Peter Motzko). +- put Helm chart unittests in subfolder for each stage ([3e17880](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/3e17880beb79fc50f094a79cd49f47c06dbdc4b2) by Peter Motzko). +- update readme ([74fdb21](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/74fdb21dc549ed80bc1cbf8f71b40e0a9410a834) by Peter Motzko). +- add tasks for test-report and coverage ([b4ceeb5](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/b4ceeb5b8325a1b573ec7d6f9fd671e1e9cc41f1) by Peter Motzko). +- add task to check, if helm-docs is installed ([d559cdc](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/d559cdcb87edc427bbb46a80769dfed3137216d4) by Peter Motzko). +- add task to rebuild Helm chart readme ([881e131](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/881e131008cd358a376df62a72107711620c2845) by Peter Motzko). +- Update readme ([81e58df](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/81e58dfcbcdee82b1554c770d98f107875d3cf04) by Peter Motzko). +- swagger doc updated as per new role in api and Retrieve wallet by identifier test cases updated ([330d207](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/330d207e239004340465ecfb34c606a658616c26) by Ronak Thacker). +- make Taskfile app namespace OS specific ([6245576](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/62455766d2ea7ab9da95af6948a62cb455fbc623) by Peter Motzko). +- add environment type switch ([4a5c128](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/4a5c1287c3396ac9ee42e985db67579ab75bccc8) by Peter Motzko). +- update .gitignore ([33b7262](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/33b726263658687608e75379e8cfe1236fda05ca) by Peter Motzko). +- moved to dev-assets folder ([a70115c](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/a70115c1d1243908ccc16d2fe2c3bbefd0070d8a) by Peter Motzko). +- add realm for local dev config ([56a67b7](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/56a67b742fbb1dc12806459ba72778f525fad966) by Peter Motzko). +- env-files move to dev folder ([660cac9](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/660cac957dd683ed6211653ca552f1320ab7f3f7) by Peter Motzko). +- script to obtain an authority token from keycloak ([65b8b20](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/65b8b20a24ac6cbce7572f173844d21d4bff0bfc) by Peter Motzko). +- rename tasks and point to new dev-env ([62e0f2b](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/62e0f2b06c75a71e65e2e1dfeb16666cbb826b97) by Peter Motzko). +- add new dev environment ([0858bf9](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/0858bf9611162f1055b7b29d20494685878aab39) by Peter Motzko). +- split tasks to own namespaces ([db0151c](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/db0151c68fb208dd3981d271277490f48ccdca7a) by Peter Motzko). +- increment appVersion to 3.3.3.b420443 as an attempt ([b75ebaf](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/b75ebafd5395492116d99eca4de6f496cd06ff9f) by Mathias Knoop). +- increment app version to '1.0.0-rc1' and chart version to '4.0.1-rc1' ([07e21cf](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/07e21cfa048fa445fbb4895a0c932fbbd399ac51) by Mathias Knoop). +- json web signature and key generation from lib ([8fda456](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/8fda456a59e011f250677f2e929e6ffb14d1f5f9) by Nitin Vavdiya). +- fallthrough in check-prerequisites task ([28801cc](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/28801cc3996f9dc9f699326285bed538f9d9ba6f) by Peter Motzko). +- authenticate using client_id and claint_secret added in swagger UI ([aaa0a8f](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/aaa0a8f5efd5c7282579d42c51677e5816a9c6a6) by Nitin Vavdiya). +- add Helm unittests for default values ([cc6d2bf](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/cc6d2bf32f711dd0b745e9e24c7bc73cb02cb5b3) by Peter Motzko). +- remove "dash" from template ([7b5bca9](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/7b5bca9e3261ddc49605799c68fac32dc1e353ce) by Peter Motzko). +- add eclipse copyright header everywhere ([ad5c631](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/ad5c631fa2bc3ce22415d215f2cb7207feee014a) by Peter Motzko). +- adds direct '.java-version' from program 'jenv' to '.gitignore' to avoid that is version-controled. ([3531dd5](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/3531dd527b1d0f4306a466a4b59d25fa49872470) by Mathias Knoop). +- add more cleanup commands ([c18b1b0](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/c18b1b079929a82d22e302ec641bb1107f7cf718) by Peter Motzko). +- include checks and new "local.env" + add check-prerequisites task ([eb277ff](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/eb277ffdb1605a1650d08ac340140beaa1246b0d) by Peter Motzko). +- rename tasks in Taskfile ([cdde677](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/cdde677a6f5a594d65633ebd0b472dddf21dfea4) by Peter Motzko). +- add "local.dev" to .gitignore ([0c4166d](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/0c4166d1ce7cd4521e0fc7980c1a73c70e57245e) by Peter Motzko). +- adds (initially) a Postman-collection for testing MIW on stage 'dev'. ([25debc3](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/25debc365e18ca6f3f0eb0e864539ce0352e3807) by Mathias Knoop). +- add securityContext (primary same user/group id as docker image) ([25e93fa](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/25e93fa50652ced6b68b2e6e8fc18e4e5fdbcfe0) by Peter Motzko). +- use user/group id > 10000 and rename "user" to "miw" ([4b08914](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/4b08914d48ed598178db1cbaff6bfac8e008485b) by Peter Motzko). +- back to default values formatting (with accurate values) ([b0e3c61](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/b0e3c6192f358dd3f88a72b05365dc76601b4a4d) by Peter Motzko). +- summary VC context URL updated ([0cc6bfb](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/0cc6bfbd61d845689d6b0fe56214fd03b98bf0e6) by Nitin Vavdiya). +- json web signature 2020 support added for did document, vc and vp ([a9838ce](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/a9838ce167a7f2d6a92849de66c8242e093a93b4) by Ronak Thacker). +- add and adjust authority user's BPN and DID:WEB ([7e2ab46](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/7e2ab464c81f9b90d234ce963f204c9d5e46f100) by Mathias Knoop). +- json web signature 2020 support WIP ([62ee442](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/62ee442e799e59df0ed70925b71e419413a0bc9a) by Ronak Thacker). +- set health check actuator resp. liveliness probe endpoint to '/actuator/health/liveness' and readiness probe endpoint to '/actuator/health/readiness' both on port '8090' ([af44016](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/af44016dc3e04d5e7e1448007cb73a429c529de9) by Mathias Knoop). +- updated vc type ([8b6ebfa](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/8b6ebfadbddabe9342b227e8043be110f7ae1ae1) by Ronak Thacker). +- adjust task 'stopDockerApp' to stop the actual container 'local_miw_app' ([2fb0000](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/2fb0000162383dd9e8947e5f7d2ef985c66aa319) by Mathias Knoop). +- Holder identifier added in framework VC subject ([e65af19](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/e65af19f777154e7f2bc69f90e40e32feef52dbf) by Nitin Vavdiya). +- framework VC name changes and test case changes ([7952f4b](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/7952f4b1ef94ec144308683607bf5083226da523) by Nitin Vavdiya). +- adding generated 'README.md' to accompany the charts for 'Managed-Identity-Wallet' as required. ([d33f6aa](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/d33f6aa50f5f7cb0276c1e6391d85a4eae793c87) by Mathias Knoop). +- add app setup for the stages 'dev' and 'int' in order to deploy the (new) 'Managed-Identity-Wallet' on these stages. ([3f8be32](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/3f8be327f44c44e58fe3fd08a6e2853ba8e254d7) by Mathias Knoop). +- validation added in issue VC api for summary VC ([97ac189](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/97ac189d1e2ef13da12432c2e340d5b9140fa8cf) by Nitin Vavdiya). +- change in create VP API, type and name removed from summary VC ([d4909b0](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/d4909b05f05d4141616abb22acbb31e1d1c4a5ec) by Nitin Vavdiya). +- revert renaming and postpone that for later. ([3a63399](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/3a63399e80220bca2de0ed3bdcaf3b453b68c8fa) by Mathias Knoop). +- add '/dev.env' to '.gitignore' to prevent it form being comitted/ pushed unwanted. ([ac09710](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/ac09710204a9c123c66ae2bcd5a5d668a4a84de9) by Mathias Knoop). +- rename tasks from beginning with 'run' to beginning with 'start' to achieve a uniform 'start...' and 'stop...' appearance of task names. ([a3f3f1c](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/a3f3f1c4f9450cc436537672dc439a5e598ea0b5) by Mathias Knoop). +- updated create wallet api ([ba320ab](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/ba320ab31fbed0c833ffb8462b0b39c4a5ab3648) by Ronak Thacker). +- updated store credential api ([74df138](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/74df138aa01417887e2bd439178f1e80b7be840a) by Ronak Thacker). +- summery VC flow after holder delete summary VC ([1b61f38](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/1b61f38c721ef961e4f6d5c97555a3dc49c1668d) by Nitin Vavdiya). +- Paggination support added in list VC API ([f4338fd](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/f4338fd1711e66b64db03f36f0a61c9d189ed70d) by Nitin Vavdiya). +- summary credential test cases added ([b322515](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/b322515b8b5ed1f9fa10f7cd0138820ba15a7e6e) by Ronak Thacker). +- Summary VC flow, code changes as per input given in code review, test case changes as per summary VC flow ([07c4706](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/07c4706a8beb85313f325317e5feb9dca6bfff17) by Nitin Vavdiya). +- updated issuer credential api and test cases as per new api spec ([f33b056](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/f33b056c41584e65492b028cebb7f4a9f361d01d) by Ronak Thacker). +- Issuer get credential API testcases, test case modification for self_issued and is_stored ([bafaab9](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/bafaab91d67ef1d85229f786500243dc22ef4d33) by Nitin Vavdiya). +- Testcase modification as per new API specification ([f29edb3](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/f29edb30ff9c651be10dc082ef6454fd293e7177) by Nitin Vavdiya). +- delete credential api and test cases added ([e56a52e](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/e56a52e5218c9d07d738f590b2aeea01b9f33202) by Ronak Thacker). +- API changes as per new API specification(separate apis for holder and issuer wallet) ([6286538](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/628653865b0a4db9193fde1d07e5e946df05160c) by Nitin Vavdiya). +- validate VP and validate VC test cases updated with mock ([7531191](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/7531191afc62fba81d16aeef26b2ff0a84f20fd8) by Nitin Vavdiya). +- validate VP as jwt API, enforce https while did resolve in config, changes according to new lib ([235420f](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/235420fcd3eed36e575c10951bb067b0bb530e9a) by Nitin Vavdiya). +- update lib method to resolved vc/vp validate ([6f70b09](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/6f70b09523bed428472ed61c0c88964473a243b5) by Ronak Thacker). +- updated credential get api ([1698996](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/16989967d67160ffbff6a0b9eae4d616634fd456) by Ronak Thacker). +- token support added in swagger ([cd74001](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/cd74001c323a54c4dcc9094daca42614c5826ff6) by Nitin Vavdiya). +- test case of validate vc wip ([2123468](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/21234689065a7a39fc45a6d87ce40e7dc79e3ff2) by Ronak Thacker). +- credential get api type filter support added ([9d6a49d](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/9d6a49daab04bda7fe06484ec1e827a534addbd9) by Ronak Thacker). +- shorten enc_key to 32 bytes ([a52e2ce](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/a52e2cec45befdb699fe4c90a29be8eb464eb6e1) by Peter Motzko). +- extend application name ([5aca6f2](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/5aca6f2a1063830373faa52fd5ee5673cf3860ab) by Peter Motzko). +- add authority_wallet_did env ([ce2e531](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/ce2e531e7fac46b23d656823e1ea11cb1396359d) by Peter Motzko). +- WIP: add more stuff to Taskfile ([280f51c](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/280f51cb4d7050a87f4faca547c45d05eacc6089) by Peter Motzko). +- set ingress host type to "ImplementationSpecific" ([8e40f3a](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/8e40f3a0b32473bd5501fde76c3f3a837354c9ce) by Peter Motzko). +- add classname annotation to ingress ([d250497](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/d25049790c2d10c8be784a953426a872adf88998) by Peter Motzko). +- add init script to setup initial database ([9950690](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/99506905c8e9a53bccc28cd7f7ecc752179c1112) by Peter Motzko). +- read me file chamges, sample reponse added ([88651fa](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/88651fa518fdcabf5ab1902d775d748a701df46e) by Nitin Vavdiya). +- set default values for dev environment in ArgoCD ([2d10bcf](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/2d10bcfe7e5159573d275f42556bd852eda7df07) by Peter Motzko). +- set default values for image tag and ingress className ([f8310e6](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/f8310e6b65682ffff9aa5d82641aced98ee933bb) by Peter Motzko). +- comment out default values ([d424086](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/d4240868609392558bc3cb682b9e3747ec7cc59d) by Peter Motzko). +- comment out unused config ([248ab4c](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/248ab4cede85449e1028bc8aa00f4b8b5e3d9636) by Peter Motzko). +- add full release name to ingress secret name ([58a7299](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/58a72999f8229ddc39dd76442f4e8754b47e7720) by Peter Motzko). +- readm changes and gradle fix ([79d5bf0](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/79d5bf04488477296c07c151b455623d7b023e58) by Nitin Vavdiya). +- update ditignore and dev.env added ([b90fe94](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/b90fe944a6f447e54349ff1ef99298d7fa9f2468) by Nitin Vavdiya). +- readme added, validate VP wip ([1c4d6af](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/1c4d6af2642b81e94430614ceb9ec4c2c3497da9) by Nitin Vavdiya). +- issue credential api test case added ([6edf1e6](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/6edf1e635c4bd82536a9a76bf88153a73bcb6a95) by Ronak Thacker). +- add values for dev stage (WIP) ([bb2c6a5](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/bb2c6a5be738d042510f00a62947df303ea58bb6) by Peter Motzko). +- remove unused secrets ([fa21e4d](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/fa21e4d536ab6c7bf62a97ee3188b3873e24592a) by Peter Motzko). +- add container env (plain and from secret) ([7242b4b](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/7242b4b78834a0965d756f416ef0ac0068ca22a3) by Peter Motzko). +- add container env and DB secrets ([f175786](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/f1757861ff2d204e0f3e98035f4fdc10c247c2cb) by Peter Motzko). +- adjust to current setup ([ee92bf5](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/ee92bf5f5519d5e7759351d7a04962c08fceae79) by Peter Motzko). +- rename miw service GH repo ([ab9c7ff](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/ab9c7ffb2632ad7621e010917306997589100599) by Peter Motzko). +- adjust Dockerfile to current setup ([8556169](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/85561698505ef5d72a76314dbb8d69223e5e57cb) by Peter Motzko). +- change default name of miw-app artifact ([29e65af](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/29e65afbc1b0e9ec941e8e516a0e8a8b292eb12a) by Peter Motzko). +- add local miw-app image to docker-compose ([21ac5e8](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/21ac5e880bd5fff9ad6c478986aecc02e36e4069) by Peter Motzko). +- credentials validation api wip ([0515ef6](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/0515ef6244d52bea506363540593489bee48d165) by Ronak Thacker). +- reamdme added with env verables, vp as jwt, credentials id added in table, search with credential id ([524c537](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/524c5370aabd95e95b9c23eb902543394a0dbbb2) by Nitin Vavdiya). +- caller BPN security added and test case modification for the same ([b375317](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/b3753173eb2eb90474c6a9e92d7465203ddc17c3) by Nitin Vavdiya). +- remove acapy vars from .env.example ([3ce0c6d](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/3ce0c6d21c735209503e17025089e4b024050a32) by Peter Motzko). +- change active Helm chart ([a5a88b5](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/a5a88b5e0482bd802e964661b41660bf0908141b) by Peter Motzko). +- remove old acapy actions ([e0f0ae7](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/e0f0ae7b8a1560b458511d922bae1624c18294fb) by Peter Motzko). +- switch to new Helm chart "charts/managed-identity-wallet" ([c302664](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/c302664b96431373ef111361c1d994c27640fe98) by Peter Motzko). +- add new helm chart "managed-identity-wallet" (WIP) ([eac9f3a](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/eac9f3addc4edb60ffe93d58bed4db5816ab0252) by Peter Motzko). +- added test cases for getCredentials api ([56072f6](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/56072f68d092b3ebf8cbef9647074e4b7d6f456a) by Ronak Thacker). +- code changes to create DidDocument ([1675ef4](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/1675ef4d1f6b5cb32b80b856b39955383902f1f9) by Nitin Vavdiya). +- authority wallet did in env ([139f9d9](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/139f9d95f116e02fc1ba91404d3b010fe0587386) by Nitin Vavdiya). +- presenation API WIP, code refactor ([2c1b5d9](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/2c1b5d9c3bc667d8f91d1f35145bd3fb9c0c38c0) by Nitin Vavdiya). +- Create BPN VC while creating wallet, test case modification, filter support added in get all wallet and get all credential API ([aa04faa](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/aa04faa2adf828bfbb712993af90926a397e4ff0) by Nitin Vavdiya). +- bpnCredential added in wallet creation ([67c749f](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/67c749f98ff768deaea2f68a219916c46e0276e5) by Ronak Thacker). +- Framwork VC API, Dismantler VC API, Testcase modificatoin, VC context URL in config, VC expiry in config ([6ea7580](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/6ea7580023ee6fef9d561558ab22eec79c27e242) by Nitin Vavdiya). +- test cases added for issueMembershipCredential api ([a3d19c1](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/a3d19c15ad59c57cd06f18fa5630e9555d639d10) by Ronak Thacker). +- membership credentials api added ([45602c8](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/45602c8fe8db3a982ea9c644c180902ad512b75e) by Ronak Thacker). +- ssi lib v4 added, autority wallet config added ([1c5ee0e](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/1c5ee0e116bbc0ad69525da8cc7a3fbdfa67da4a) by Nitin Vavdiya). +- Store credential API with test case, Validate test case ([4911817](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/4911817dfdf40038cc2298d62676d4e2fa25c2b2) by Nitin Vavdiya). +- credential list api added ([e34cf00](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/e34cf0067d77401be28aa1e43ad9d118465e39a8) by Ronak Thacker). +- Store credntial API, testcase mofitication based on DidDocument Java POJO ([569097b](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/569097b392d0fb7242ed9df47fcaf5fda40904b0) by Nitin Vavdiya). +- ssi:lib version updated ([4939ddb](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/4939ddb2d9d4f4b982ffeb75279414b63d16a005) by Ronak Thacker). +- Spring security added with keycloak, Swagger added, Testcases modification based on spring security ([aed48ee](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/aed48ee4de89ab0df1d649260609db69264b6530) by Nitin Vavdiya). +- Resolve the DID document for a given DID or BPN api added ([1368edf](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/1368edfb1cef1cac0640b599bd8ba76b7e2aa627) by Ronak Thacker). +- disable authorization check, because of potential bug (to be investigated) ([718af89](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/718af892e70eaf478e3001b14772f1ade4fc5747) by Peter Motzko). +- add console logger to db init transaction (commented out, but useful for debugging) ([6706f18](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/6706f186ebb1343bf28dc8b59ff63a8a4d18fd7f) by Peter Motzko). +- adjust naming to snake_case and add suffixes ([720217f](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/720217fdfa650e2785a92708df688d8738bf04bc) by Peter Motzko). +- Bump Keycloak version of docker-compose to 21.1 and update env file ([9b81087](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/9b81087ac2d811c67217adee06df57a7522770bf) by Peter Motzko). +- Add first helm unittest draft for Deployment resource ([b533b52](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/b533b52460578872117c101c5a07c5d9cbb19f3e) by Peter Motzko). +- Introduce Taskfile ([5d4a889](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/5d4a88989ce8fc1dc93ea69a57ab4b3a8da3bdf6) by Peter Motzko). +- Replace old custom Dockerfile with official postgres image ([ce2c907](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/ce2c907bb9e4c10a81da4652cdeb3c21a363381e) by Peter Motzko). +- Remove obsolete stuff ([c2ff738](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/c2ff738ab5f13de40734bfccc17fa10d59a57b39) by Peter Motzko). + +### Bug Fixes + +- add empty object ([00a9b08](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/00a9b08c1a9bd319e0ebe05734d26fae2209b8fe) by Peter Motzko). +- Veracode finding for CVE-2023-24998 ([5ac9f2d](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/5ac9f2dfeb1b80afce33014eae9d592774ae3bf3) by Nitin Vavdiya). +- test cases ([1a9b51e](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/1a9b51ea8ef256b2b8275e7361fd54a0c2d09d90) by Nitin Vavdiya). +- veracode log issue ([69cd4d8](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/69cd4d83470faa2615b6128f416ea4f3a601f21e) by Nitin Vavdiya). +- veracode log realted issue fix ([7908741](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/7908741e3a765bc68e9c955dfccc58e4b3f72da2) by Nitin Vavdiya). +- veracode issues: Spring boot and other lib version update ([f30c4d8](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/f30c4d80ec70db4387dbb41e06d867579a4bdde6) by Nitin Vavdiya). +- fix test values for helm test in GH Actions ([4532aa7](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/4532aa7611c54270e20e2adec8be24cad21eed20) by Peter Motzko). +- adjust gradle build command and remove unused code ([590d56a](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/590d56a7d990799fa985f81447f3b4be6b35d653) by Peter Motzko). +- conflict resolved ([a2ce51f](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/a2ce51fce616644364abc6348c34b1050ca33400) by Nitin Vavdiya). +- replace docker_compose env var with real command ([187435b](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/187435be54f66d88dda11c152c38205223791f38) by Peter Motzko). +- split into two lines ([0b2e11f](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/0b2e11fb4a3d6f7b862f688da5c7f85b1ea9fe1e) by Peter Motzko). +- add missing "sudo" ([e912482](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/e912482c8c87fa9d1f904ef26ed52d65810bf271) by Peter Motzko). +- move information about docker for macos upwards ([ff414f8](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/ff414f8e3cb764ad1602f2b2367e2756d123cdd8) by Peter Motzko). +- add empty line at the bottom for Helm lint testing ([57a37f4](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/57a37f467d60cef5eb595911f101bc36050d924b) by Peter Motzko). +- use jdk 17 instead of jdk 18 and remove the EXPOSE statement ([e2ef3fe](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/e2ef3fe536b8168a3806508c8c2da8f15cc5d247) by Peter Motzko). +- add install links to check-tools.yaml ([7c94f89](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/7c94f8954fd2fb2020b444ea9466d8eef8325353) by Peter Motzko). +- move APPLICATION_PORT env var outside if condition ([299b669](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/299b669b4b71315cd9c7c19672d510ddb5727c65) by Peter Motzko). +- CGD-288 and code refactor ([f037c16](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/f037c168a5a16aa3ff2009e7c086d82a8030bf44) by Nitin Vavdiya). +- use "localhost" instead docker container name ([c6caf36](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/c6caf36297582b0d1a6697f181b51f967d550cb1) by Peter Motzko). +- attempt to deploy recent code ([3b5e5f7](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/3b5e5f7919674213b0f18374c4bd9715fbb418c8) by Mathias Knoop). +- adjust git history for Peter Motzko, peter.motzko@volkswagen.de ([06e4d83](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/06e4d838b9ccb5175ceac48547a70e9c18d62a7f) by Mathias Knoop). +- remove quotes ([8889455](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/8889455b67a6e88168b5bdc576393b758a638ffa) by Peter Motzko). +- quote numbers ([9a48104](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/9a4810452cf7a4187a8f4d9c33a7c7fbc346514e) by Peter Motzko). +- adjust resources and limits for 'managed-identity-wallets-new' in order to attain and retain app-health-status. ([b4e5ba5](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/b4e5ba51db62f2bc1b995b2a85111c6ab4b01aa4) by Mathias Knoop). +- adjust values to enable sync again. ([b856059](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/b856059008fc62f565eb1b8b7c52354224384447) by Mathias Knoop). +- adjust values for timeouts and resources for 'liveness' and 'readiness' actuators to mitigate restarts to to cpu-throttling and respective memory peaks which would possibly yield a restart, too. ([f7673a0](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/f7673a005f83b26418a9c82c45f8628713dfd98c) by Mathias Knoop). +- CGD-238: BPN from access_token ignore case ([f6bf0d5](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/f6bf0d5bf08ed839f37b0b6a2cb09258c02b8cfd) by Nitin Vavdiya). +- changes task name to 'build' from 'buildJar' and adjusts all occurrences in file 'Taskfile'. ([458834c](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/458834c9a0875990551dc553dd948e61f62e30f6) by Mathias Knoop). +- remove token (already revoked) ([835654d](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/835654d9be8504a896f916ed928c5f2a6481793e) by Peter Motzko). +- remove double className ([e8e2a43](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/e8e2a43301a62a8596a1415e62d0debab59bd502) by Peter Motzko). +- remove last slash ([dab469f](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/dab469fe8f6d643284cd1f9d4691391026e5c482) by Peter Motzko). +- set ingress host path to "/" ([3dcfd46](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/3dcfd460d630f9893ebebc9c760c2a96cf1dabd6) by Peter Motzko). +- bind APPLICATION_PORT to 8080 ([9a9097d](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/9a9097deb094ce868d071e40f3bbdac70897d376) by Peter Motzko). +- add random generated encryption_key ([6e89285](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/6e89285a797fc90a9b2e9d2b48687c4188dd1fa2) by Peter Motzko). +- typo in db_host ([66daf19](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/66daf19f10b5654b9d7c60c5611a1fd03d023c21) by Peter Motzko). +- wrong data type in secret ([c600d16](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/c600d1648065130d3ab21b56148b3348debf82bf) by Peter Motzko). +- add correct service for postgresql db ([e00a84f](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/e00a84f5aaa231465d733e41e911aa4ee8eef3c8) by Peter Motzko). +- use lowercase letters for repository name ([9e10c9f](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/9e10c9f9dd8859b2eb2b8613369a15787b0cccd4) by Peter Motzko). +- default port for postgresDB ([6b603c0](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/6b603c038c38b567e7f882b0eaefd03b093bf292) by Peter Motzko). + +### Code Refactoring + +- rename tests suites ([3304d0d](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/3304d0d91a339f47d9ed8e38e3e7b7c7413daf89) by Peter Motzko). +- move test template definition out to root ([2163f28](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/2163f283dc0f868a2ecf99557a545097569c178a) by Peter Motzko). +- remove manual trigger ([50d6370](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/50d6370628c4d22f9f42af7545fbf1a98f205ea7) by Peter Motzko). +- remove old MIW Helm chart ([6cd5d6c](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/6cd5d6c6fd9e088f0f9b81a09cf1559477b1143b) by Peter Motzko). +- use custom values.yaml (instead of values-dev.yaml) for testing and add more tests ([37c9289](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/37c9289a054cc2e70a9169119e951986abd0b074) by Peter Motzko). +- remove env.environment due to set env order of Taskfile ([11ad959](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/11ad959c37f1a9d23f0b3d8fe119a7d85a73ccd8) by Peter Motzko). +- reorder variables ([7149df4](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/7149df4791460d95c5638b946b4fd6db2e782221) by Peter Motzko). +- add missing task to linux tasks ([b1e9c0e](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/b1e9c0e80cf9a480b2b6b4b4cdec55146e72e65e) by Peter Motzko). +- spilt tasks after os in folders ([5ac1bd3](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/5ac1bd345f8e155317b810273eefc26d22bc5711) by Peter Motzko). +- move get_token.sh to scripts folder ([8bf92ed](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/8bf92edd11e7d0d513a4179a21d14d28971e6e6b) by Peter Motzko). +- rename paths ([ea18e72](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/ea18e72a2e1266ea2aa141dd8a0b2531e4409c02) by Peter Motzko). +- auth method removed, company name removed from sample data ([6b6b80f](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/6b6b80fc2fe621ab0848142ae78a7f75a8e64e32) by Nitin Vavdiya). +- allowedVehicleBrands optional while issue Dismantler VC ([ba45aee](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/ba45aeeea26c9cafcb56847a7864b47a89ab0e84) by Nitin Vavdiya). +- refactor Taskfile ([b4f9f54](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/b4f9f54b14f0b5c8919626cd952348094c79160e) by Peter Motzko). +- variable name change and minor refactor ([f1f6a56](https://github.com/catenax-ng/tx-managed-identity-wallets/commit/f1f6a56928fb8612247356ab45acc73a379404d3) by Nitin Vavdiya). + + +## [managed-identity-wallets-0.7.5](https://github.com/catenax-ng/tx-managed-identity-wallets/releases/tag/managed-identity-wallets-0.7.5) - 2023-02-28 + +[Compare with managed-identity-wallets-0.7.2](https://github.com/catenax-ng/tx-managed-identity-wallets/compare/managed-identity-wallets-0.7.2...managed-identity-wallets-0.7.5) + +## [managed-identity-wallets-0.7.2](https://github.com/catenax-ng/tx-managed-identity-wallets/releases/tag/managed-identity-wallets-0.7.2) - 2023-02-24 + +[Compare with managed-identity-wallets-0.7.1](https://github.com/catenax-ng/tx-managed-identity-wallets/compare/managed-identity-wallets-0.7.1...managed-identity-wallets-0.7.2) + +## [managed-identity-wallets-0.7.1](https://github.com/catenax-ng/tx-managed-identity-wallets/releases/tag/managed-identity-wallets-0.7.1) - 2023-02-23 + +[Compare with managed-identity-wallets-0.7.0](https://github.com/catenax-ng/tx-managed-identity-wallets/compare/managed-identity-wallets-0.7.0...managed-identity-wallets-0.7.1) + +## [managed-identity-wallets-0.7.0](https://github.com/catenax-ng/tx-managed-identity-wallets/releases/tag/managed-identity-wallets-0.7.0) - 2023-02-13 + +[Compare with managed-identity-wallets-0.6.9](https://github.com/catenax-ng/tx-managed-identity-wallets/compare/managed-identity-wallets-0.6.9...managed-identity-wallets-0.7.0) + +## [managed-identity-wallets-0.6.9](https://github.com/catenax-ng/tx-managed-identity-wallets/releases/tag/managed-identity-wallets-0.6.9) - 2023-02-09 -## [Unreleased] +[Compare with managed-identity-wallets-0.6.8](https://github.com/catenax-ng/tx-managed-identity-wallets/compare/managed-identity-wallets-0.6.8...managed-identity-wallets-0.6.9) -## [3.3.2] - 2023-02-24 -### Fixed -- Configurable log level settings with default to INFO -- Configurable timeouts for HTTP client calls with lower default value +## [managed-identity-wallets-0.6.8](https://github.com/catenax-ng/tx-managed-identity-wallets/releases/tag/managed-identity-wallets-0.6.8) - 2023-02-06 -## [3.3.1] - 2023-02-23 -### Fixed -- Fix blocking issue upon status list creation +[Compare with managed-identity-wallets-0.6.7](https://github.com/catenax-ng/tx-managed-identity-wallets/compare/managed-identity-wallets-0.6.7...managed-identity-wallets-0.6.8) -## [3.3.0] - 2023-02-14 -- Remove unused UI -- Fix credential status description in OpenApi +## [managed-identity-wallets-0.6.7](https://github.com/catenax-ng/tx-managed-identity-wallets/releases/tag/managed-identity-wallets-0.6.7) - 2023-02-02 -## [3.2.0] - 2023-02-13 -- Add an allowlist for requested connections based on the DID of the requester +[Compare with managed-identity-wallets-0.6.6](https://github.com/catenax-ng/tx-managed-identity-wallets/compare/managed-identity-wallets-0.6.6...managed-identity-wallets-0.6.7) -## [3.1.1] - 2023-01-27 -- Add Kotlin docs to the interfaces +## [managed-identity-wallets-0.6.6](https://github.com/catenax-ng/tx-managed-identity-wallets/releases/tag/managed-identity-wallets-0.6.6) - 2023-02-02 -## [3.1.0] - 2023-01-26 -- Fix regex bug in utility method -- Rename enviroment variables and secrets -- Set verkey as optional in the verify credentials and presentation method -- Re-enable BPDM scheduler -- Make the values in OpenAPI configurable +[Compare with managed-identity-wallets-0.6.3](https://github.com/catenax-ng/tx-managed-identity-wallets/compare/managed-identity-wallets-0.6.3...managed-identity-wallets-0.6.6) -## [3.0.0] - 2023-01-09 -- Use separate AcaPy instances for Base Endorser wallet and multi-tenant company wallets -- Support endorsement by Base wallet for setting did-communication service endpoints for company wallet -- Support acceptance and reception of connection requests and credential issuance from external issuers by company wallets +## [managed-identity-wallets-0.6.3](https://github.com/catenax-ng/tx-managed-identity-wallets/releases/tag/managed-identity-wallets-0.6.3) - 2023-01-26 -## [2.2.0] - 2022-12-20 +[Compare with managed-identity-wallets-0.6.0](https://github.com/catenax-ng/tx-managed-identity-wallets/compare/managed-identity-wallets-0.6.0...managed-identity-wallets-0.6.3) -### Changed -- update the supported AcaPy version to 0.7.5 -- update the Business Partner data integration from external BPDM service -- other improvements and additional tests +## [managed-identity-wallets-0.6.0](https://github.com/catenax-ng/tx-managed-identity-wallets/releases/tag/managed-identity-wallets-0.6.0) - 2023-01-17 -## [2.1.0] - 2022-10-06 +[Compare with first commit](https://github.com/catenax-ng/tx-managed-identity-wallets/compare/060340e0f43f6bd2616afc1d3589c12bb1a5ffe6...managed-identity-wallets-0.6.0) -### Added -- Wallet handling via CRUD -- Verifiable Credentials and Verifiable Presentation handling via CRUD -- Revocation of Verifiable Credentials -- DID document and Service Endpoint handling via CRUD -- Business Partner data integration from external BPDM service and Verifiable Credentials -- Copyright, dependency and notice files according to Eclipse project requirements From 391a7a7f4d4242a6390a8a13fa1a8329bb9a7d4e Mon Sep 17 00:00:00 2001 From: Mathias Knoop Date: Thu, 27 Jul 2023 10:58:36 +0200 Subject: [PATCH 14/14] feat(readme): adds overview of the required roles per endpoint --- README.md | 87 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 0eb4b85af..e7c21c0dd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Managed Identity Wallets +# Managed Identity Wallets `` The Managed Identity Wallets (MIW) service implements the Self-Sovereign-Identity (SSI) using did:web @@ -15,13 +15,13 @@ There are two possible flows, which can be used for development: Following tools the MIW development team used successfully: -| Area | Tool | Download Link | Comment | -|----------|----------|-------------------------------------------------|---------------------------------------------------------------------------------------------------| -| IDE | IntelliJ | https://www.jetbrains.com/idea/download/ | Use [envfile plugin](https://plugins.jetbrains.com/plugin/7861-envfile) to use the **local** flow | -| Build | Gradle | https://gradle.org/install/ | -| Runtime | Docker | https://www.docker.com/products/docker-desktop/ | | -| Database | DBeaver | https://dbeaver.io/ | -| IAM | Keycloak | https://www.keycloak.org/ | | +| Area | Tool | Download Link | Comment | +| -------- | -------- | ----------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| IDE | IntelliJ | https://www.jetbrains.com/idea/download/ | Use[envfile plugin](https://plugins.jetbrains.com/plugin/7861-envfile) to use the **local** flow | +| Build | Gradle | https://gradle.org/install/ | | +| Runtime | Docker | https://www.docker.com/products/docker-desktop/ | | +| Database | DBeaver | https://dbeaver.io/ | | +| IAM | Keycloak | https://www.keycloak.org/ | | # Administrator Documentation @@ -49,39 +49,63 @@ assigned to the client using *Clients > miw_private_client > Client Scopes* The available scopes/roles are: 1. Role `add_wallets` to create a new wallet - 2. Role `view_wallets`: - * to get a list of all wallets - * to retrieve one wallet by its identifier - * to validate a Verifiable Credential - * to validate a Verifiable Presentation - * to get all stored Verifiable Credentials + * to get a list of all wallets + * to retrieve one wallet by its identifier + * to validate a Verifiable Credential + * to validate a Verifiable Presentation + * to get all stored Verifiable Credentials 3. Role `update_wallets` for the following actions: - * to store Verifiable Credential - * to issue a Verifiable Credential - * to issue a Verifiable Presentation + * to store Verifiable Credential + * to issue a Verifiable Credential + * to issue a Verifiable Presentation 4. Role `update_wallet`: - * to remove a Verifiable Credential - * to store a Verifiable Credential - * to issue a Verifiable Credential - * to issue a Verifiable Presentation + * to remove a Verifiable Credential + * to store a Verifiable Credential + * to issue a Verifiable Credential + * to issue a Verifiable Presentation 5. Role `view_wallet` requires the BPN of Caller and it can be used: - * to get the Wallet of the related BPN - * to get stored Verifiable Credentials of the related BPN - * to validate any Verifiable Credential - * to validate any Verifiable Presentation + + * to get the Wallet of the related BPN + * to get stored Verifiable Credentials of the related BPN + * to validate any Verifiable Credential + * to validate any Verifiable Presentation 6. Role `manage_app` used to change the log level of the application at runtime. Check Logging in the application section for more details +Overview by Endpoint + +| Artefact | CRUD | HTTP Verb/ Request | Endpoint | Roles | Constraints | +| ----------------------------------------------- | ------ | ------------------ | ------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------- | +| **Wallets** | Read | GET | /api/wallets | **view_wallets** | | +| **Wallets** | Create | POST | /api/wallets | **add_wallets** | **1 BPN : 1 WALLET**(PER ONE [1] BPN ONLY ONE [1] WALLET!) | +| **Wallets** | Create | POST | /api/wallets/{identifier}/credentials | **update_wallets**
OR**update_wallet** | | +| **Wallets** | Read | GET | /api/wallets/{identifier} | **view_wallets**OR
**view_wallet** | | +| **Verifiable Presentations - Generation** | Create | POST | /api/presentation | **update_wallets**OR
**update_wallet** | | +| **Verifiable Presentations - Validation** | Create | POST | /api/presentations/validation | **view_wallets**OR
**view_wallet** | | +| **Verifiable Credential - Holder** | Read | GET | /api/credentials | **view_wallets**OR
**view_wallet** | | +| **Verifiable Credential - Holder** | Create | POST | /api/credentials | **update_wallet**OR
**update_wallet** | | +| **Verifiable Credential - Holder** | Delete | DELETE | /api/credentials | **update_wallet** | | +| **Verfiable Credential - Validation** | Create | POST | /api/credentials/validation | **view_wallets**OR
**view_wallet** | | +| **Verfiable Credential - Issuer** | Read | GET | /api/credentials/issuer | **view_wallets** | | +| **Verfiable Credential - Issuer** | Create | POST | /api/credentials/issuer | **update_wallets** | | +| **Verfiable Credential - Issuer** | Create | POST | /api/credentials/issuer/membership | **update_wallets** | | +| **Verfiable Credential - Issuer** | Create | POST | /api/credentials/issuer/framework | **update_wallets** | | +| **Verfiable Credential - Issuer** | Create | POST | /api/credentials/issuer/distmantler | **update_wallets** | | +| **DIDDocument** | Read | GET | /{bpn}/did.json | N/A | | +| **DIDDocument** | Read | GET | /api/didDocuments/{identifier} | N/A | ` | + + + Additionally a Token mapper can be created under *Clients* > *ManagedIdentityWallets* > *Mappers* > *create* with the following configuration (using as an example `BPNL000000001`): | Key | Value | -|------------------------------------|-----------------| +| ---------------------------------- | --------------- | | Name | StaticBPN | | Mapper Type | Hardcoded claim | | Token Claim Name | BPN | @@ -90,7 +114,7 @@ configuration (using as an example `BPNL000000001`): | Add to ID token | OFF | | Add to access token | ON | | Add to userinfo | OFF | -| includeInAccessTokenResponse.label | ON | +| includeInAccessTokenResponse.label | ON | If you receive an error message, that the client secret is not valid, please go into keycloak admin and within *Clients > Credentials* recreate the secret. @@ -161,6 +185,7 @@ When you just run `task` without parameters, you will see all tasks available. 6. MIW is up and running # End Users + See OpenAPI documentation, which is automatically created from the source and available on each deployment at the `/docs/api-docs/docs` endpoint (e.g. locally at http://localhost:8087/docs/api-docs/docs). An export of the JSON @@ -199,7 +224,7 @@ PostgreSQL and Keycloak Docker containers locally. Before running the tests, please ensure that you have Docker runtime installed and that you have the necessary permissions to run containers. -Alternative, you can skip test during the build with ``` ./gradlew clean build -x test``` +Alternative, you can skip test during the build with `` ./gradlew clean build -x test`` #### 2. Database migration related issue @@ -214,11 +239,11 @@ In case you encounter any database-related issues, you can resolve them by follo This process ensures that any issues with the database schema are resolved by recreating it in a fresh state. -# Environment Variables +# Environment Variables `` | name | description | default value | -|---------------------------------|----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------| -| APPLICATION_PORT | port number of application | 8080 | +| ------------------------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | +| APPLICATION_PORT | port number of application | 8080 | | APPLICATION_ENVIRONMENT | Environment of the application ie. local, dev, int and prod | local | | DB_HOST | Database host | localhost | | DB_PORT | Port of database | 5432 |