Fix HttpClient/Filter
Issue-ID: AAF-364
Change-Id: Ic21a769226cf309571d96a0f75b583d4f75c7887
Signed-off-by: Instrumental <jonathan.gathman@att.com>
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 a25c5f3..cbc0737 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
@@ -62,9 +62,10 @@
}
@Override
- protected AuthzTrans newTrans() {
+ protected AuthzTrans newTrans(HttpServletRequest req) {
AuthzTrans at = env.newTrans();
at.setLur(getLur());
+ at.set(req);
return at;
}
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 1011767..400c539 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
@@ -84,22 +84,22 @@
return cadi.getLur();
}
- protected abstract TRANS newTrans();
+ protected abstract TRANS newTrans(HttpServletRequest request);
protected abstract TimeTaken start(TRANS trans, ServletRequest request);
protected abstract void authenticated(TRANS trans, Principal p);
protected abstract void tallyHo(TRANS trans);
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
- TRANS trans = newTrans();
+ HttpServletRequest req = (HttpServletRequest)request;
+ HttpServletResponse res = (HttpServletResponse)response;
+
+ TRANS trans = newTrans(req);
TimeTaken overall = start(trans,request);
try {
request.setAttribute(TRANS_TAG, trans);
- HttpServletRequest req = (HttpServletRequest)request;
- HttpServletResponse res = (HttpServletResponse)response;
-
if(no_authn!=null) {
for(String prefix : no_authn) {
if(req.getPathInfo().startsWith(prefix)) {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java
index 15b71b9..5267343 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java
@@ -57,7 +57,7 @@
Identity id;
try {
id = trans.org().getIdentity(trans, p.getName());
- if(id.isFound()) {
+ if(id!=null && id.isFound()) {
return id.firstName();
}
} catch (OrganizationException e) {
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
index 456184c..df8cacf 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
@@ -122,11 +122,16 @@
}
pi.append(pathinfo);
}
- pathinfo=null;
- query=null;
- fragment=null;
- //huc = (HttpURLConnection) url.openConnection();
- huc = getConnection(uri, pi);
+ URI sendURI = new URI(
+ uri.getScheme(),
+ uri.getUserInfo(),
+ uri.getHost(),
+ uri.getPort(),
+ pi==null?uri.getPath():pi.toString(),
+ query==null?uri.getQuery():query,
+ fragment==null?uri.getFragment():fragment
+ );
+ huc = getConnection(sendURI, pi);
huc.setRequestMethod(meth);
if(ss!=null) {
ss.setSecurity(huc);