Removing AJSC and moving to SpringBoot
[aai/search-data-service.git] / src / main / java / org / onap / aai / sa / auth / SearchDbServiceAuthCore.java
index e7541cb..bd4f1a5 100644 (file)
@@ -2,8 +2,8 @@
  * ============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.
@@ -17,8 +17,6 @@
  * 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;
 
@@ -27,24 +25,20 @@ 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.cl.api.Logger;
+import org.onap.aai.cl.eelf.LoggerFactory;
 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.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Timer;
+import java.util.*;
 
 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;
 
@@ -77,11 +71,10 @@ public class SearchDbServiceAuthCore {
 
   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;
@@ -89,13 +82,10 @@ public class SearchDbServiceAuthCore {
 
   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");
 
@@ -232,7 +222,6 @@ public class SearchDbServiceAuthCore {
   }
 
   public static boolean authorize(String username, String authFunction) {
-    // logline.init(component, transId, fromAppId, "authorize()");
 
     if (!usersInitialized || (users == null)) {
       init();