diff --git a/core/src/main/java/org/springframework/security/ui/webapp/AuthenticationProcessingFilterEntryPoint.java b/core/src/main/java/org/springframework/security/ui/webapp/AuthenticationProcessingFilterEntryPoint.java index 15333d6cc3..783f02d405 100644 --- a/core/src/main/java/org/springframework/security/ui/webapp/AuthenticationProcessingFilterEntryPoint.java +++ b/core/src/main/java/org/springframework/security/ui/webapp/AuthenticationProcessingFilterEntryPoint.java @@ -18,6 +18,7 @@ package org.springframework.security.ui.webapp; import org.springframework.security.AuthenticationException; import org.springframework.security.ui.AuthenticationEntryPoint; +import org.springframework.security.ui.ExceptionTranslationFilter; import org.springframework.security.util.PortMapper; import org.springframework.security.util.PortMapperImpl; @@ -42,8 +43,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** - *
- * Used by the SecurityEnforcementFilter to commence
+ * Used by the {@link ExceptionTranslationFilter} to commence a form login
* authentication via the {@link AuthenticationProcessingFilter}. This object
* holds the location of the login form, relative to the web app context path,
* and is used to commence a redirect to that form.
@@ -76,7 +76,7 @@ public class AuthenticationProcessingFilterEntryPoint implements AuthenticationE
private boolean forceHttps = false;
- private boolean serverSideRedirect = false;
+ private boolean useForward = false;
//~ Methods ========================================================================================================
@@ -112,7 +112,7 @@ public class AuthenticationProcessingFilterEntryPoint implements AuthenticationE
String redirectUrl = null;
- if (serverSideRedirect) {
+ if (useForward) {
if (forceHttps && "http".equals(request.getScheme())) {
redirectUrl = buildHttpsRedirectUrlForRequest(httpRequest);
@@ -243,15 +243,16 @@ public class AuthenticationProcessingFilterEntryPoint implements AuthenticationE
}
/**
- * Tells if we are to do a server side include of the loginFormUrl instead of a 302 redirect.
+ * Tells if we are to do a forward to the loginFormUrl using the RequestDispatcher,
+ * instead of a 302 redirect.
*
- * @param serverSideRedirect
+ * @param useForward
*/
- public void setServerSideRedirect(boolean serverSideRedirect) {
- this.serverSideRedirect = serverSideRedirect;
+ public void setUseForward(boolean useForward) {
+ this.useForward = useForward;
}
- protected boolean isServerSideRedirect() {
- return serverSideRedirect;
+ protected boolean isUseForward() {
+ return useForward;
}
}
diff --git a/core/src/test/java/org/springframework/security/ui/webapp/AuthenticationProcessingFilterEntryPointTests.java b/core/src/test/java/org/springframework/security/ui/webapp/AuthenticationProcessingFilterEntryPointTests.java
index 008feaafad..0523d85bdb 100644
--- a/core/src/test/java/org/springframework/security/ui/webapp/AuthenticationProcessingFilterEntryPointTests.java
+++ b/core/src/test/java/org/springframework/security/ui/webapp/AuthenticationProcessingFilterEntryPointTests.java
@@ -215,7 +215,7 @@ public class AuthenticationProcessingFilterEntryPointTests extends TestCase {
public void testServerSideRedirectWithoutForceHttpsForwardsToLoginPage() throws Exception {
AuthenticationProcessingFilterEntryPoint ep = new AuthenticationProcessingFilterEntryPoint();
ep.setLoginFormUrl("/hello");
- ep.setServerSideRedirect(true);
+ ep.setUseForward(true);
ep.afterPropertiesSet();
MockHttpServletRequest request = new MockHttpServletRequest();
request.setRequestURI("/bigWebApp/some_path");
@@ -235,7 +235,7 @@ public class AuthenticationProcessingFilterEntryPointTests extends TestCase {
public void testServerSideRedirectWithForceHttpsRedirectsCurrentRequest() throws Exception {
AuthenticationProcessingFilterEntryPoint ep = new AuthenticationProcessingFilterEntryPoint();
ep.setLoginFormUrl("/hello");
- ep.setServerSideRedirect(true);
+ ep.setUseForward(true);
ep.setForceHttps(true);
ep.afterPropertiesSet();
MockHttpServletRequest request = new MockHttpServletRequest();