summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/dmaap/commonauth/kafka/base/authorization/Cadi3AAFProvider.java9
-rw-r--r--src/test/java/org/onap/dmaap/commonauth/kafka/base/authorization/Cadi3AAFProviderTest.java2
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");
}