improved j_security_check matching accuracy and performance
authormaxcooper <maxcooper>
Sun, 5 Jan 2003 09:25:00 +0000 (09:25 +0000)
committermaxcooper <maxcooper>
Sun, 5 Jan 2003 09:25:00 +0000 (09:25 +0000)
src/share/org/securityfilter/filter/SecurityFilter.java

index fb8b2a4..0b989a7 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * $Header: /cvsroot/securityfilter/securityfilter/src/share/org/securityfilter/filter/SecurityFilter.java,v 1.10 2002/12/17 15:10:00 maxcooper Exp $
- * $Revision: 1.10 $
- * $Date: 2002/12/17 15:10:00 $
+ * $Header: /cvsroot/securityfilter/securityfilter/src/share/org/securityfilter/filter/SecurityFilter.java,v 1.11 2003/01/05 09:25:00 maxcooper Exp $
+ * $Revision: 1.11 $
+ * $Date: 2003/01/05 09:25:00 $
  *
  * ====================================================================
  * The SecurityFilter Software License, Version 1.1
@@ -75,7 +75,7 @@ import java.util.*;
  *
  * @author Max Cooper (max@maxcooper.com)
  * @author Torgeir Veimo (torgeir@pobox.com)
- * @version $Revision: 1.10 $ $Date: 2002/12/17 15:10:00 $
+ * @version $Revision: 1.11 $ $Date: 2003/01/05 09:25:00 $
  */
 public class SecurityFilter implements Filter {
    public static final String SAVED_REQUEST_URL = SecurityFilter.class.getName() + ".SAVED_REQUEST_URL";
@@ -93,12 +93,11 @@ public class SecurityFilter implements Filter {
    protected String errorPage;
    protected String defaultPage;
    protected URLPatternFactory patternFactory;
-   protected URLPattern loginSubmitPattern;
    protected List patternList;
 
    protected static final String FORM_USERNAME = "j_username";
    protected static final String FORM_PASSWORD = "j_password";
-   protected static final String FORM_SUBMIT_PATTERN = "*/j_security_check";
+   protected static final String FORM_SUBMIT_URL = "/j_security_check";
 
    /**
     * Perform filtering operation, and optionally pass the request down the chain.
@@ -139,7 +138,7 @@ public class SecurityFilter implements Filter {
          URLPattern match = null;
          try {
             // check if this is a login form submittal
-            if (patternMatcher.match(requestURL, loginSubmitPattern)) {
+            if (requestURL.endsWith(FORM_SUBMIT_URL)) {
                processLogin(wrappedRequest, hRes);
                return;
             }
@@ -200,13 +199,6 @@ public class SecurityFilter implements Filter {
       try {
          patternFactory = new URLPatternFactory();
 
-         // login submit RE
-         try {
-            loginSubmitPattern = patternFactory.createURLPattern(FORM_SUBMIT_PATTERN, null, null, 0);
-         } catch (Exception e) {
-            throw new ServletException("Error creating login submit pattern", e);
-         }
-
          // parse config file
          String configFile = config.getInitParameter(CONFIG_FILE_KEY);
          if (configFile == null) {