Cleanups.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 17 Sep 2003 19:52:12 +0000 (19:52 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 17 Sep 2003 19:52:12 +0000 (19:52 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@759 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/utils/ClientCertTrustFilter.java

index be4c676..20984b1 100644 (file)
@@ -109,7 +109,9 @@ public class ClientCertTrustFilter implements Filter {
         */
        public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
                throws IOException, ServletException {
+
                MDC.put("serviceId", "[Client Cert Trust Filter]");
+
                if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse)) {
                        log.error("Only HTTP(s) requests are supported by the ClientCertTrustFilter.");
                        return;
@@ -129,8 +131,7 @@ public class ClientCertTrustFilter implements Filter {
 
                log.debug("Attempting to extract principal name from Subjet: (" + certs[0].getSubjectDN().getName() + ").");
                Matcher matches = regex.matcher(certs[0].getSubjectDN().getName());
-               boolean found = matches.find();
-               if (!found) {
+               if (!matches.find()) {
                        log.error("Principal could not be extracted from Certificate Subject.");
                        httpResponse.sendError(
                                HttpServletResponse.SC_FORBIDDEN,
@@ -155,13 +156,19 @@ public class ClientCertTrustFilter implements Filter {
         * @see javax.servlet.Filter#destroy()
         */
        public void destroy() {
+               //required by interface
+               //no resources to clean
        }
 
-       class ClientCertTrustWrapper extends HttpServletRequestWrapper {
+       /**
+        * <code>HttpServletRequest</code> wrapper class.  Returns a locally specified principal
+        * and hardcoded authType.
+        */
+       private class ClientCertTrustWrapper extends HttpServletRequestWrapper {
 
-               Principal principal;
+               private Principal principal;
 
-               ClientCertTrustWrapper(HttpServletRequest request, Principal principal) {
+               private ClientCertTrustWrapper(HttpServletRequest request, Principal principal) {
                        super(request);
                        this.principal = principal;
                }