|
@@ -35,20 +35,14 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
|
|
import org.springframework.security.web.AuthenticationEntryPoint;
|
|
|
import org.springframework.security.web.authentication.logout.LogoutHandler;
|
|
|
import org.springframework.util.Assert;
|
|
|
-import org.springframework.util.ClassUtils;
|
|
|
import org.springframework.web.filter.GenericFilterBean;
|
|
|
|
|
|
/**
|
|
|
* A <code>Filter</code> which populates the <code>ServletRequest</code> with a request
|
|
|
* wrapper which implements the servlet API security methods.
|
|
|
* <p>
|
|
|
- * In pre servlet 3 environment the wrapper class used is
|
|
|
- * {@link SecurityContextHolderAwareRequestWrapper}. See its javadoc for the methods that
|
|
|
- * are implemented.
|
|
|
- * </p>
|
|
|
- * <p>
|
|
|
- * In a servlet 3 environment {@link SecurityContextHolderAwareRequestWrapper} is extended
|
|
|
- * to provide the following additional methods:
|
|
|
+ * {@link SecurityContextHolderAwareRequestWrapper} is extended to provide the following
|
|
|
+ * additional methods:
|
|
|
* </p>
|
|
|
* <ul>
|
|
|
* <li>{@link HttpServletRequest#authenticate(HttpServletResponse)} - Allows the user to
|
|
@@ -114,8 +108,6 @@ public class SecurityContextHolderAwareRequestFilter extends GenericFilterBean {
|
|
|
* @param authenticationEntryPoint the {@link AuthenticationEntryPoint} to use when
|
|
|
* invoking {@link HttpServletRequest#authenticate(HttpServletResponse)} if the user
|
|
|
* is not authenticated.
|
|
|
- *
|
|
|
- * @throws IllegalStateException if the Servlet 3 APIs are not found on the classpath
|
|
|
*/
|
|
|
public void setAuthenticationEntryPoint(
|
|
|
AuthenticationEntryPoint authenticationEntryPoint) {
|
|
@@ -136,8 +128,6 @@ public class SecurityContextHolderAwareRequestFilter extends GenericFilterBean {
|
|
|
*
|
|
|
* @param authenticationManager the {@link AuthenticationManager} to use when invoking
|
|
|
* {@link HttpServletRequest#login(String, String)}
|
|
|
- *
|
|
|
- * @throws IllegalStateException if the Servlet 3 APIs are not found on the classpath
|
|
|
*/
|
|
|
public void setAuthenticationManager(AuthenticationManager authenticationManager) {
|
|
|
this.authenticationManager = authenticationManager;
|
|
@@ -158,8 +148,6 @@ public class SecurityContextHolderAwareRequestFilter extends GenericFilterBean {
|
|
|
*
|
|
|
* @param logoutHandlers the {@code List<LogoutHandler>}s when invoking
|
|
|
* {@link HttpServletRequest#logout()}.
|
|
|
- *
|
|
|
- * @throws IllegalStateException if the Servlet 3 APIs are not found on the classpath
|
|
|
*/
|
|
|
public void setLogoutHandlers(List<LogoutHandler> logoutHandlers) {
|
|
|
this.logoutHandlers = logoutHandlers;
|
|
@@ -179,8 +167,7 @@ public class SecurityContextHolderAwareRequestFilter extends GenericFilterBean {
|
|
|
|
|
|
private void updateFactory() {
|
|
|
String rolePrefix = this.rolePrefix;
|
|
|
- this.requestFactory = isServlet3() ? createServlet3Factory(rolePrefix)
|
|
|
- : new HttpServlet25RequestFactory(this.trustResolver, rolePrefix);
|
|
|
+ this.requestFactory = createServlet3Factory(rolePrefix);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -205,11 +192,4 @@ public class SecurityContextHolderAwareRequestFilter extends GenericFilterBean {
|
|
|
return factory;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Returns true if the Servlet 3 APIs are detected.
|
|
|
- * @return
|
|
|
- */
|
|
|
- private boolean isServlet3() {
|
|
|
- return ClassUtils.hasMethod(ServletRequest.class, "startAsync");
|
|
|
- }
|
|
|
}
|