diff options
author | Instrumental <jonathan.gathman@att.com> | 2018-09-07 13:43:23 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2018-09-07 13:43:26 -0500 |
commit | 7e966914050e66219689001ff4ab601a49eef0ac (patch) | |
tree | b1bf643f2d191207adc7d9f6b41ac20f56083e76 /cadi/servlet-sample | |
parent | ead32f193586e39b59bb366bddf70e665173a52d (diff) |
Mass whitespace changes (Style Warnings)
Issue-ID: AAF-473
Change-Id: Ia1b3825a527bd56299949b5962bb9354dffbeef8
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'cadi/servlet-sample')
4 files changed, 19 insertions, 19 deletions
diff --git a/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/MyServlet.java b/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/MyServlet.java index f11d8f89..e3342914 100644 --- a/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/MyServlet.java +++ b/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/MyServlet.java @@ -60,15 +60,15 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal; request.getUserPrincipal()); String perm = request.getParameter("PERM"); - if(perm!=null) { - if(request.isUserInRole(perm)) { - if(perm.indexOf('|')<0) { + if (perm!=null) { + if (request.isUserInRole(perm)) { + if (perm.indexOf('|')<0) { res.getOutputStream().println("\nCongrats!, You are in Role " + perm); } else { res.getOutputStream().println("\nCongrats!, You have Permission " + perm); } } else { - if(perm.indexOf('|')<0) { + if (perm.indexOf('|')<0) { res.getOutputStream().println("\nSorry, you are NOT in Role " + perm); } else { res.getOutputStream().println("\nSorry, you do NOT have Permission " + perm); @@ -78,12 +78,12 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal; // You can get the working AAFCon from Trans AAFCon<?> aafcon = AAFCon.obtain(req); - if(aafcon!=null) { + if (aafcon!=null) { try { res.getOutputStream().println("----- Perms JSON from direct call -----"); final Principal up = request.getUserPrincipal(); TaggedPrincipal tp; - if(up instanceof TaggedPrincipal) { + if (up instanceof TaggedPrincipal) { tp = (TaggedPrincipal)up; } else { tp = new TaggedPrincipal() { @@ -101,7 +101,7 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal; // This call will be "as the user calling", but only if permission is set to trust. // Future<String> future = aafcon.clientAs("2.0",tp).read("/authz/perms/user/"+request.getUserPrincipal().getName(),"application/Perms+json"); Future<String> future = aafcon.client("2.0").read("/authz/perms/user/"+request.getUserPrincipal().getName(),"application/Perms+json"); - if(future.get(4000 /* timeout */)) { + if (future.get(4000 /* timeout */)) { res.getOutputStream().print(future.value); } else { System.err.println(future.code() + ", " + future.body()); diff --git a/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/jetty/JettyServletServer.java b/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/jetty/JettyServletServer.java index cec8a539..165acffb 100644 --- a/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/jetty/JettyServletServer.java +++ b/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/jetty/JettyServletServer.java @@ -51,7 +51,7 @@ public abstract class JettyServletServer implements Servlet { int maxPoolSize = 10; int keepAliveTime = 3000; String hostname = access.getProperty(Config.HOSTNAME, null); - if(hostname==null) { + if (hostname==null) { hostname = Inet4Address.getLocalHost().getHostName(); } @@ -62,7 +62,7 @@ public abstract class JettyServletServer implements Servlet { Server server = new Server(pool); String protocol; - if(access.getProperty(Config.CADI_KEYSTORE_PASSWORD,null)==null) { + if (access.getProperty(Config.CADI_KEYSTORE_PASSWORD,null)==null) { ServerConnector conn = new ServerConnector(server); conn.setHost(hostname); conn.setPort(port); diff --git a/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/jetty/MiniJASPIWrap.java b/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/jetty/MiniJASPIWrap.java index 29462cfb..4d170f3f 100644 --- a/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/jetty/MiniJASPIWrap.java +++ b/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/jetty/MiniJASPIWrap.java @@ -55,9 +55,9 @@ public class MiniJASPIWrap extends ServletHolder { this.rolesAllowed = servlet.getAnnotation(RolesAllowed.class); StringBuilder sb = new StringBuilder(); boolean first = true; - if(rolesAllowed!=null) { - for(String str : rolesAllowed.value()) { - if(first)first=false; + if (rolesAllowed!=null) { + for (String str : rolesAllowed.value()) { + if (first)first=false; else sb.append(','); sb.append(str); } @@ -73,26 +73,26 @@ public class MiniJASPIWrap extends ServletHolder { */ @Override public void handle(Request baseRequest, ServletRequest request, ServletResponse response) throws ServletException, UnavailableException, IOException { - if(rolesAllowed==null) { + if (rolesAllowed==null) { super.handle(baseRequest, request, response); } else { // Validate try { HttpServletRequest hreq = (HttpServletRequest)request; boolean proceed = false; - for(String role : rolesAllowed.value()) { - if(hreq.isUserInRole(role)) { + for (String role : rolesAllowed.value()) { + if (hreq.isUserInRole(role)) { proceed = true; break; } } - if(proceed) { + if (proceed) { super.handle(baseRequest, request, response); } else { //baseRequest.getServletContext().log(hreq.getUserPrincipal().getName()+" Refused " + roles); ((HttpServletResponse)response).sendError(403); // forbidden } - } catch(ClassCastException e) { + } catch (ClassCastException e) { throw new ServletException("JASPIWrap only supports HTTPServletRequest/HttpServletResponse"); } } diff --git a/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/tomcate/TomcatEmbedded.java b/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/tomcate/TomcatEmbedded.java index 1597dbd5..e82dddd2 100644 --- a/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/tomcate/TomcatEmbedded.java +++ b/cadi/servlet-sample/src/test/java/org/onap/aaf/sample/cadi/tomcate/TomcatEmbedded.java @@ -76,10 +76,10 @@ public class TomcatEmbedded { private static void setAttr(Connector connector, Access access, String ctag, String atag) throws IOException { String value = access.getProperty(atag, null); - if(value==null) { + if (value==null) { access.log(Level.ERROR, atag, "is null"); } else { - if(value.startsWith("enc:")) { + if (value.startsWith("enc:")) { access.log(Level.INIT,atag,"=enc:************"); value = access.decrypt(value, false); } else { |