JettyStartups to improve new Filters

Issue-ID: AAF-361
Change-Id: I74cac231ebac81466778c1c3ebca16c63ae6f78a
Signed-off-by: Instrumental <jonathan.gathman@att.com>
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java
index 5c5ab96..17a42fc 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java
@@ -201,11 +201,12 @@
 	}
 
 	@Override
-	public Filter[] filters() throws CadiException, LocatorException {
+	public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
 		try {
 			return new Filter[] {
 					new AuthzTransFilter(env,aafCon(),
-		        			new AAFTrustChecker((Env)env))
+		        		new AAFTrustChecker((Env)env),
+		        		additionalTafLurs)
 				};
 		} catch (NumberFormatException e) {
 			throw new CadiException("Invalid Property information", e);
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 d8c7311..af6c88d 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
@@ -104,8 +104,18 @@
 		}
     }
 
-	public abstract Filter[] filters() throws CadiException,  LocatorException;
-
+	protected abstract Filter[] _filters(Object ... additionalTafLurs) throws CadiException,  LocatorException;
+	
+	/**
+	 * Overload this method to add new TAF or LURs
+	 * 
+	 * @return
+	 * @throws CadiException
+	 * @throws LocatorException
+	 */
+	public Filter[] filters() throws CadiException,  LocatorException {
+		return _filters();
+	}
 
     public abstract Registrant<ENV>[] registrants(final int port) throws CadiException, LocatorException;
 
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java
index 453eeb8..cd73e86 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java
@@ -73,7 +73,7 @@
 		}
 
 		@Override
-		public Filter[] filters() throws CadiException, LocatorException {
+		public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
 			// TODO Auto-generated method stub
 			return null;
 		}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java
index 071a0f8..1a3f441 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java
@@ -100,7 +100,7 @@
 		}
 
 		@Override
-		public Filter[] filters() throws CadiException, LocatorException {
+		public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
 			// TODO Auto-generated method stub
 			return null;
 		}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_JettyServiceStarter.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_JettyServiceStarter.java
index 9a02b63..13bac17 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_JettyServiceStarter.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_JettyServiceStarter.java
@@ -59,7 +59,7 @@
 		}
 
 		@Override
-		public Filter[] filters() throws CadiException, LocatorException {
+		public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
 			// TODO Auto-generated method stub
 			return null;
 		}
diff --git a/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java b/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java
index 0359b3e..ec50733 100644
--- a/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java
+++ b/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java
@@ -88,7 +88,8 @@
 	};
 	
 	@Override
