35
35
import org .springframework .security .web .AuthenticationEntryPoint ;
36
36
import org .springframework .security .web .authentication .logout .LogoutHandler ;
37
37
import org .springframework .util .Assert ;
38
- import org .springframework .util .ClassUtils ;
39
38
import org .springframework .web .filter .GenericFilterBean ;
40
39
41
40
/**
42
41
* A <code>Filter</code> which populates the <code>ServletRequest</code> with a request
43
42
* wrapper which implements the servlet API security methods.
44
43
* <p>
45
- * In pre servlet 3 environment the wrapper class used is
46
- * {@link SecurityContextHolderAwareRequestWrapper}. See its javadoc for the methods that
47
- * are implemented.
48
- * </p>
49
- * <p>
50
- * In a servlet 3 environment {@link SecurityContextHolderAwareRequestWrapper} is extended
51
- * to provide the following additional methods:
44
+ * {@link SecurityContextHolderAwareRequestWrapper} is extended to provide the following
45
+ * additional methods:
52
46
* </p>
53
47
* <ul>
54
48
* <li>{@link HttpServletRequest#authenticate(HttpServletResponse)} - Allows the user to
@@ -114,8 +108,6 @@ public void setRolePrefix(String rolePrefix) {
114
108
* @param authenticationEntryPoint the {@link AuthenticationEntryPoint} to use when
115
109
* invoking {@link HttpServletRequest#authenticate(HttpServletResponse)} if the user
116
110
* is not authenticated.
117
- *
118
- * @throws IllegalStateException if the Servlet 3 APIs are not found on the classpath
119
111
*/
120
112
public void setAuthenticationEntryPoint (
121
113
AuthenticationEntryPoint authenticationEntryPoint ) {
@@ -136,8 +128,6 @@ public void setAuthenticationEntryPoint(
136
128
*
137
129
* @param authenticationManager the {@link AuthenticationManager} to use when invoking
138
130
* {@link HttpServletRequest#login(String, String)}
139
- *
140
- * @throws IllegalStateException if the Servlet 3 APIs are not found on the classpath
141
131
*/
142
132
public void setAuthenticationManager (AuthenticationManager authenticationManager ) {
143
133
this .authenticationManager = authenticationManager ;
@@ -158,8 +148,6 @@ public void setAuthenticationManager(AuthenticationManager authenticationManager
158
148
*
159
149
* @param logoutHandlers the {@code List<LogoutHandler>}s when invoking
160
150
* {@link HttpServletRequest#logout()}.
161
- *
162
- * @throws IllegalStateException if the Servlet 3 APIs are not found on the classpath
163
151
*/
164
152
public void setLogoutHandlers (List <LogoutHandler > logoutHandlers ) {
165
153
this .logoutHandlers = logoutHandlers ;
@@ -179,8 +167,7 @@ public void afterPropertiesSet() throws ServletException {
179
167
180
168
private void updateFactory () {
181
169
String rolePrefix = this .rolePrefix ;
182
- this .requestFactory = isServlet3 () ? createServlet3Factory (rolePrefix )
183
- : new HttpServlet25RequestFactory (this .trustResolver , rolePrefix );
170
+ this .requestFactory = createServlet3Factory (rolePrefix );
184
171
}
185
172
186
173
/**
@@ -205,11 +192,4 @@ private HttpServletRequestFactory createServlet3Factory(String rolePrefix) {
205
192
return factory ;
206
193
}
207
194
208
- /**
209
- * Returns true if the Servlet 3 APIs are detected.
210
- * @return
211
- */
212
- private boolean isServlet3 () {
213
- return ClassUtils .hasMethod (ServletRequest .class , "startAsync" );
214
- }
215
195
}
0 commit comments