diff --git a/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/CertController.java b/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/CertController.java index a3fbc59..33501b6 100644 --- a/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/CertController.java +++ b/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/CertController.java @@ -46,6 +46,11 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +/** + * The endpoint here are not public API and should be used only for developing testing + * purposes. + * Only available for spring dev profile + */ @RestController @RequestMapping("/cert") @AllArgsConstructor @@ -63,6 +68,9 @@ public class CertController { /** * Controller for creating Vaccination Certificate. */ + @Operation( + summary = "create edgc with process step informations, developing tool" + ) @PostMapping(value = "create", consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity createVaccinationCertificate(@RequestBody Eudgc eudgc) { Chain cborProcessingChain = @@ -76,6 +84,9 @@ public ResponseEntity createVaccinationCertificate(@RequestBody Eud /** * Rest Controller to decode CBOR. */ + @Operation( + summary = "dump base64 cbor byte stream, developing tool" + ) @PostMapping(value = "dumpCBOR", consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity decodeCbor(@RequestBody String cbor) throws IOException { StringWriter stringWriter = new StringWriter(); @@ -95,7 +106,7 @@ public ResponseEntity decodeCbor(@RequestBody String cbor) throws IOExce * @throws IOException IOException */ @Operation( - summary = "decode edgc", + summary = "decode edgc, developing tool", description = "decode and validate edgc raw string, extract raw data of each decode stage" ) @PostMapping(value = "decodeEGC", consumes = MediaType.APPLICATION_JSON_VALUE) @@ -110,6 +121,9 @@ public ResponseEntity decodeEgCert( /** * Rest Controller to get Public Key Information. */ + @Operation( + summary = "get information about edgc public key, developing tool" + ) @GetMapping(value = "publicKey") public ResponseEntity getPublic() { PublicKeyInfo result = new PublicKeyInfo( diff --git a/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/DgciController.java b/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/DgciController.java index 5096973..ce8a8fd 100644 --- a/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/DgciController.java +++ b/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/DgciController.java @@ -52,16 +52,17 @@ public class DgciController { @Operation( - summary = "Creates new dgci", + summary = "Creates new dgci (deprecated)", description = "Creates new dgci and return meta data for certificate creation" ) @PostMapping(value = "", consumes = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity initDgci(@Valid @RequestBody DgciInit dgciInit) { + @Deprecated + public ResponseEntity initDgciDepr(@Valid @RequestBody DgciInit dgciInit) { return ResponseEntity.ok(dgciService.initDgci(dgciInit)); } @Operation( - summary = "calculate cose signature for edgc", + summary = "calculate cose signature for edgc (deprecated)", description = "calculate cose signature for given certificate hash, " + "generate TAN and update DGCI Registry database" ) @@ -70,6 +71,32 @@ public ResponseEntity initDgci(@Valid @RequestBody DgciInit dgci @ApiResponse(responseCode = "404", description = "dgci with related id not found"), @ApiResponse(responseCode = "400", description = "wrong issue data")}) @PutMapping(value = "/{id}", consumes = MediaType.APPLICATION_JSON_VALUE) + @Deprecated + public ResponseEntity finalizeDgciDepr(@PathVariable long id, + @Valid @RequestBody IssueData issueData) + throws Exception { + return ResponseEntity.ok(dgciService.finishDgci(id, issueData)); + } + + @Operation( + summary = "Prepares an DGCI for the Code Generation in Frontend", + description = "Creates new dgci and return meta data for certificate creation" + ) + @PostMapping(value = "/issue", consumes = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity initDgci(@Valid @RequestBody DgciInit dgciInit) { + return ResponseEntity.ok(dgciService.initDgci(dgciInit)); + } + + @Operation( + summary = "Completes the issuing process", + description = "calculate cose signature for given certificate hash, " + + "generate TAN and update DGCI Registry database" + ) + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "signature created"), + @ApiResponse(responseCode = "404", description = "dgci with related id not found"), + @ApiResponse(responseCode = "400", description = "wrong issue data")}) + @PutMapping(value = "/issue/{id}", consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity finalizeDgci(@PathVariable long id, @Valid @RequestBody IssueData issueData) throws Exception { return ResponseEntity.ok(dgciService.finishDgci(id, issueData)); @@ -82,24 +109,27 @@ public ResponseEntity finalizeDgci(@PathVariable long id, @Valid @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "signed edgc qr code created"), @ApiResponse(responseCode = "400", description = "wrong issue data")}) - @PutMapping(value = "/", consumes = MediaType.APPLICATION_JSON_VALUE) + @PutMapping(value = "/issue", consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity createEdgc(@Valid @RequestBody Eudgc eudgc) { EgdcCodeData egdcCodeData = dgciService.createEdgc(eudgc); return ResponseEntity.ok(egdcCodeData); } - // Public API to get DID document of certification not needed in current architecture - @GetMapping(value = "/V1/DE/{opaque}/{hash}") + @Operation( + summary = "Returns a DID document" + ) + @GetMapping(value = "/{hash}") public ResponseEntity getDidDocument(@PathVariable String opaque, String hash) { - return ResponseEntity.ok(dgciService.getDidDocument(opaque, hash)); + return ResponseEntity.ok(dgciService.getDidDocument(hash)); } @Operation( - summary = "Produce status message", + summary = "Checks the status of DGCI", description = "Produce status message" ) @GetMapping(value = "/status") - public ResponseEntity hello() { + public ResponseEntity status() { + // not was not really specified what it is good for return ResponseEntity.ok("fine"); } } diff --git a/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/WalletController.java b/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/WalletController.java index d4d61be..e9f088b 100644 --- a/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/WalletController.java +++ b/src/main/java/eu/europa/ec/dgc/issuance/restapi/controller/WalletController.java @@ -44,20 +44,23 @@ public class WalletController { private final DgciService dgciService; @Operation( - summary = "claim dgci", + summary = "Claims the DGCI for a TAN and certificate Holder", description = "claim, assign dgci public key by TAN" ) @ApiResponses(value = { @ApiResponse(responseCode = "204", description = "successful claim"), @ApiResponse(responseCode = "404", description = "dgci not found"), @ApiResponse(responseCode = "400", description = "wrong claim data")}) - @PostMapping(value = "", consumes = MediaType.APPLICATION_JSON_VALUE) + @PostMapping(value = "/claim", consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity claimUpdate(@Valid @RequestBody ClaimRequest claimRequest) { return ResponseEntity.status(HttpStatus.NO_CONTENT).build(); } - @PatchMapping(value = "", consumes = MediaType.APPLICATION_JSON_VALUE) + @Operation( + summary = "Claims the DGCI for a new TAN and certificate Holder" + ) + @PatchMapping(value = "/claim", consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity claim(@Valid @RequestBody ClaimRequest claimRequest) { return ResponseEntity.ok(dgciService.claimUpdate(claimRequest)); diff --git a/src/main/java/eu/europa/ec/dgc/issuance/service/DgciService.java b/src/main/java/eu/europa/ec/dgc/issuance/service/DgciService.java index 206d8ec..4a40a60 100644 --- a/src/main/java/eu/europa/ec/dgc/issuance/service/DgciService.java +++ b/src/main/java/eu/europa/ec/dgc/issuance/service/DgciService.java @@ -156,11 +156,10 @@ public SignatureData finishDgci(long dgciId, IssueData issueData) throws Excepti /** * get did document. * - * @param opaque opaque - * @param hash hash + * @param hash hash * @return didDocument */ - public DidDocument getDidDocument(String opaque, String hash) { + public DidDocument getDidDocument(String hash) { DidDocument didDocument = new DidDocument(); didDocument.setContext("https://w3id.org/did/v1"); // TODO DID fake data