-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Redirect Status Code Configurable #12817
Make Redirect Status Code Configurable #12817
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, @mches! And sorry for the delay; I think this PR got lost in the shuffle.
I've left some inline feedback and look forward to your updates.
...ava/org/springframework/security/web/session/RequestedUrlRedirectInvalidSessionStrategy.java
Outdated
Show resolved
Hide resolved
...ava/org/springframework/security/web/session/RequestedUrlRedirectInvalidSessionStrategy.java
Outdated
Show resolved
Hide resolved
web/src/test/java/org/springframework/security/web/DefaultRedirectStrategyTests.java
Outdated
Show resolved
Hide resolved
web/src/test/java/org/springframework/security/web/session/SessionManagementFilterTests.java
Outdated
Show resolved
Hide resolved
web/src/test/java/org/springframework/security/web/session/SessionManagementFilterTests.java
Outdated
Show resolved
Hide resolved
web/src/main/java/org/springframework/security/web/DefaultRedirectStrategy.java
Show resolved
Hide resolved
web/src/main/java/org/springframework/security/web/DefaultRedirectStrategy.java
Show resolved
Hide resolved
web/src/main/java/org/springframework/security/web/DefaultRedirectStrategy.java
Show resolved
Hide resolved
web/src/main/java/org/springframework/security/web/DefaultRedirectStrategy.java
Outdated
Show resolved
Hide resolved
web/src/main/java/org/springframework/security/web/DefaultRedirectStrategy.java
Outdated
Show resolved
Hide resolved
Also, since this is a new feature, @mches, will you please change the branch to |
I was hoping for this to be usable with Spring Boot 2.7.x, but I get it. |
Thank you for the review, @jzheaux. I've responded inline. I've also rebased, force-pushed, retargeted the PR and updated the PR documentation. |
*/ | ||
public class SessionManagementFilterTests { | ||
|
||
@BeforeEach |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jzheaux SecurityContextHolderAwareRequestWrapperTests
, and perhaps other tests, don't clear the context after each/all tests, so it becomes necessary to counteract side effects that crop up when such tests are run together. Adding @BeforeEach
here does the trick, but I'm open to other options.
SecurityContextHolderAwareRequestWrapperTests.java for reference:
…
package org.springframework.security.web.servletapi;
…
public class SecurityContextHolderAwareRequestWrapperTests {
@BeforeEach
public void tearDown() {
SecurityContextHolder.clearContext();
}
…
@Test
public void testGetRemoteUserStringWithAuthenticatedPrincipal() {
…
SecurityContextHolder.getContext().setAuthentication(auth);
…
}
}
RequestedUrlRedirectInvalidSessionStrategy
, so that the servlet context path can be taken into account if desired.DefaultRedirectStrategy
configurable, so that307 Temporary Redirect
can be chosen if desired.Closes gh-12795
Closes gh-12797