diff options
author | Instrumental <jonathan.gathman@att.com> | 2018-06-19 12:35:58 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2018-06-19 12:36:31 -0500 |
commit | 08a868676801f78f41a62b8061deb46c89ac7255 (patch) | |
tree | 7cd0cf0e5454601578fbfbe19e7af82eeba2b3e4 | |
parent | 4e6f7bc234a18194dd4370ad8e3c36aba9df2355 (diff) |
Fix HttpClient/Filter
Issue-ID: AAF-364
Change-Id: Ic21a769226cf309571d96a0f75b583d4f75c7887
Signed-off-by: Instrumental <jonathan.gathman@att.com>
4 files changed, 18 insertions, 12 deletions
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 a25c5f31..cbc0737c 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 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> { } @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 1011767a..400c539c 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 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter { 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 15b71b94..52673431 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 @@ public class OrgLookupFilter implements Filter { 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 456184c3..df8cacf4 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 @@ public class HClient implements EClient<HttpURLConnection> { } 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); |