51
51
import org .springframework .security .oauth2 .provider .AuthorizationRequest ;
52
52
import org .springframework .security .oauth2 .provider .OAuth2RequestFactory ;
53
53
import org .springframework .security .oauth2 .provider .endpoint .RedirectResolver ;
54
+ import org .springframework .security .web .util .matcher .AntPathRequestMatcher ;
55
+ import org .springframework .security .web .util .matcher .RequestMatcher ;
54
56
import org .springframework .stereotype .Component ;
55
57
import org .springframework .web .filter .GenericFilterBean ;
56
58
@@ -83,6 +85,8 @@ public class AuthorizationRequestFilter extends GenericFilterBean {
83
85
84
86
@ Autowired (required = false )
85
87
private LoginHintExtracter loginHintExtracter = new RemoveLoginHintsWithHTTP ();
88
+
89
+ private RequestMatcher requestMatcher = new AntPathRequestMatcher ("/authorize" );
86
90
87
91
/**
88
92
*
@@ -95,7 +99,7 @@ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
95
99
HttpSession session = request .getSession ();
96
100
97
101
// skip everything that's not an authorize URL
98
- if (! request . getServletPath (). startsWith ( "/authorize" )) {
102
+ if (requestMatcher . matches ( request )) {
99
103
chain .doFilter (req , res );
100
104
return ;
101
105
}
@@ -245,4 +249,18 @@ private Map<String, String> createRequestMap(Map<String, String[]> parameterMap)
245
249
return requestMap ;
246
250
}
247
251
252
+ /**
253
+ * @return the requestMatcher
254
+ */
255
+ public RequestMatcher getRequestMatcher () {
256
+ return requestMatcher ;
257
+ }
258
+
259
+ /**
260
+ * @param requestMatcher the requestMatcher to set
261
+ */
262
+ public void setRequestMatcher (RequestMatcher requestMatcher ) {
263
+ this .requestMatcher = requestMatcher ;
264
+ }
265
+
248
266
}
0 commit comments