aboutsummaryrefslogtreecommitdiffstats
path: root/certService/src/main/java/org/onap/aaf/certservice/api/CertificationController.java
diff options
context:
space:
mode:
authorBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2020-02-27 10:26:32 +0100
committerTomasz Golabek <tomasz.golabek@nokia.com>2020-03-05 13:44:05 +0100
commitd43531d4072653b86cc86459816e54806ad589c2 (patch)
tree1a19068cede89992c4f37e8e8b25ec6afc94b53c /certService/src/main/java/org/onap/aaf/certservice/api/CertificationController.java
parent8f26d1f4274f18bd9502386700919933045e2316 (diff)
Create adapter for Cmpv2Client
connected-with: https://gerrit.onap.org/r/c/aaf/certservice/+/102401 Issue-ID: AAF-997 Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> Signed-off-by: Tomasz Golabek <tomasz.golabek@nokia.com> Change-Id: Ieb85cd9c93f7a5470fca37a9de4bead3c543199a
Diffstat (limited to 'certService/src/main/java/org/onap/aaf/certservice/api/CertificationController.java')
-rw-r--r--certService/src/main/java/org/onap/aaf/certservice/api/CertificationController.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/certService/src/main/java/org/onap/aaf/certservice/api/CertificationController.java b/certService/src/main/java/org/onap/aaf/certservice/api/CertificationController.java
index e663909c..abb6811b 100644
--- a/certService/src/main/java/org/onap/aaf/certservice/api/CertificationController.java
+++ b/certService/src/main/java/org/onap/aaf/certservice/api/CertificationController.java
@@ -24,9 +24,13 @@ import com.google.gson.Gson;
import org.onap.aaf.certservice.certification.CertificationModelFactory;
import org.onap.aaf.certservice.certification.CsrModelFactory;
import org.onap.aaf.certservice.certification.CsrModelFactory.StringBase64;
+import org.onap.aaf.certservice.certification.configuration.Cmpv2ServerProvider;
+import org.onap.aaf.certservice.certification.configuration.model.Cmpv2Server;
+import org.onap.aaf.certservice.certification.exception.Cmpv2ClientAdapterException;
import org.onap.aaf.certservice.certification.exception.DecryptionException;
import org.onap.aaf.certservice.certification.model.CertificationModel;
import org.onap.aaf.certservice.certification.model.CsrModel;
+import org.onap.aaf.certservice.cmpv2client.exceptions.CmpClientException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -43,12 +47,10 @@ public class CertificationController {
private static final Logger LOGGER = LoggerFactory.getLogger(CertificationController.class);
- private final CsrModelFactory csrModelFactory;
private final CertificationModelFactory certificationModelFactory;
@Autowired
- CertificationController(CsrModelFactory csrModelFactory, CertificationModelFactory certificationModelFactory) {
- this.csrModelFactory = csrModelFactory;
+ CertificationController(CertificationModelFactory certificationModelFactory) {
this.certificationModelFactory = certificationModelFactory;
}
@@ -66,17 +68,11 @@ public class CertificationController {
@PathVariable String caName,
@RequestHeader("CSR") String encodedCsr,
@RequestHeader("PK") String encodedPrivateKey
- ) throws DecryptionException {
-
+ ) throws DecryptionException, CmpClientException, Cmpv2ClientAdapterException {
caName = caName.replaceAll("[\n|\r|\t]", "_");
LOGGER.info("Received certificate signing request for CA named: {}", caName);
- CsrModel csrModel = csrModelFactory.createCsrModel(
- new StringBase64(encodedCsr),
- new StringBase64(encodedPrivateKey)
- );
- LOGGER.debug("Received CSR meta data: \n{}", csrModel);
CertificationModel certificationModel = certificationModelFactory
- .createCertificationModel(csrModel, caName);
+ .createCertificationModel(encodedCsr, encodedPrivateKey, caName);
return new ResponseEntity<>(new Gson().toJson(certificationModel), HttpStatus.OK);
}