-	public Filter[] filters() throws CadiException, LocatorException {
+	public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
+		// Note: No TAFs and Lurs on FileServer
 		return new Filter[] {
 			new AuthzTransOnlyFilter(env)
 		};
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java
index 23713d8..3f26bad 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java
@@ -230,13 +230,15 @@
 	public<RET> RET cmClientAsUser(TaggedPrincipal p,Retryable<RET> retryable) throws APIException, LocatorException, CadiException  {
 			return cmCon.hman().best(new HTransferSS(p,app, aafCon.securityInfo()), retryable);
 	}
+	
 	@Override
-	public Filter[] filters() throws CadiException, LocatorException {
+	public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
 		try {
 			return new Filter[] {
 					new XFrameFilter(XFrameFilter.TYPE.none),
 					new AuthzTransFilter(env,aafCon(),
-		        			new AAFTrustChecker((Env)env)),
+		        			new AAFTrustChecker((Env)env),
+		        			additionalTafLurs),
 					new OrgLookupFilter()
 				};
 		} catch (NumberFormatException e) {
diff --git a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java
index 8a85b4e..9617f19 100644
--- a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java
+++ b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java
@@ -97,11 +97,12 @@
 	}
 	
 	@Override
-	public Filter[] filters() throws CadiException, LocatorException {
+	public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
 		try {
 			return new Filter[] {
 					new AuthzTransFilter(env,aafCon(),
-		        			new AAFTrustChecker((Env)env))
+		        		new AAFTrustChecker((Env)env),
+		        		additionalTafLurs)
 				};
 		} catch (NumberFormatException e) {
 			throw new CadiException("Invalid Property information", e);
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
index 1cf3afb..efda67f 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
@@ -202,11 +202,12 @@
 
 
 	@Override
-	public Filter[] filters() throws CadiException, LocatorException {
+	public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
 		try {
 			return new Filter[] {
 				new AuthzTransFilter(env, aafCon(), 
 					new AAFTrustChecker((Env)env)
+					,additionalTafLurs
 				)};
 		} catch (NumberFormatException e) {
 			throw new CadiException("Invalid Property information", e);
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java
index ecc2ae5..d73c3be 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java
@@ -140,19 +140,26 @@
 	}
 	
 	@Override
-	public Filter[] filters() throws CadiException, LocatorException {
+	public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
 		try {
-	        DirectOAuthTAF doat;
-			return new Filter[] {new AuthzTransFilter(env,aafCon(),
+	        DirectOAuthTAF doat = new DirectOAuthTAF(env,question,facade1_0);
+        	Object[] atl=new Object[additionalTafLurs.length+2];
+	        atl[0] = doat;
+	        atl[1] = doat.directUserPass();
+
+	        if(additionalTafLurs.length>0) {
+	        	System.arraycopy(additionalTafLurs, 0, atl, 2, additionalTafLurs.length);
+	        }
+	        
+			return new Filter[] {
+				new AuthzTransFilter(env,aafCon(),
 	        		new AAFTrustChecker((Env)env),
-	        		doat = new DirectOAuthTAF(env,question,facade1_0),
-	        		doat.directUserPass()
-	        		)};
+	        		atl
+	        )};
 		} catch (NumberFormatException | APIException e) {
 			throw new CadiException("Invalid Property information", e);
 		}
 	}
-
 	
 	@SuppressWarnings("unchecked")
 	@Override
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java
index 16d7268..e602e86 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java
@@ -101,7 +101,6 @@
 		}
 
 		if("application/x-www-form-urlencoded".equals(req.getContentType())) {
-			@SuppressWarnings("unchecked")
 			Map<String, String[]> map = req.getParameterMap();
 			String client_id=null,client_secret=null,username=null,password=null;
 			for(Map.Entry<String, String[]> es : map.entrySet()) {
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java
index ee4237c..688a03c 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java
@@ -88,7 +88,6 @@
 	public TokenRequest tokenReqFromParams(HttpServletRequest req) {
 		TokenRequest tr = new TokenRequest();
 		boolean data = false;
-		@SuppressWarnings("unchecked")
 		Map<String, String[]> map = req.getParameterMap();
 		for(Entry<String, String[]> es : map.entrySet()) {
 			switch(es.getKey()) {
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java
index bdabc39..3ae2fbf 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java
@@ -54,6 +54,7 @@
 import org.onap.aaf.auth.service.facade.AuthzFacade_2_0;
 import org.onap.aaf.auth.service.mapper.Mapper.API;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.LocatorException;
 import org.onap.aaf.cadi.PropAccess;
 import org.onap.aaf.cadi.aaf.v2_0.AAFTrustChecker;
 import org.onap.aaf.cadi.aaf.v2_0.AbsAAFLocator;
@@ -157,22 +158,31 @@
 	}
 	
 	@Override
-	public Filter[] filters() throws CadiException {
-		final String domain = FQI.reverseDomain(access.getProperty("aaf_root_ns","org.osaaf.aaf"));
+	public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
+		final String domain = FQI.reverseDomain(access.getProperty(Config.AAF_ROOT_NS,Config.AAF_ROOT_NS_DEF));
 		try {
-				return new Filter[] {new AuthzTransFilter(env, null /* no connection to AAF... it is AAF */,
-						new AAFTrustChecker((Env)env),
-						new DirectAAFLur(env,question), // Note, this will be assigned by AuthzTransFilter to TrustChecker
-						//new DirectOAuthTAF(env,question,OAFacadeFactory.directV1_0(oauthService)),
-						new BasicHttpTaf(env, directAAFUserPass,
-							domain,Long.parseLong(env.getProperty(Config.AAF_CLEAN_INTERVAL, Config.AAF_CLEAN_INTERVAL_DEF)),
-							false)
-					)};
+        	Object[] atl=new Object[additionalTafLurs.length+2];
+        	atl[0]=new DirectAAFLur(env,question); // Note, this will be assigned by AuthzTransFilter to TrustChecker
+			atl[1]=new BasicHttpTaf(env, directAAFUserPass,
+				domain,Long.parseLong(env.getProperty(Config.AAF_CLEAN_INTERVAL, Config.AAF_CLEAN_INTERVAL_DEF)),
+				false);
+
+	        if(additionalTafLurs.length>0) {
+	        	System.arraycopy(additionalTafLurs, 0, atl, 2, additionalTafLurs.length);
+	        }
+	        
+			return new Filter[] {
+				new AuthzTransFilter(env,aafCon(),
+	        		new AAFTrustChecker((Env)env),
+	        		atl
+	        )};
 		} catch (NumberFormatException e) {
 			throw new CadiException("Invalid Property information", e);
 		}
 	}
 
+
+
 	@SuppressWarnings("unchecked")
 	@Override
 	public Registrant<AuthzEnv>[] registrants(final int port) throws CadiException {
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 7c897e3..c79c5cc 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
@@ -143,6 +143,7 @@
 	public static final String AAF_ENV = "aaf_env";
 	public static final String AAF_URL = "aaf_url"; //URL for AAF... Use to trigger AAF configuration
 	public static final String AAF_ROOT_NS = "aaf_root_ns";
+	public static final String AAF_ROOT_NS_DEF = "org.osaaf.aaf";
 	public static final String AAF_ROOT_COMPANY = "aaf_root_company";
 	public static final String AAF_LOCATE_URL = "aaf_locate_url"; //URL for AAF locator
 	private static final String AAF_LOCATE_URL_TAG = "AAF_LOCATE_URL"; // Name of Above for use in Config Variables.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
index d86a075..f61d1ca 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
@@ -48,8 +48,6 @@
 public class JU_LocalLur {
 
 	private static final String password = "<pass>";
-	private String encrypted;
-
 	private PropAccess access;
 	private ByteArrayOutputStream outStream;
 
@@ -59,8 +57,6 @@
 	public void setup() throws IOException {
 		MockitoAnnotations.initMocks(this);
 
-		encrypted = rot13(password);
-
 		outStream = new ByteArrayOutputStream();
 		access = new PropAccess(new PrintStream(outStream), new String[0]) {
 			@Override public String decrypt(String encrypted, boolean anytext) throws IOException {
@@ -75,6 +71,8 @@
 
 	@Test
 	public void test() throws IOException {
+		final String encrypted = rot13(password);
+
 		LocalLur lur;
 		List<AbsUserCache<LocalPermission>.DumpInfo> info;