import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.onap.aaf.certservice.certification.CertificationModelFactory;
-import org.onap.aaf.certservice.certification.exception.Cmpv2ClientAdapterException;
import org.onap.aaf.certservice.certification.exception.DecryptionException;
import org.onap.aaf.certservice.certification.exception.ErrorResponseModel;
import org.onap.aaf.certservice.certification.model.CertificationModel;
/**
* Request for signing certificate by given CA.
*
- *
- * @param caName the name of Certification Authority that will sign root certificate
- * @param encodedCsr Certificate Sign Request encoded in Base64 form
+ * @param caName the name of Certification Authority that will sign root certificate
+ * @param encodedCsr Certificate Sign Request encoded in Base64 form
* @param encodedPrivateKey Private key for CSR, needed for PoP, encoded in Base64 form
* @return JSON containing trusted certificates and certificate chain
*/
- @GetMapping(value = "v1/certificate/{caName}", produces = "application/json; charset=utf-8")
+ @GetMapping(value = "v1/certificate/{caName}", produces = "application/json")
@ApiResponses(value = {
- @ApiResponse(responseCode = "200", description = "certificate successfully signed"),
- @ApiResponse(responseCode = "400", description = "given CSR or/and PK is incorrect",
+ @ApiResponse(responseCode = "200", description = "Certificate successfully signed"),
+ @ApiResponse(responseCode = "400", description = "Given CSR or/and 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 connecting to cmp client",
+ @ApiResponse(responseCode = "500", description = "Something went wrong during connectiion to CMPv2 server",
content = @Content(schema = @Schema(implementation = ErrorResponseModel.class)))
})
@Operation(
summary = "sign certificate",
description = "Web endpoint for requesting certificate signing. Used by system components to gain certificate signed by CA.",
- tags = { "CertificationService" })
+ tags = {"CertificationService"})
public ResponseEntity<CertificationModel> signCertificate(
- @Parameter(description="Name of certification authority that will sign CSR.")
+ @Parameter(description = "Name of certification authority that will sign CSR.")
@PathVariable String caName,
- @Parameter(description="Certificate signing request in form of PEM object encoded in Base64 (with header and footer).")
+ @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).")
+ @Parameter(description = "Private key in form of PEM object encoded in Base64 (with header and footer).")
@RequestHeader("PK") String encodedPrivateKey
- ) throws DecryptionException, CmpClientException, Cmpv2ClientAdapterException {
+ ) throws DecryptionException, CmpClientException {
caName = caName.replaceAll("[\n|\r|\t]", "_");
LOGGER.info("Received certificate signing request for CA named: {}", caName);
CertificationModel certificationModel = certificationModelFactory