* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.sa.auth;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.json.simple.parser.JSONParser;
-import org.json.simple.parser.ParseException;
-import org.onap.aai.sa.searchdbabstraction.util.SearchDbConstants;
-import org.openecomp.cl.api.Logger;
-import org.openecomp.cl.eelf.LoggerFactory;
-
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.List;
import java.util.Map;
import java.util.Timer;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+import org.onap.aai.cl.api.Logger;
+import org.onap.aai.cl.eelf.LoggerFactory;
+import org.onap.aai.sa.searchdbabstraction.util.SearchDbConstants;
public class SearchDbServiceAuthCore {
private static Logger logger = LoggerFactory.getInstance()
- .getLogger(SearchDbServiceAuthCore.class.getName());
+ .getLogger(SearchDbServiceAuthCore.class.getName());
private static String GlobalAuthFileName = SearchDbConstants.SDB_AUTH_CONFIG_FILENAME;
public static String getConfigFile() {
if (GlobalAuthFileName == null) {
- String nc = SearchDbConstants.SDB_AUTH_CONFIG_FILENAME;
+ String nc = GlobalAuthFileName;
if (nc == null) {
nc = "/home/aaiadmin/etc/aaipolicy.json";
}
-
GlobalAuthFileName = nc;
}
return GlobalAuthFileName;
public synchronized static void reloadUsers() {
users = new HashMap<String, SearchDbAuthUser>();
-
-
ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(new FileReader(GlobalAuthFileName));
- // aailogger.debug(logline, "Reading from " + GlobalAuthFileName);
JsonNode rootNode = mapper.readTree(new File(GlobalAuthFileName));
JsonNode rolesNode = rootNode.path("roles");
}
public static boolean authorize(String username, String authFunction) {
- // logline.init(component, transId, fromAppId, "authorize()");
if (!usersInitialized || (users == null)) {
init();