import org.apache.commons.codec.binary.Base64;
import org.apache.commons.jcs.JCS;
import org.apache.commons.jcs.access.CacheAccess;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.jcs.JCS;
import org.apache.commons.jcs.access.CacheAccess;
+import org.apache.commons.jcs.engine.CompositeCacheAttributes;
+import org.apache.commons.jcs.engine.ElementAttributes;
+import org.apache.commons.jcs.engine.behavior.ICompositeCacheAttributes;
+import org.apache.commons.jcs.engine.behavior.IElementAttributes;
import org.mindrot.jbcrypt.BCrypt;
import org.onap.music.authentication.MusicAuthenticator.Operation;
import org.onap.music.datastore.PreparedQueryObject;
import org.mindrot.jbcrypt.BCrypt;
import org.onap.music.authentication.MusicAuthenticator.Operation;
import org.onap.music.datastore.PreparedQueryObject;
private static Map<String, Number> userAttempts = new HashMap<>();
private static Map<String, Calendar> lastFailedTime = new HashMap<>();
private static CacheAccess<String, String> adminUserCache = JCS.getInstance("adminUserCache");
private static Map<String, Number> userAttempts = new HashMap<>();
private static Map<String, Calendar> lastFailedTime = new HashMap<>();
private static CacheAccess<String, String> adminUserCache = JCS.getInstance("adminUserCache");
public static void updateAdminUserCache(String authorization,String userId) {
adminUserCache.put(authorization,userId);
}
public static void updateAdminUserCache(String authorization,String userId) {
adminUserCache.put(authorization,userId);
}
- logger.error(EELFLoggerDelegate.errorLogger, e1.getMessage(),AppMessages.CACHEERROR, ErrorSeverity
- .CRITICAL, ErrorTypes.GENERALSERVICEERROR, e1);
+ logger.error(EELFLoggerDelegate.errorLogger, e1.getMessage(),AppMessages.CACHEERROR,
+ ErrorSeverity.CRITICAL, ErrorTypes.GENERALSERVICEERROR, e1);
response.bufferEntity();
String x = response.getEntity(String.class);
AAFResponse responseObj = new ObjectMapper().readValue(x, AAFResponse.class);*/
response.bufferEntity();
String x = response.getEntity(String.class);
AAFResponse responseObj = new ObjectMapper().readValue(x, AAFResponse.class);*/
public static void updateCadiCache(String user, String keyspace) {
musicCache.put(user, keyspace);
}
public static void updateCadiCache(String user, String keyspace) {
musicCache.put(user, keyspace);
}
public static void updateMusicValidateCache(String nameSpace, String userId, String password) {
logger.info(EELFLoggerDelegate.applicationLogger,"Updating musicCache for nameSpacce " + nameSpace + " with userId " + userId);
Map<String, String> map = new HashMap<>();
map.put(userId, password);
musicValidateCache.put(nameSpace, map);
}
public static void updateMusicValidateCache(String nameSpace, String userId, String password) {
logger.info(EELFLoggerDelegate.applicationLogger,"Updating musicCache for nameSpacce " + nameSpace + " with userId " + userId);
Map<String, String> map = new HashMap<>();
map.put(userId, password);
musicValidateCache.put(nameSpace, map);
}
public static void updateisAAFCache(String namespace, String isAAF) {
appNameCache.put(namespace, isAAF);
}
public static void updateisAAFCache(String namespace, String isAAF) {
appNameCache.put(namespace, isAAF);
}
public static Map<String, Object> verifyOnboarding(String ns, String userId, String password) {
Map<String, Object> resultMap = new HashMap<>();
if (ns == null || userId == null || password == null) {
public static Map<String, Object> verifyOnboarding(String ns, String userId, String password) {
Map<String, Object> resultMap = new HashMap<>();
if (ns == null || userId == null || password == null) {
}
public static Map<String, Object> authenticateAIDUser(String nameSpace, String userId, String password,
}
public static Map<String, Object> authenticateAIDUser(String nameSpace, String userId, String password,
&& (musicValidateCache.get(nameSpace).containsKey(userId))) {
if(!musicCache.get(keyspace).equals(nameSpace)) {
resultMap.put("Exception", "Namespace and keyspace doesn't match");
&& (musicValidateCache.get(nameSpace).containsKey(userId))) {
if(!musicCache.get(keyspace).equals(nameSpace)) {
resultMap.put("Exception", "Namespace and keyspace doesn't match");