Browse Source

SEC-2302: Provide beforeSpringSecurityFilterChain hook

This allows inserting filters before the springSecurityFilterChain.
Rob Winch 12 years ago
parent
commit
b591881e95

+ 9 - 0
web/src/main/java/org/springframework/security/web/context/AbstractSecurityWebApplicationInitializer.java

@@ -108,6 +108,7 @@ public abstract class AbstractSecurityWebApplicationInitializer implements WebAp
      */
     public final void onStartup(ServletContext servletContext)
             throws ServletException {
+        beforeSpringSecurityFilterChain(servletContext);
         if(configurationClasses != null) {
             AnnotationConfigWebApplicationContext rootAppContext = new AnnotationConfigWebApplicationContext();
             rootAppContext.register(configurationClasses);
@@ -283,6 +284,14 @@ public abstract class AbstractSecurityWebApplicationInitializer implements WebAp
         return null;
     }
 
+    /**
+     * Invoked before the springSecurityFilterChain is added.
+     * @param servletContext the {@link ServletContext}
+     */
+    protected void beforeSpringSecurityFilterChain(ServletContext servletContext) {
+
+    }
+
     /**
      * Invoked after the springSecurityFilterChain is added.
      * @param servletContext the {@link ServletContext}