X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fsa%2Fauth%2FSearchDbServiceAuthCore.java;h=bd4f1a57a9ad233ff3974794d8f24a4b09e0f3db;hb=ce701746049abfd94a87b46e43f296faf32d6213;hp=0895c199bd15210fef4d21099d26daa9a2120507;hpb=06d31abe3065205c87447687ad87c05e602c97d7;p=aai%2Fsearch-data-service.git diff --git a/src/main/java/org/onap/aai/sa/auth/SearchDbServiceAuthCore.java b/src/main/java/org/onap/aai/sa/auth/SearchDbServiceAuthCore.java index 0895c19..bd4f1a5 100644 --- a/src/main/java/org/onap/aai/sa/auth/SearchDbServiceAuthCore.java +++ b/src/main/java/org/onap/aai/sa/auth/SearchDbServiceAuthCore.java @@ -25,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.sa.searchdbabstraction.util.SearchDbConstants; import org.onap.aai.cl.api.Logger; import org.onap.aai.cl.eelf.LoggerFactory; +import org.onap.aai.sa.searchdbabstraction.util.SearchDbConstants; 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; @@ -75,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; @@ -87,13 +82,10 @@ public class SearchDbServiceAuthCore { public synchronized static void reloadUsers() { users = new HashMap(); - - 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"); @@ -230,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();