summaryrefslogtreecommitdiffstats
path: root/auth/auth-core/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'auth/auth-core/src/main')
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java8
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java9
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java24
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java11
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java12
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java8
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java11
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java18
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java16
9 files changed, 72 insertions, 45 deletions
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java
index 920f330f..1a1e7f24 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java
@@ -24,6 +24,7 @@ package org.onap.aaf.auth.env;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.onap.aaf.auth.org.Organization;
import org.onap.aaf.cadi.Lur;
@@ -41,9 +42,11 @@ public interface AuthzTrans extends TransStore {
}
}
- public abstract AuthzTrans set(HttpServletRequest req);
+ public abstract AuthzTrans set(HttpServletRequest req, HttpServletResponse resp);
public abstract HttpServletRequest hreq();
+
+ public abstract HttpServletResponse hresp();
public abstract String user();
@@ -81,4 +84,7 @@ public interface AuthzTrans extends TransStore {
public abstract String getTag();
+ public abstract void clearCache();
+
+
} \ No newline at end of file
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java
index ec5e70de..bda23e13 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java
@@ -23,8 +23,8 @@ package org.onap.aaf.auth.env;
import java.security.Principal;
-import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.onap.aaf.auth.rserv.TransFilter;
import org.onap.aaf.cadi.CadiException;
@@ -63,16 +63,15 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
}
@Override
- protected AuthzTrans newTrans(HttpServletRequest req) {
+ protected AuthzTrans newTrans(HttpServletRequest req, HttpServletResponse resp) {
AuthzTrans at = env.newTrans();
at.setLur(getLur());
- at.set(req);
+ at.set(req,resp);
return at;
}
@Override
- protected TimeTaken start(AuthzTrans trans, ServletRequest request) {
- trans.set((HttpServletRequest)request);
+ protected TimeTaken start(AuthzTrans trans) {
return trans.start("Trans " + //(context==null?"n/a":context.toString()) +
" IP: " + trans.ip() +
" Port: " + trans.port()
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java
index a7bb24a5..0af760b8 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java
@@ -24,6 +24,7 @@ package org.onap.aaf.auth.env;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.onap.aaf.auth.org.Organization;
import org.onap.aaf.auth.org.OrganizationFactory;
@@ -37,6 +38,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
private static final String N_A = "n/a";
private static final String BLANK = "";
private HttpServletRequest hreq;
+ private HttpServletResponse hresp;
private TaggedPrincipal user;
private Lur lur;
private Organization org;
@@ -54,8 +56,9 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
* @see org.onap.aaf.auth.env.test.AuthTrans#set(javax.servlet.http.HttpServletRequest)
*/
@Override
- public AuthzTrans set(HttpServletRequest req) {
+ public AuthzTrans set(HttpServletRequest req, HttpServletResponse resp) {
hreq = req;
+ hresp = resp;
user = (TaggedPrincipal)req.getUserPrincipal();
for (REQD_TYPE rt : REQD_TYPE.values()) {
@@ -70,11 +73,17 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
org=null;
return this;
}
+
@Override
public HttpServletRequest hreq() {
return hreq;
}
-
+
+ @Override
+ public HttpServletResponse hresp() {
+ return hresp;
+ }
+
@Override
public void setUser(TaggedPrincipal p) {
user = p;
@@ -174,7 +183,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
}
return false;
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.env.test.AuthzTrans#org()
*/
@@ -229,4 +238,13 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
public String getTag() {
return tag;
}
+
+ @Override
+ public void clearCache() {
+ if (lur!=null) {
+ StringBuilder report = new StringBuilder();
+ lur.clear(user, report);
+ info().log(report);
+ }
+ }
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java
index b1111638..5545c7da 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java
@@ -21,8 +21,8 @@
package org.onap.aaf.auth.env;
-import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.onap.aaf.auth.rserv.TransOnlyFilter;
import org.onap.aaf.cadi.principal.TaggedPrincipal;
@@ -43,13 +43,14 @@ public class AuthzTransOnlyFilter extends TransOnlyFilter<AuthzTrans> {
}
@Override
- protected AuthzTrans newTrans() {
- return env.newTrans();
+ protected AuthzTrans newTrans(HttpServletRequest req, HttpServletResponse resp) {
+ AuthzTrans trans = env.newTrans();
+ trans.set(req, resp);
+ return trans;
}
@Override
- protected TimeTaken start(AuthzTrans trans, ServletRequest request) {
- trans.set((HttpServletRequest)request);
+ protected TimeTaken start(AuthzTrans trans) {
return trans.start("Trans " + //(context==null?"n/a":context.toString()) +
" IP: " + trans.ip() +
" Port: " + trans.port()
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java
index 54a8f484..f0052e5a 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java
@@ -24,6 +24,7 @@ package org.onap.aaf.auth.env;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.onap.aaf.auth.org.Organization;
import org.onap.aaf.cadi.Lur;
@@ -130,7 +131,7 @@ public class NullTrans implements AuthzTrans {
return null;
}
@Override
- public AuthzTrans set(HttpServletRequest req) {
+ public AuthzTrans set(HttpServletRequest req, HttpServletResponse resp) {
return null;
}
@@ -138,7 +139,13 @@ public class NullTrans implements AuthzTrans {
public HttpServletRequest hreq() {
return null;
}
+
+ @Override
+ public HttpServletResponse hresp() {
+ return null;
+ }
+
@Override
public String user() {
return null;
@@ -243,5 +250,8 @@ public class NullTrans implements AuthzTrans {
public String getTag() {
return null;
}
+ @Override
+ public void clearCache() {
+ }
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java
index 92c0fc24..81e2e619 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java
@@ -86,8 +86,8 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter {
return cadi.getLur();
}
- protected abstract TRANS newTrans(HttpServletRequest request);
- protected abstract TimeTaken start(TRANS trans, ServletRequest request);
+ protected abstract TRANS newTrans(HttpServletRequest request,HttpServletResponse response);
+ protected abstract TimeTaken start(TRANS trans);
protected abstract void authenticated(TRANS trans, Principal p);
protected abstract void tallyHo(TRANS trans, String target);
@@ -96,9 +96,9 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter {
HttpServletRequest req = (HttpServletRequest)request;
HttpServletResponse res = (HttpServletResponse)response;
- TRANS trans = newTrans(req);
+ TRANS trans = newTrans(req,res);
- TimeTaken overall = start(trans,request);
+ TimeTaken overall = start(trans);
String target = "n/a";
try {
request.setAttribute(TRANS_TAG, trans);
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java
index c3514b65..ef91e485 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java
@@ -29,6 +29,8 @@ import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.onap.aaf.cadi.principal.TaggedPrincipal;
import org.onap.aaf.misc.env.TimeTaken;
@@ -52,16 +54,15 @@ public abstract class TransOnlyFilter<TRANS extends TransStore> implements Filte
- protected abstract TRANS newTrans();
- protected abstract TimeTaken start(TRANS trans, ServletRequest request);
+ protected abstract TRANS newTrans(HttpServletRequest req, HttpServletResponse resp);
+ protected abstract TimeTaken start(TRANS trans);
protected abstract void authenticated(TRANS trans, TaggedPrincipal p);
protected abstract void tallyHo(TRANS trans);
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
- TRANS trans = newTrans();
-
- TimeTaken overall = start(trans,request);
+ TRANS trans = newTrans((HttpServletRequest)request,(HttpServletResponse)response);
+ TimeTaken overall = start(trans);
try {
request.setAttribute(TransFilter.TRANS_TAG, trans);
chain.doFilter(request, response);
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
index 23240cf1..f5831139 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
@@ -43,9 +43,11 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
private boolean do_register;
protected AbsService<ENV,TRANS> service;
protected String hostname;
+ protected final boolean secure;
- public AbsServiceStarter(final AbsService<ENV,TRANS> service) {
+ public AbsServiceStarter(final AbsService<ENV,TRANS> service, boolean secure) {
+ this.secure = secure;
this.service = service;
try {
OrganizationFactory.init(service.env);
@@ -96,12 +98,14 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
});
if(System.getProperty("ECLIPSE", null)!=null) {
Thread.sleep(2000);
- System.out.println("Service Started in Eclipse: ");
- System.out.print(" Hit <enter> to end\n:");
- try {
- System.in.read();
- System.exit(0);
- } catch (IOException e) {
+ if(!app.isCancelled()) {
+ System.out.println("Service Started in Eclipse: ");
+ System.out.print(" Hit <enter> to end:\n");
+ try {
+ System.in.read();
+ System.exit(0);
+ } catch (IOException e) {
+ }
}
}
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
index bcc071a2..8d49720b 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
@@ -54,23 +54,11 @@ import org.onap.aaf.misc.rosetta.env.RosettaEnv;
public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> extends AbsServiceStarter<ENV,TRANS> {
- private boolean secure;
- public JettyServiceStarter(final AbsService<ENV,TRANS> service) throws OrganizationException {
- super(service);
- secure = true;
+ public JettyServiceStarter(final AbsService<ENV,TRANS> service, boolean secure) throws OrganizationException {
+ super(service, secure);
}
- /**
- * Specifically set this Service starter to Insecure (HTTP) Mode.
- * @return
- */
- public JettyServiceStarter<ENV,TRANS> insecure() {
- secure = false;
- return this;
- }
-
-
@Override
public void _propertyAdjustment() {
// System.setProperty("com.sun.management.jmxremote.port", "8081");