From a0bcf7184c08ea5279c34c76f32bc19bb7f59c96 Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Sun, 14 Dec 2008 23:56:30 +0000 Subject: [PATCH] SEC-1061: Renamed serverSideRedirect property. --- ...henticationProcessingFilterEntryPoint.java | 21 ++++++++++--------- ...cationProcessingFilterEntryPointTests.java | 4 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) 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();