Skip to content

Commit 81a9302

Browse files
committed
Polish enableSessionUrlRewriting Clarification
Closes gh-7644
1 parent c1b0e59 commit 81a9302

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,14 @@ public SessionManagementConfigurer<H> sessionAuthenticationFailureHandler(
199199
/**
200200
* If set to true, allows HTTP sessions to be rewritten in the URLs when using
201201
* {@link HttpServletResponse#encodeRedirectURL(String)} or
202-
* {@link HttpServletResponse#encodeURL(String)}, otherwise disallows all URL
203-
* rewriting, including resource chain functionality.
204-
* This prevents leaking information to external domains.
202+
* {@link HttpServletResponse#encodeURL(String)}, otherwise disallows HTTP sessions to
203+
* be included in the URL. This prevents leaking information to external domains.
204+
* <p>
205+
* This is achieved by guarding {@link HttpServletResponse#encodeURL} and
206+
* {@link HttpServletResponse#encodeRedirectURL} invocations. Any code that also
207+
* overrides either of these two methods, like
208+
* {@link org.springframework.web.servlet.resource.ResourceUrlEncodingFilter}, needs
209+
* to come after the security filter chain or risk being skipped.
205210
* @param enableSessionUrlRewriting true if should allow the JSESSIONID to be
206211
* rewritten into the URLs, else false (default)
207212
* @return the {@link SessionManagementConfigurer} for further customization

0 commit comments

Comments
 (0)