summaryrefslogtreecommitdiffstats
path: root/cadi
diff options
context:
space:
mode:
Diffstat (limited to 'cadi')
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java23
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java2
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java2
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java2
4 files changed, 19 insertions, 10 deletions
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java b/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java
index be1e739b..cf5c92d0 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java
@@ -154,7 +154,7 @@ public abstract class AbsUserCache<PERM extends Permission> {
}
Miss miss = missMap.get(mkey);
if(miss==null) {
- missMap.put(mkey, new Miss(bs,clean==null?MIN_INTERVAL:clean.timeInterval));
+ missMap.put(mkey, new Miss(bs,clean==null?MIN_INTERVAL:clean.timeInterval,key));
return true;
}
return miss.mayContinue();
@@ -376,12 +376,17 @@ public abstract class AbsUserCache<PERM extends Permission> {
keys.addAll(missMap.keySet());
for(String key : keys) {
Miss m = missMap.get(key);
- if(m!=null && m.timestamp<System.currentTimeMillis()) {
- synchronized(missMap) {
- missMap.remove(key);
+ if(m!=null) {
+ long timeLeft = m.timestamp - System.currentTimeMillis();
+ if(timeLeft<0) {
+ synchronized(missMap) {
+ missMap.remove(key);
+ }
+ access.log(Level.INFO, m.name, " has been removed from Missed Credential Map (" + m.tries + " invalid tries)");
+ ++miss;
+ } else {
+ access.log(Level.INFO, m.name, " remains in Missed Credential Map (" + m.tries + " invalid tries) for " + (timeLeft/1000) + " more seconds");
}
- access.log(Level.INFO, key, "has been removed from Missed Credential Map (" + m.tries + " invalid tries)");
- ++miss;
}
}
}
@@ -419,11 +424,14 @@ public abstract class AbsUserCache<PERM extends Permission> {
private long timetolive;
private long tries;
+
+ private final String name;
- public Miss(byte[] first, long timeInterval) {
+ public Miss(final byte[] first, final long timeInterval, final String name) {
timestamp = System.currentTimeMillis() + timeInterval;
this.timetolive = timeInterval;
tries = 0L;
+ this.name = name;
}
@@ -437,6 +445,7 @@ public abstract class AbsUserCache<PERM extends Permission> {
}
return true;
}
+
}
/**
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 26ad758f..c4634cf4 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
@@ -142,7 +142,7 @@ public class Config {
public static final String AAF_APPPASS = "aaf_password";
public static final String AAF_LUR_CLASS = "aaf_lur_class";
public static final String AAF_TAF_CLASS = "aaf_taf_class";
- public static final String AAF_TAF_CLASS_DEF = "org.osaaf.cadi.aaf.v2_0.AAFTaf";
+ public static final String AAF_TAF_CLASS_DEF = "org.onap.aaf.cadi.aaf.v2_0.AAFTaf";
public static final String AAF_CONNECTOR_CLASS = "aaf_connector_class";
public static final String AAF_LOCATOR_CLASS = "aaf_locator_class";
public static final String AAF_CONN_TIMEOUT = "aaf_conn_timeout";
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java
index 6a49401c..22ba702c 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java
@@ -121,6 +121,6 @@ public class BasicPrincipal extends BearerPrincipal implements GetCred {
@Override
public String personalName() {
- return null; // personalName not available with Basic Auth
+ return name; // personalName not available with Basic Auth
}
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java
index dee7fc21..1fafe2e8 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java
@@ -103,7 +103,7 @@ public class JU_BasicPrincipal {
assertTrue(Math.abs(bp.created() - created) < 10);
assertThat(bp.toString(), is(expected));
assertThat(bp.tag(), is("BAth"));
- assertThat(bp.personalName(), is(nullValue()));
+ assertThat(bp.personalName(), is(bp.getName()));
// This test hits the abstract class BearerPrincipal
assertThat(bp.getBearer(), is(bearer));