diff options
author | Instrumental <jonathan.gathman@att.com> | 2019-02-18 14:01:07 -0600 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2019-02-18 14:02:27 -0600 |
commit | bf3d3075cac610b901c951ae135fcdbcc6ffecb8 (patch) | |
tree | 2c5644584f6cb0ca1311824b535b3a5671842b88 | |
parent | a6be2293d445881c447b7f8534e382f0d767a3bc (diff) |
More refinement, Agent.sh
Issue-ID: AAF-667
Change-Id: I3898f3378fffb0ed89ad84cb80942d1ded51b3d4
Signed-off-by: Instrumental <jonathan.gathman@att.com>
13 files changed, 68 insertions, 79 deletions
diff --git a/auth/docker/agent.sh b/auth/docker/agent.sh index c330b1ce..d319de4d 100644 --- a/auth/docker/agent.sh +++ b/auth/docker/agent.sh @@ -48,15 +48,21 @@ for V in VERSION DOCKER_REPOSITORY HOSTNAME AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_ # Need AAF_FQDN's IP, because not might not be available in mini-container PROMPT="AAF FQDN IP" LOOKUP=$(host "${AAF_FQDN}" | grep "has address") - if [ -z ${LOOKUP} ]; then - DEF= - else + if [ -n "${LOOKUP}" ]; then DEF=$(echo ${LOOKUP} | tail -1 | cut -f 4 -d ' ') fi ;; - APP_FQI) PROMPT="App's FQI";; - APP_FQDN) PROMPT="App's Root FQDN";; - VOLUME) PROMPT="APP's AAF Configuration Volume";; + APP_FQDN) PROMPT="App's Root FQDN";; + APP_FQI) PROMPT="App's FQI" + if [[ "${APP_FQDN}" != *"."* ]]; then + DEF="${APP_FQDN}@${APP_FQDN}.onap.org" + fi + ;; + VOLUME) PROMPT="APP's AAF Configuration Volume" + if [[ "${APP_FQDN}" != *"."* ]]; then + DEF="${APP_FQDN}_config" + fi + ;; DRIVER) PROMPT=$V;DEF=local;; VERSION) PROMPT="CADI Version";DEF=$CADI_VERSION;; LATITUDE|LONGITUDE) PROMPT="$V of Node";; diff --git a/auth/sample/bin/client.sh b/auth/sample/bin/client.sh index 7af8a974..9b146c5f 100755 --- a/auth/sample/bin/client.sh +++ b/auth/sample/bin/client.sh @@ -158,12 +158,17 @@ else $JAVA_AGENT showpass ${APP_FQI} ${APP_FQDN} ;; check) + echo "## Check Certificate" $JAVA_AGENT check ${APP_FQI} ${APP_FQDN} ;; validate) echo "## validate requested" $JAVA_AGENT_SELF validate ;; + renew) + echo "## Renew Certificate" + $JAVA_AGENT place ${APP_FQI} ${APP_FQDN} + ;; bash) shift cd $LOCAL || exit diff --git a/auth/sample/etc/org.osaaf.aaf.gui.props b/auth/sample/etc/org.osaaf.aaf.gui.props index b6e9072b..caad2080 100644 --- a/auth/sample/etc/org.osaaf.aaf.gui.props +++ b/auth/sample/etc/org.osaaf.aaf.gui.props @@ -30,7 +30,7 @@ aaf_locator_port.helm=30083 aaf_gui_title=AAF aaf_gui_copyright=(c) 2018 AT&T Intellectual Property. All rights reserved. aaf_gui_theme=theme/onap -cadi_loginpage_url=https://AAF_LOCATE_URL/AAF_NS.gui:2.0/login +cadi_loginpage_url=https://AAF_LOCATE_URL/%CNS.%AAF_NS.gui:2.0/login # GUI URLS and Help URLS aaf_url.gui_onboard=https://wiki.onap.org/display/DW/Client+Onboarding diff --git a/auth/sample/local/initialConfig.props b/auth/sample/local/initialConfig.props index 91d5338f..93cfae56 100644 --- a/auth/sample/local/initialConfig.props +++ b/auth/sample/local/initialConfig.props @@ -41,10 +41,10 @@ aaf_locator_fqdn.oom=aaf-%N.%CNS # AAF URLs
################################
aaf_locate_url=https://localhost:8095
-aaf_url=https://AAF_LOCATE_URL/%C.%AAF_NS.service:2.1
-aaf_oauth2_introspect_url=https://AAF_LOCATE_URL/%C.%AAF_NS.oauth:2.1/introspect
-aaf_oauth2_token_url=https://AAF_LOCATE_URL/%C.%AAF_NS.oauth:2.1/token
-cm_url=https://AAF_LOCATE_URL/%C.%AAF_NS.cm:2.1
-gui_url=https://AAF_LOCATE_URL/%C.%AAF_NS.gui.2.1
-fs_url=https://AAF_LOCATE_URL/%C.%AAF_NS.fs.2.1
+aaf_url=https://AAF_LOCATE_URL/%CNS.%AAF_NS.service:2.1
+aaf_oauth2_introspect_url=https://AAF_LOCATE_URL/%CNS.%AAF_NS.oauth:2.1/introspect
+aaf_oauth2_token_url=https://AAF_LOCATE_URL/%CNS.%AAF_NS.oauth:2.1/token
+cm_url=https://AAF_LOCATE_URL/%CNS.%AAF_NS.cm:2.1
+gui_url=https://AAF_LOCATE_URL/%CNS.%AAF_NS.gui.2.1
+fs_url=https://AAF_LOCATE_URL/%CNS.%AAF_NS.fs.2.1
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); |