From 2cdaccb63c0f01b42ca1b83749ee42b537620919 Mon Sep 17 00:00:00 2001 From: Remigiusz Janeczek Date: Fri, 2 Jul 2021 09:49:20 +0200 Subject: [OOM-CERT-SERVICE] Remove CaMode from Cmpv2Server configuration Issue-ID: OOM-2753 Signed-off-by: Remigiusz Janeczek Change-Id: I10662551a315a0b38b1213513d07ab2a4ccf5326 --- .../certification/configuration/model/CaMode.java | 35 ---------------------- .../configuration/model/Cmpv2Server.java | 18 +++-------- .../validation/CmpCertificationValidator.java | 5 +--- 3 files changed, 5 insertions(+), 53 deletions(-) delete mode 100644 certService/src/main/java/org/onap/oom/certservice/certification/configuration/model/CaMode.java (limited to 'certService/src/main/java/org') diff --git a/certService/src/main/java/org/onap/oom/certservice/certification/configuration/model/CaMode.java b/certService/src/main/java/org/onap/oom/certservice/certification/configuration/model/CaMode.java deleted file mode 100644 index 9980ef50..00000000 --- a/certService/src/main/java/org/onap/oom/certservice/certification/configuration/model/CaMode.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * PROJECT - * ================================================================================ - * Copyright (C) 2020 Nokia. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.oom.certservice.certification.configuration.model; - -public enum CaMode { - RA("RA"), CLIENT("Client"); - - private String profile; - - CaMode(String profile) { - this.profile = profile; - } - - public String getProfile() { - return profile; - } -} diff --git a/certService/src/main/java/org/onap/oom/certservice/certification/configuration/model/Cmpv2Server.java b/certService/src/main/java/org/onap/oom/certservice/certification/configuration/model/Cmpv2Server.java index b27f2888..d2b62f7f 100644 --- a/certService/src/main/java/org/onap/oom/certservice/certification/configuration/model/Cmpv2Server.java +++ b/certService/src/main/java/org/onap/oom/certservice/certification/configuration/model/Cmpv2Server.java @@ -1,8 +1,8 @@ /* * ============LICENSE_START======================================================= - * PROJECT + * Cert Service * ================================================================================ - * Copyright (C) 2020 Nokia. All rights reserved. + * Copyright (C) 2020-2021 Nokia. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +23,12 @@ package org.onap.oom.certservice.certification.configuration.model; import javax.validation.Valid; import javax.validation.constraints.NotNull; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.bouncycastle.asn1.x500.X500Name; import org.hibernate.validator.constraints.Length; import org.onap.oom.certservice.certification.configuration.validation.constraints.Cmpv2Url; +@JsonIgnoreProperties(ignoreUnknown = true) public class Cmpv2Server { private static final int MAX_CA_NAME_LENGTH = 128; @@ -35,8 +37,6 @@ public class Cmpv2Server { @Valid private Authentication authentication; @NotNull - private CaMode caMode; - @NotNull @Length(min = 1, max = MAX_CA_NAME_LENGTH) private String caName; @NotNull @@ -52,14 +52,6 @@ public class Cmpv2Server { this.authentication = authentication; } - public CaMode getCaMode() { - return caMode; - } - - public void setCaMode(CaMode caMode) { - this.caMode = caMode; - } - public String getCaName() { return caName; } @@ -88,11 +80,9 @@ public class Cmpv2Server { public String toString() { return "Cmpv2Server{" + "authentication=" + authentication - + ", caMode=" + caMode + ", caName='" + caName + '\'' + ", issuerDN='" + issuerDN + '\'' + ", url='" + url + '\'' + '}'; } - } diff --git a/certService/src/main/java/org/onap/oom/certservice/cmpv2client/validation/CmpCertificationValidator.java b/certService/src/main/java/org/onap/oom/certservice/cmpv2client/validation/CmpCertificationValidator.java index 40a2a1d9..0d908bea 100644 --- a/certService/src/main/java/org/onap/oom/certservice/cmpv2client/validation/CmpCertificationValidator.java +++ b/certService/src/main/java/org/onap/oom/certservice/cmpv2client/validation/CmpCertificationValidator.java @@ -36,7 +36,6 @@ import org.bouncycastle.asn1.cmp.CertResponse; import org.bouncycastle.asn1.cmp.PKIHeader; import org.bouncycastle.asn1.cmp.PKIMessage; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; -import org.onap.oom.certservice.certification.configuration.model.CaMode; import org.onap.oom.certservice.certification.configuration.model.Cmpv2Server; import org.onap.oom.certservice.certification.model.CsrModel; import org.onap.oom.certservice.cmpv2client.exceptions.CmpClientException; @@ -48,7 +47,6 @@ import org.slf4j.LoggerFactory; public class CmpCertificationValidator { private static final String DEFAULT_CA_NAME = "Certification Authority"; - private static final String DEFAULT_PROFILE = CaMode.RA.getProfile(); private static final ASN1ObjectIdentifier PASSWORD_BASED_MAC = new ASN1ObjectIdentifier("1.2.840.113533.7.66.13"); private static final Logger LOG = LoggerFactory.getLogger(CmpCertificationValidator.class); @@ -60,9 +58,8 @@ public class CmpCertificationValidator { final Date notAfter) { String caName = CmpUtil.isNullOrEmpty(server.getCaName()) ? server.getCaName() : DEFAULT_CA_NAME; - String profile = server.getCaMode() != null ? server.getCaMode().getProfile() : DEFAULT_PROFILE; LOG.info( - "Validate before creating Certificate Request for CA :{} in Mode {} ", caName, profile); + "Validate before creating Certificate Request for CA: {}", caName); CmpUtil.notNull(csrModel, "CsrModel Instance"); CmpUtil.notNull(csrModel.getSubjectData(), "Subject DN"); -- cgit 1.2.3-korg