diff options
author | su622b <su622b@att.com> | 2020-03-11 11:03:27 -0400 |
---|---|---|
committer | su622b <su622b@att.com> | 2020-03-11 11:03:42 -0400 |
commit | a5389cc3594ee259631163bdebd4bf86cef357aa (patch) | |
tree | 6667dfe87ab9477fce2a632f8a95ed7e603f5888 /src | |
parent | 4431ebfb911dcbd1dfec1a82c1646fb2402e31b2 (diff) |
Sonar Cloud migration changes
Issue-ID: DMAAP-1407
Change-Id: I8da1faa13512b16c19862412e76712a30c522a16
Signed-off-by: su622b <su622b@att.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/onap/dmaap/commonauth/kafka/base/authorization/Cadi3AAFProvider.java | 9 | ||||
-rw-r--r-- | src/test/java/org/onap/dmaap/commonauth/kafka/base/authorization/Cadi3AAFProviderTest.java | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/org/onap/dmaap/commonauth/kafka/base/authorization/Cadi3AAFProvider.java b/src/main/java/org/onap/dmaap/commonauth/kafka/base/authorization/Cadi3AAFProvider.java index 56fd1bb..b5193cc 100644 --- a/src/main/java/org/onap/dmaap/commonauth/kafka/base/authorization/Cadi3AAFProvider.java +++ b/src/main/java/org/onap/dmaap/commonauth/kafka/base/authorization/Cadi3AAFProvider.java @@ -54,10 +54,16 @@ public class Cadi3AAFProvider implements AuthorizationProvider { private static final Logger logger = LoggerFactory.getLogger(Cadi3AAFProvider.class); static { - + if (System.getProperty("enableCadi") != null) { + if (System.getProperty("enableCadi").equals("true")) { + enableCadi = true; + } + } + else{ if (System.getenv("enableCadi") != null && System.getenv("enableCadi").equals("true")) { enableCadi = true; } + } Configuration config = Configuration.getConfiguration(); try { if (config == null) { @@ -181,7 +187,6 @@ public class Cadi3AAFProvider implements AuthorizationProvider { logger.info("^Event received with username " + userId); - boolean enableCadi = System.getenv("enableCadi") == null ? true : false; if (!enableCadi) { return null; } else { diff --git a/src/test/java/org/onap/dmaap/commonauth/kafka/base/authorization/Cadi3AAFProviderTest.java b/src/test/java/org/onap/dmaap/commonauth/kafka/base/authorization/Cadi3AAFProviderTest.java index 743917d..8bd8486 100644 --- a/src/test/java/org/onap/dmaap/commonauth/kafka/base/authorization/Cadi3AAFProviderTest.java +++ b/src/test/java/org/onap/dmaap/commonauth/kafka/base/authorization/Cadi3AAFProviderTest.java @@ -61,6 +61,7 @@ public class Cadi3AAFProviderTest { @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); + System.setProperty("enableCadi", "true"); System.setProperty("CADI_PROPERTIES", "src/test/resources/cadi.properties"); cadi3AAFProvider = new Cadi3AAFProvider(); } @@ -77,6 +78,7 @@ public class Cadi3AAFProviderTest { @Test(expected = NullPointerException.class) public void tesAuthenticate() throws Exception { + System.setProperty("enableCadi", "true"); when(aafAuthn.validate("userId", "password")).thenReturn("valid"); assertEquals(cadi3AAFProvider.authenticate("userId", "password"), "valid"); } |