summaryrefslogtreecommitdiffstats
path: root/cadi
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2019-02-18 14:01:07 -0600
committerInstrumental <jonathan.gathman@att.com>2019-02-18 14:02:27 -0600
commitbf3d3075cac610b901c951ae135fcdbcc6ffecb8 (patch)
tree2c5644584f6cb0ca1311824b535b3a5671842b88 /cadi
parenta6be2293d445881c447b7f8534e382f0d767a3bc (diff)
More refinement, Agent.sh
Issue-ID: AAF-667 Change-Id: I3898f3378fffb0ed89ad84cb80942d1ded51b3d4 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'cadi')
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java10
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java2
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java4
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java4
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java3
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java24
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java55
-rw-r--r--cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java6
-rw-r--r--cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java2
9 files changed, 44 insertions, 66 deletions
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java
index 0dc51106..c631cb9c 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java
@@ -24,12 +24,6 @@ public interface Defaults {
public final static String AAF_VERSION = "2.1";
public final static String AAF_NS = "AAF_NS";
public final static String AAF_LOCATE_CONST="https://AAF_LOCATE_URL";
- public final static String AAF_ROOT = AAF_LOCATE_CONST + '/' + AAF_NS;
- public final static String AAF_URL = AAF_ROOT + ".service:" + AAF_VERSION;
- public final static String GUI_URL = AAF_ROOT + ".gui:" + AAF_VERSION;
- public final static String CM_URL = AAF_ROOT + ".cm:" + AAF_VERSION;
- public final static String FS_URL = AAF_ROOT + ".fs:" + AAF_VERSION;
- public final static String HELLO_URL = AAF_ROOT + ".hello:" + AAF_VERSION;
- public final static String OAUTH2_TOKEN_URL = AAF_ROOT + ".token:" + AAF_VERSION;
- public final static String OAUTH2_INTROSPECT_URL = AAF_ROOT + ".introspect:" + AAF_VERSION;
+ public final static String AAF_ROOT = AAF_LOCATE_CONST + "/%CNS.%" + AAF_NS;
+
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
index bf7ed6d9..004c43c5 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
@@ -185,7 +185,7 @@ public class TestConnectivity {
String tokenURL = access.getProperty(Config.AAF_OAUTH2_TOKEN_URL);
String locateURL=access.getProperty(Config.AAF_LOCATE_URL);
if (tokenURL==null || (tokenURL.contains("/locate/") && locateURL!=null)) {
- tokenURL=Defaults.OAUTH2_TOKEN_URL+"/token";
+ tokenURL=Config.OAUTH2_TOKEN_URL_DEF;
}
try {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
index aa4e5743..c7a74965 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
@@ -229,7 +229,7 @@ public class Agent {
aafsso.setStdErrDefault();
// if CM_URL can be obtained, add to sso.props, if written
- String cm_url = getProperty(access,env,false, Config.CM_URL,Config.CM_URL+": ");
+ String cm_url = getProperty(access,env,false, Config.CM_URL,Config.CM_URL_DEF);
if (cm_url!=null) {
aafsso.addProp(Config.CM_URL, cm_url);
}
@@ -781,7 +781,7 @@ public class Agent {
}
app.add(Config.AAF_APPID, fqi);
- app.add(Config.AAF_URL, propAccess, Defaults.AAF_URL);
+ app.add(Config.AAF_URL, propAccess, Config.AAF_URL_DEF);
String cts = propAccess.getProperty(Config.CADI_TRUSTSTORE);
if (cts!=null) {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java
index 21b65f1a..c507a826 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java
@@ -64,10 +64,10 @@ public class TokenClientFactory extends Persist<Token,TimedToken> {
super(pa, new RosettaEnv(pa.getProperties()),Token.class,"outgoing");
if (access.getProperty(Config.AAF_OAUTH2_TOKEN_URL,null)==null) {
- access.getProperties().put(Config.AAF_OAUTH2_TOKEN_URL, Defaults.OAUTH2_TOKEN_URL); // Default to AAF
+ access.getProperties().put(Config.AAF_OAUTH2_TOKEN_URL, Config.OAUTH2_TOKEN_URL_DEF); // Default to AAF
}
if (access.getProperty(Config.AAF_OAUTH2_INTROSPECT_URL,null)==null) {
- access.getProperties().put(Config.AAF_OAUTH2_INTROSPECT_URL, Defaults.OAUTH2_INTROSPECT_URL); // Default to AAF);
+ access.getProperties().put(Config.AAF_OAUTH2_INTROSPECT_URL, Config.OAUTH2_INTROSPECT_URL_DEF); // Default to AAF);
}
symm = Symm.encrypt.obtain();
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java
index 66f1af0c..75cddfff 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java
@@ -319,7 +319,7 @@ public class AAFSSO {
if(aaf_root_ns==null) {
locateRoot=Defaults.AAF_ROOT;
} else {
- locateRoot = Defaults.AAF_LOCATE_CONST + '/' + aaf_root_ns;
+ locateRoot = Defaults.AAF_LOCATE_CONST + "/%CNS.%" + aaf_root_ns;
}
if(access.getProperty(Config.AAF_URL)==null) {
@@ -425,7 +425,6 @@ public class AAFSSO {
diskprops.store(fos, "AAF Single Signon");
} finally {
fos.close();
- setReadonly(sso);
}
}
if (sso != null) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
index 66491959..dc58acc6 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
@@ -156,8 +156,8 @@ public class Config {
public static final String CM_URL_DEF = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.cm:" + AAF_DEFAULT_API_VERSION;
public static final String FS_URL_DEF = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.fs:" + AAF_DEFAULT_API_VERSION;
public static final String HELLO_URL_DEF = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.hello:" + AAF_DEFAULT_API_VERSION;
- public static final String OAUTH2_TOKEN_URL = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.token:" + AAF_DEFAULT_API_VERSION +"/token";
- public static final String OAUTH2_INTROSPECT_URL = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.introspect:" + AAF_DEFAULT_API_VERSION +"/introspect";;
+ public static final String OAUTH2_TOKEN_URL_DEF = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.token:" + AAF_DEFAULT_API_VERSION +"/token";
+ public static final String OAUTH2_INTROSPECT_URL_DEF = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.introspect:" + AAF_DEFAULT_API_VERSION +"/introspect";;
public static final String AAF_LOCATOR_CLASS = "aaf_locator_class";
// AAF Locator Entries are ADDITIONAL entries, which also gives the Property ability
@@ -826,26 +826,6 @@ public class Config {
throw new LocatorException(e1);
}
-// if(url.indexOf('%')>=0) {
-// String str = access.getProperty(Config.AAF_LOCATOR_CONTAINER_ID, null);
-// if(str==null) {
-// url = url.replace("%CID","");
-// } else {
-// url = url.replace("%CID",str+'.');
-// }
-// str = access.getProperty(Config.AAF_LOCATOR_CONTAINER, null);
-// if(str==null) {
-// url = url.replace("%C","");
-// } else {
-// url = url.replace("%C",str+'.');
-// }
-//
-// if (root_ns==null) {
-// url = url.replace("%AAF_NS","");
-// } else {
-// url = url.replace("%AAF_NS",root_ns);
-// }
-// }
String replacement;
int idxAAFLocateUrl;
if ((idxAAFLocateUrl=url.indexOf(AAF_LOCATE_URL_TAG))>0 && ((replacement=access.getProperty(AAF_LOCATE_URL, null))!=null)) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java
index b6cd533c..aa782313 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java
@@ -170,27 +170,6 @@ public class RegistrationPropHolder {
}
}
- if(source.indexOf("%NS")>=0) {
- str = getNS(dot_le);
- if(str==null || str.isEmpty()) {
- source = source.replace("%NS"+'.', str);
- }
- source = source.replace("%NS", str);
- }
-
- // aaf_root_ns
- if(source.indexOf("AAF_NS")>=0) {
- str = access.getProperty(Config.AAF_ROOT_NS, null);
- if(str!=null) {
- String temp = source.replace("%AAF_NS", str);
- if(temp == source) { // intended
- source = source.replace("AAF_NS", str); // Backward Compatibility
- } else {
- source = temp;
- }
- }
- }
-
int atC = source.indexOf("%C");
if(atC>=0) {
// aaf_locator_container_ns
@@ -207,11 +186,37 @@ public class RegistrationPropHolder {
source = source.replace("%C", str);
}
+ if(source.indexOf("%NS")>=0) {
+ str = getNS(dot_le);
+ if(str==null || str.isEmpty()) {
+ source = source.replace("%NS"+'.', str);
+ }
+ source = source.replace("%NS", str);
+ }
+
+ // aaf_root_ns
+ if(source.indexOf("AAF_NS")>=0) {
+ str = access.getProperty(Config.AAF_ROOT_NS, Config.AAF_ROOT_NS_DEF);
+ String temp = source.replace("%AAF_NS", str);
+ if(temp.equals(source)) { // intended
+ source = source.replace("AAF_NS", str); // Backward Compatibility
+ } else {
+ source = temp;
+ }
+ }
+
+
if(source.indexOf('%')>=0) {
- // These shouldn't be expected to have dot elements
- source = source.replace("%N", name);
- source = source.replace("%DF", default_fqdn);
- source = source.replace("%PH", public_hostname);
+ // These shouldn't be expected to have dot elements
+ if(name!=null) {
+ source = source.replace("%N", name);
+ }
+ if(default_fqdn!=null) {
+ source = source.replace("%DF", default_fqdn);
+ }
+ if(public_hostname!=null) {
+ source = source.replace("%PH", public_hostname);
+ }
}
return source;
}
diff --git a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java
index cd9c2313..10bcdcc2 100644
--- a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java
+++ b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java
@@ -73,10 +73,10 @@ public class OAuthExample {
// Obtain Endpoints for OAuth2 from Properties. Expected is "cadi.properties" file, pointed to by "cadi_prop_files"
- String tokenServiceURL = access.getProperty(Config.AAF_OAUTH2_TOKEN_URL,Defaults.OAUTH2_TOKEN_URL); // Default to AAF
- String tokenIntrospectURL = access.getProperty(Config.AAF_OAUTH2_INTROSPECT_URL,Defaults.OAUTH2_INTROSPECT_URL); // Default to AAF);
+ String tokenServiceURL = access.getProperty(Config.AAF_OAUTH2_TOKEN_URL,Config.OAUTH2_TOKEN_URL_DEF); // Default to AAF
+ String tokenIntrospectURL = access.getProperty(Config.AAF_OAUTH2_INTROSPECT_URL,Config.OAUTH2_INTROSPECT_URL_DEF); // Default to AAF);
// Get Hello Service
- final String endServicesURL = access.getProperty(Config.AAF_OAUTH2_HELLO_URL,Defaults.HELLO_URL);
+ final String endServicesURL = access.getProperty(Config.AAF_OAUTH2_HELLO_URL,Config.HELLO_URL_DEF);
final int CALL_TIMEOUT = Integer.parseInt(access.getProperty(Config.AAF_CALL_TIMEOUT,Config.AAF_CALL_TIMEOUT_DEF));
diff --git a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java
index f4fe017f..0a653297 100644
--- a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java
+++ b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java
@@ -104,7 +104,7 @@ public class OnapClientExample {
// Use this Token in your client calls with "Tokenized Client" (TzClient)
// These should NOT be used cross thread.
// Get Hello Service URL... roll your own in your own world.
- final String endServicesURL = access.getProperty(Config.AAF_OAUTH2_HELLO_URL,Defaults.HELLO_URL);
+ final String endServicesURL = access.getProperty(Config.AAF_OAUTH2_HELLO_URL,Config.HELLO_URL_DEF);
TzClient helloClient = tcf.newTzClient(endServicesURL);