From acfd496667eb43d2429a141a4ae44d7207bbcf43 Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Fri, 14 Sep 2018 15:23:32 +0530 Subject: RDN.java: Fixed sonar code smells Sonar link: https://sonar.onap.org/code?id=org.onap.aaf.authz%3Aparent&selected=org.onap.aaf.authz%3Aaaf-auth-certman%3Asrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fcm%2Fcert%2FRDN.java Issue-ID: AAF-496 Change-Id: I2fcbf7e9baf6e8a07baf03e829367468adf770d7 Signed-off-by: Arundathi Patil --- .../main/java/org/onap/aaf/auth/cm/cert/RDN.java | 42 ++++++++++++++-------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'auth') diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/RDN.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/RDN.java index f57c837a..fe4e20ff 100644 --- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/RDN.java +++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/RDN.java @@ -35,22 +35,36 @@ public class RDN { public RDN(final String tagValue) throws CertException { String[] tv = Split.splitTrim('=',tagValue); switch(tv[0]) { - case "cn":case "CN": aoi = BCStyle.CN; break; - case "c":case "C": aoi = BCStyle.C;break; - case "st":case "ST": aoi = BCStyle.ST;break; - case "l":case "L": aoi = BCStyle.L;break; - case "o":case "O": aoi = BCStyle.O;break; - case "ou":case "OU": aoi = BCStyle.OU;break; - case "dc":case "DC": aoi = BCStyle.DC;break; - case "gn":case "GN": aoi = BCStyle.GIVENNAME; break; - case "sn":case "SN": aoi = BCStyle.SN; break; // surname + case "cn":case "CN": aoi = BCStyle.CN; + break; + case "c":case "C": aoi = BCStyle.C; + break; + case "st":case "ST": aoi = BCStyle.ST; + break; + case "l":case "L": aoi = BCStyle.L; + break; + case "o":case "O": aoi = BCStyle.O; + break; + case "ou":case "OU": aoi = BCStyle.OU; + break; + case "dc":case "DC": aoi = BCStyle.DC; + break; + case "gn":case "GN": aoi = BCStyle.GIVENNAME; + break; + case "sn":case "SN": aoi = BCStyle.SN; + break; // surname case "email":case "EMAIL": case "emailaddress": - case "EMAILADDRESS": aoi = BCStyle.EmailAddress;break; // should be SAN extension - case "initials": aoi = BCStyle.INITIALS; break; - case "pseudonym": aoi = BCStyle.PSEUDONYM; break; - case "generationQualifier": aoi = BCStyle.GENERATION; break; - case "serialNumber": aoi = BCStyle.SERIALNUMBER; break; + case "EMAILADDRESS": aoi = BCStyle.EmailAddress; + break; // should be SAN extension + case "initials": aoi = BCStyle.INITIALS; + break; + case "pseudonym": aoi = BCStyle.PSEUDONYM; + break; + case "generationQualifier": aoi = BCStyle.GENERATION; + break; + case "serialNumber": aoi = BCStyle.SERIALNUMBER; + break; default: throw new CertException("Unknown ASN1ObjectIdentifier for " + tv[0] + " in " + tagValue); } -- cgit 1.2.3-korg