X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fserver%2FAbsService.java;h=435b8845450ed3476ecc3f3636e74ba053be4702;hb=762dabc6f9577b5b1a8211dddf38ce34295f22a4;hp=497860afc11a660cbe5121f54ba5ded7ba2372b6;hpb=4b5a7d721d994a49057e9bfb403c7bff1b376660;p=aaf%2Fauthz.git diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java index 497860af..435b8845 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java @@ -34,6 +34,7 @@ import org.onap.aaf.cadi.Access; import org.onap.aaf.cadi.Access.Level; import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.cadi.aaf.Defaults; import org.onap.aaf.cadi.aaf.v2_0.AAFConHttp; import org.onap.aaf.cadi.client.Rcli; import org.onap.aaf.cadi.client.Retryable; @@ -65,17 +66,24 @@ public abstract class AbsService exte String component = access.getProperty(Config.AAF_COMPONENT, null); final String[] locator_deploy; - if(component == null) { + if (component == null) { locator_deploy = null; } else { locator_deploy = Split.splitTrim(':', component); + if(locator_deploy.length>1 && "AAF_RELEASE".equals(locator_deploy[1])) { + locator_deploy[1]=access.getProperty(Config.AAF_RELEASE, Defaults.AAF_VERSION); + int snapshot = locator_deploy[1].indexOf("-SNAPSHOT"); + if(snapshot>0) { + locator_deploy[1]=locator_deploy[1].substring(0, snapshot); + } + } } - if(component == null || locator_deploy==null || locator_deploy.length<2) { + if (component == null || locator_deploy==null || locator_deploy.length<2) { throw new CadiException("AAF Component must include the " + Config.AAF_COMPONENT + " property, : exte app_interface_version = version[0]+'.'+version[1]; // Print Cipher Suites Available - if(access.willLog(Level.DEBUG)) { + if (access.willLog(Level.DEBUG)) { SSLContext context; try { context = SSLContext.getDefault(); @@ -94,11 +102,11 @@ public abstract class AbsService exte StringBuilder sb = new StringBuilder("Available Cipher Suites: "); boolean first = true; int count=0; - for( String cs : sf.getSupportedCipherSuites()) { - if(first)first = false; + for ( String cs : sf.getSupportedCipherSuites()) { + if (first)first = false; else sb.append(','); sb.append(cs); - if(++count%4==0){sb.append('\n');} + if (++count%4==0){sb.append('\n');} } access.log(Level.DEBUG,sb); } @@ -121,8 +129,8 @@ public abstract class AbsService exte // Lazy Instantiation public synchronized AAFConHttp aafCon() throws CadiException, LocatorException { - if(aafCon==null) { - if(access.getProperty(Config.AAF_URL,null)!=null) { + if (aafCon==null) { + if (access.getProperty(Config.AAF_URL,null)!=null) { aafCon = _newAAFConHttp(); } else { throw new CadiException("AAFCon cannot be constructed without " + Config.AAF_URL); @@ -137,7 +145,7 @@ public abstract class AbsService exte * @throws LocatorException */ protected synchronized AAFConHttp _newAAFConHttp() throws CadiException, LocatorException { - if(aafCon==null) { + if (aafCon==null) { aafCon = new AAFConHttp(access); } return aafCon; @@ -150,11 +158,11 @@ public abstract class AbsService exte } public Rcli client() throws CadiException { - return aafCon.client(Config.AAF_DEFAULT_VERSION); + return aafCon.client(); } public Rcli clientAsUser(TaggedPrincipal p) throws CadiException { - return aafCon.client(Config.AAF_DEFAULT_VERSION).forUser( + return aafCon.client().forUser( new HTransferSS(p,app_name, aafCon.securityInfo())); } @@ -165,20 +173,20 @@ public abstract class AbsService exte protected static final String loadFromArgOrSystem(final Properties props, final String tag, final String args[], final String def) { String tagEQ = tag + '='; String value; - for(String arg : args) { - if(arg.startsWith(tagEQ)) { + for (String arg : args) { + if (arg.startsWith(tagEQ)) { props.put(tag, value=arg.substring(tagEQ.length())); return value; } } // check System.properties value = System.getProperty(tag); - if(value!=null) { + if (value!=null) { props.put(tag, value); return value; } - if(def!=null) { + if (def!=null) { props.put(tag,def); } return def;