summaryrefslogtreecommitdiffstats
path: root/cadi/core
diff options
context:
space:
mode:
authorInstrumental <jcgmisc@stl.gathman.org>2018-03-29 21:40:16 -0500
committerInstrumental <jcgmisc@stl.gathman.org>2018-03-29 21:40:24 -0500
commitb126c6c5f625432722405538692184f5c74edaad (patch)
treedcbc3a52cb13064356fa650c56fe9c90c475f6ff /cadi/core
parent36b62be84b398044e1feae657c662dba6247782f (diff)
Clean up Sonar results 3
Issue-ID: AAF-206 Change-Id: I4494990e8e0bd702b475bbbfb140eaadd566d2a0 Signed-off-by: Instrumental <jcgmisc@stl.gathman.org>
Diffstat (limited to 'cadi/core')
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java3
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java3
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java22
3 files changed, 20 insertions, 8 deletions
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java
index 90f14405..99bdb49c 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java
@@ -28,8 +28,6 @@ import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
import java.security.NoSuchAlgorithmException;
import org.onap.aaf.cadi.util.Chmod;
@@ -160,7 +158,6 @@ public class CmdLine {
if((idx = line.indexOf(' '))>=0
&& (idx = line.indexOf(' ',++idx))>0
&& (idx = line.indexOf('=',++idx))>0
- && (idx = line.indexOf('=',++idx))>0
) {
System.out.println(line.substring(0, idx-5));
int start = idx+2;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
index 07e9b592..bd1ad72d 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
@@ -38,7 +38,8 @@ import org.onap.aaf.cadi.config.SecurityInfo;
import java.util.Properties;
public class PropAccess implements Access {
- private static final SimpleDateFormat iso8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
+ // Sonar says cannot be static... it's ok. not too many PropAccesses created.
+ private final SimpleDateFormat iso8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
public static Level DEFAULT = Level.AUDIT;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
index a66b6880..0c011541 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
@@ -380,7 +380,13 @@ public class Config {
/////////////////////////////////////////////////////
if(!hasOAuthDirectTAF) {
String oauth_token_url = logProp(access,Config.AAF_OAUTH2_TOKEN_URL,null);
- if(additionalTafLurs!=null && additionalTafLurs.length>0 && additionalTafLurs[0].getClass().getName().equals("org.osaaf.authz.oauth.OAuthDirectTAF")) {
+ Class<?> oadtClss;
+ try {
+ oadtClss = Class.forName("org.osaaf.authz.oauth.OAuthDirectTAF");
+ } catch (ClassNotFoundException e1) {
+ oadtClss = null;
+ }
+ if(additionalTafLurs!=null && additionalTafLurs.length>0 && (oadtClss!=null && additionalTafLurs[0].getClass().isAssignableFrom(oadtClss))) {
htlist.add((HttpTaf)additionalTafLurs[0]);
String array[] = new String[additionalTafLurs.length-1];
if(array.length>0) {
@@ -428,9 +434,17 @@ public class Config {
if(additional instanceof HttpTaf) {
htlist.add((HttpTaf)additional);
access.printf(Level.INIT,"%s Authentication is enabled",additional.getClass().getSimpleName());
- } else if(hasOAuthDirectTAF && additional.getClass().getSimpleName().equals("DirectAAFUserPass")) {
- htlist.add(new BasicHttpTaf(access, (CredVal)additional , basic_realm, userExp, basic_warn));
- access.printf(Level.INIT,"Direct BasicAuth Authentication is enabled",additional.getClass().getSimpleName());
+ } else if(hasOAuthDirectTAF) {
+ Class<?> daupCls;
+ try {
+ daupCls = Class.forName("org.onap.aaf.auth.direct.DirectAAFUserPass");
+ } catch (ClassNotFoundException e) {
+ daupCls = null;
+ }
+ if(daupCls != null && additional.getClass().isAssignableFrom(daupCls)) {
+ htlist.add(new BasicHttpTaf(access, (CredVal)additional , basic_realm, userExp, basic_warn));
+ access.printf(Level.INIT,"Direct BasicAuth Authentication is enabled",additional.getClass().getSimpleName());
+ }
}
}
}