summaryrefslogtreecommitdiffstats
path: root/auth
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2018-06-23 11:01:25 -0500
committerInstrumental <jonathan.gathman@att.com>2018-06-23 11:13:11 -0500
commit732344f175150fed87e0140ad75152d325364c8b (patch)
tree472d8fd03ed111a22863f1b0387c60bb51c80825 /auth
parent68f3e5a2875f74863b6cbe8eb6dc7138b89668a5 (diff)
JettyStartups to improve new Filters
Issue-ID: AAF-361 Change-Id: I74cac231ebac81466778c1c3ebca16c63ae6f78a Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth')
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java5
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java14
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java2
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java2
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_JettyServiceStarter.java2
-rw-r--r--auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java3
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java6
-rw-r--r--auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java5
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java3
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java21
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java1
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java1
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java30
13 files changed, 63 insertions, 32 deletions
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 5c5ab962..17a42fc7 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 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
}
@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 d8c73117..af6c88dc 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 class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
}
}
- 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 453eeb85..cd73e862 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 @@ public class JU_AbsService {
}
@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 071a0f83..1a3f4417 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 @@ public class JU_AbsServiceStarter {
}
@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 9a02b634..13bac174 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 @@ public class JU_JettyServiceStarter {
}
@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 0359b3ef..ec507338 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 @@ public class AAF_FS extends AbsService<AuthzEnv, AuthzTrans> {
};
@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 23713d82..3f26badb 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 class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E
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 8a85b4e8..9617f191 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 @@ public class AAF_Hello extends AbsService<AuthzEnv,AuthzTrans> {
}
@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 1cf3afbb..efda67f7 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 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
@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 ecc2ae5b..d73c3be3 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 @@ public class AAF_OAuth extends AbsService<AuthzEnv,AuthzTrans> {
}
@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 16d72686..e602e863 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 @@ public class DirectOAuthTAF implements HttpTaf {
}
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 ee4237c8..688a03ce 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 class Mapper1_0 extends MapperIntrospect1_0 implements Mapper<TokenReques
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 bdabc39e..3ae2fbfb 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.AuthzFacadeFactory;
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 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
}
@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 {