Skip to content

Commit 01892b6

Browse files
committed
use a request matcher on authorization request filter, closes mitreid-connect#1033
1 parent ca6e867 commit 01892b6

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

openid-connect-server/src/main/java/org/mitre/openid/connect/filter/AuthorizationRequestFilter.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
import org.springframework.security.oauth2.provider.AuthorizationRequest;
5252
import org.springframework.security.oauth2.provider.OAuth2RequestFactory;
5353
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;
5456
import org.springframework.stereotype.Component;
5557
import org.springframework.web.filter.GenericFilterBean;
5658

@@ -83,6 +85,8 @@ public class AuthorizationRequestFilter extends GenericFilterBean {
8385

8486
@Autowired(required = false)
8587
private LoginHintExtracter loginHintExtracter = new RemoveLoginHintsWithHTTP();
88+
89+
private RequestMatcher requestMatcher = new AntPathRequestMatcher("/authorize");
8690

8791
/**
8892
*
@@ -95,7 +99,7 @@ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
9599
HttpSession session = request.getSession();
96100

97101
// skip everything that's not an authorize URL
98-
if (!request.getServletPath().startsWith("/authorize")) {
102+
if (requestMatcher.matches(request)) {
99103
chain.doFilter(req, res);
100104
return;
101105
}
@@ -245,4 +249,18 @@ private Map<String, String> createRequestMap(Map<String, String[]> parameterMap)
245249
return requestMap;
246250
}
247251

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+
248266
}

0 commit comments

Comments
 (0)