From 6f95532eadcfd6c3a154b4e22dbc085e81cda6e6 Mon Sep 17 00:00:00 2001 From: Piotr Marcinkiewicz Date: Thu, 15 Jul 2021 09:35:21 +0200 Subject: [OOM-CERT-SERVICE] Update OpenAPI - Update OpenAPI after introduction certificate update endpoint Issue-ID: OOM-2753 Signed-off-by: Piotr Marcinkiewicz Change-Id: I16117a9dc9f854ba04b39ca1133c19d052e8f7db --- certService/README.md | 4 ++-- .../certservice/api/CertificationController.java | 24 ++++++++++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'certService') diff --git a/certService/README.md b/certService/README.md index b7d4fdd6..76bfba23 100644 --- a/certService/README.md +++ b/certService/README.md @@ -95,9 +95,9 @@ audit.log error.log debug.log API is described by Swagger ( OpenAPI 3.0 ) on endpoint /docs ( endpoint is defined in properties as springdoc.swagger-ui.path ) ``` -http://localchost:8080/docs +http://localhost:8080/docs ``` ### OpenAPI during project building yaml file with openAPI 3.0 documentation is generated in target directory with name api-docs.yaml -file OpenAPI.yaml located in certService directory must be update be hand if needed +file OpenAPI.yaml located in ./docs/sections/resources directory must be updated be hand if needed diff --git a/certService/src/main/java/org/onap/oom/certservice/api/CertificationController.java b/certService/src/main/java/org/onap/oom/certservice/api/CertificationController.java index 987d56ea..931ad8c6 100644 --- a/certService/src/main/java/org/onap/oom/certservice/api/CertificationController.java +++ b/certService/src/main/java/org/onap/oom/certservice/api/CertificationController.java @@ -28,6 +28,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import org.onap.oom.certservice.certification.CertificationResponseModelFactory; +import org.onap.oom.certservice.certification.exception.CertificateDecryptionException; import org.onap.oom.certservice.certification.exception.DecryptionException; import org.onap.oom.certservice.certification.exception.ErrorResponseModel; import org.onap.oom.certservice.certification.model.CertificateUpdateModel; @@ -72,11 +73,11 @@ public class CertificationController { content = @Content(schema = @Schema(implementation = ErrorResponseModel.class))), @ApiResponse(responseCode = "404", description = "CA not found for given name", content = @Content(schema = @Schema(implementation = ErrorResponseModel.class))), - @ApiResponse(responseCode = "500", description = "Something went wrong during connectiion to CMPv2 server", + @ApiResponse(responseCode = "500", description = "Something went wrong during connection to CMPv2 server", content = @Content(schema = @Schema(implementation = ErrorResponseModel.class))) }) @Operation( - summary = "initialize certificate", + summary = "Initialize certificate", description = "Web endpoint for requesting certificate initialization. Used by system components to gain certificate signed by CA.", tags = {"CertificationService"}) public ResponseEntity signCertificate( @@ -105,11 +106,30 @@ public class CertificationController { * @return JSON containing trusted certificates and certificate chain */ @GetMapping(value = "v1/certificate-update/{caName}", produces = "application/json") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Certificate successfully updated"), + @ApiResponse(responseCode = "400", description = "Given CSR, PK, old certificate or/and old PK is incorrect", + content = @Content(schema = @Schema(implementation = ErrorResponseModel.class))), + @ApiResponse(responseCode = "404", description = "CA not found for given name", + content = @Content(schema = @Schema(implementation = ErrorResponseModel.class))), + @ApiResponse(responseCode = "500", description = "Something went wrong during connection to CMPv2 server", + content = @Content(schema = @Schema(implementation = ErrorResponseModel.class))) + }) + @Operation( + summary = "Update certificate", + description = "Web endpoint for updating certificate. Used by system components to update certificate signed by CA.", + tags = {"CertificationService"}) public ResponseEntity updateCertificate( + @Parameter(description = "Name of certification authority that will update certificate.") @PathVariable String caName, + @Parameter(description = "Certificate signing request in form of PEM object encoded in Base64 (with header and footer).") @RequestHeader("CSR") String encodedCsr, + @Parameter(description = "Private key in form of PEM object encoded in Base64 (with header and footer).") @RequestHeader("PK") String encodedPrivateKey, + @Parameter(description = "Old certificate in form of PEM object encoded in Base64 (with header and footer).") @RequestHeader("OLD_CERT") String encodedOldCert, + @Parameter(description = "Old private key (corresponding with old certificate) " + + "in form of PEM object encoded in Base64 (with header and footer).") @RequestHeader("OLD_PK") String encodedOldPrivateKey ) throws DecryptionException, CmpClientException { caName = replaceWhiteSpaceChars(caName); -- cgit 1.2.3-korg