Locator Service link correction 85/78885/2
authorInstrumental <jonathan.gathman@att.com>
Wed, 20 Feb 2019 23:14:20 +0000 (17:14 -0600)
committerInstrumental <jonathan.gathman@att.com>
Wed, 20 Feb 2019 23:43:50 +0000 (17:43 -0600)
Issue-ID: AAF-667
Change-Id: Ie7443f985c6d8dfb6955419695c58ae3be116afc
Signed-off-by: Instrumental <jonathan.gathman@att.com>
auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
conf/CA/bootstrap.sh

index 413b791..2d0a82a 100644 (file)
@@ -202,7 +202,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
         );
         
         try {
-            access().printf(Level.INIT, "Starting service on %s:%d (%s)",hostname,port,InetAddress.getLocalHost().getHostAddress());
+            access().printf(Level.INIT, "Starting service on %s:%d (%s)",hostname,port,InetAddress.getByName(hostname).getHostAddress());
             server.start();
             access().log(Level.INIT,server.dump());
         } catch (Exception e) {
index 2bc4447..a5e12f5 100644 (file)
@@ -66,8 +66,6 @@ import org.onap.aaf.misc.env.Env;
 import com.datastax.driver.core.Cluster;
 
 public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
-    private static final String DOT_LOCATOR = ".locator";
-
     private static final String USER_PERMS = "userPerms";
     private LocateFacade_1_1 facade; // this is the default Facade
     private LocateFacade_1_1 facade_1_1_XML;
@@ -80,8 +78,6 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
     public final LocateDAO locateDAO;
     public final ConfigDAO configDAO;
     private Locator<URI> dal;
-    private final String aaf_service_name;
-    private final String aaf_gui_name;
 
     
     /**
@@ -95,8 +91,6 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
      */
     public AAF_Locate(final AuthzEnv env) throws Exception {
         super(env.access(), env);
-        aaf_service_name = app_name.replace(DOT_LOCATOR, ".service");
-        aaf_gui_name = app_name.replace(DOT_LOCATOR, ".gui");
         
         expireIn = Long.parseLong(env.getProperty(Config.AAF_USER_EXPIRES, Config.AAF_USER_EXPIRES_DEF));
 
@@ -186,7 +180,7 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
     protected AAFConHttp _newAAFConHttp() throws CadiException {
         try {
             if (dal==null) {
-                dal = AbsAAFLocator.create(aaf_service_name,Config.AAF_DEFAULT_API_VERSION);
+                dal = AbsAAFLocator.create("%CNS.%AAF_NS.service",Config.AAF_DEFAULT_API_VERSION);
             }
             // utilize pre-constructed DirectAAFLocator
             return new AAFConHttp(env.access(),dal);
@@ -197,7 +191,7 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
 
     public Locator<URI> getGUILocator() throws LocatorException {
         if (gui_locator==null) {
-            gui_locator = AbsAAFLocator.create(aaf_gui_name,Config.AAF_DEFAULT_API_VERSION);
+            gui_locator = AbsAAFLocator.create("AAF_NS.gui",Config.AAF_DEFAULT_API_VERSION);
         }
         return gui_locator;
     }
index 599bb98..461ef43 100644 (file)
@@ -93,10 +93,20 @@ public class PropAccess implements Access {
         int eq;
         for (String arg : args) {
             if ((eq=arg.indexOf('='))>0) {
-                nprops.setProperty(arg.substring(0, eq),arg.substring(eq+1));
+               String key = arg.substring(0, eq);
+                if(Config.CADI_PROP_FILES.equals(key)) {
+                       nprops.setProperty(key,arg.substring(eq+1));
+                }
             }
         }
         init(nprops);
+        
+        // Re-overlay Args
+        for (String arg : args) {
+            if ((eq=arg.indexOf('='))>0) {
+                props.setProperty(arg.substring(0, eq),arg.substring(eq+1));
+            }
+        }
     }
     
     protected void init(Properties p) {
@@ -105,15 +115,16 @@ public class PropAccess implements Access {
         level=DEFAULT.maskOf();
         
         props = new Properties();
-        // First, load related System Properties
+        
+        // Find the "cadi_prop_files"
+        //  First in VM Args
         for (Entry<Object,Object> es : System.getProperties().entrySet()) {
             String key = es.getKey().toString();
-            for (String start : new String[] {"HOSTNAME","cadi_","aaf_","cm_"}) {
-                if (key.startsWith(start)) {
-                    props.put(key, es.getValue());
-                }
-            }            
+            if(Config.CADI_PROP_FILES.equals(key)) {
+               props.put(key,es.getValue().toString());
+            }
         }
+        
         // Second, overlay or fill in with Passed in Props
         if (p!=null) {
             props.putAll(p);
@@ -122,6 +133,16 @@ public class PropAccess implements Access {
         // Third, load any Chained Property Files
         load(props.getProperty(Config.CADI_PROP_FILES));
         
+        // Fourth, System.getProperties takes precedence over Files
+        for (Entry<Object,Object> es : System.getProperties().entrySet()) {
+            String key = es.getKey().toString();
+            for (String start : new String[] {"HOSTNAME","cadi_","aaf_","cm_"}) {
+                if (key.startsWith(start)) {
+                    props.put(key, es.getValue());
+                }
+            }            
+        }
+        
         String sLevel = props.getProperty(Config.CADI_LOGLEVEL); 
         if (sLevel!=null) {
             level=Level.valueOf(sLevel).maskOf(); 
index 831b0ee..6ccc6bf 100644 (file)
@@ -142,7 +142,7 @@ $PASSPHRASE
 EOF
 
 # Make Issuer name
-ISSUER=$(openssl x509 -subject -noout -in $SIGNER_CRT | cut -c 9- | sed -e 's/ = /=/g')
+ISSUER=$(openssl x509 -subject -noout -in $SIGNER_CRT | cut -c 9- | sed -e 's/ = /=/g' -e 's/\//, /g')
 for I in $ISSUER; do
   if [ -z "$REVERSE" ]; then
     REVERSE="${I%,}"