SEC-1061: Renamed serverSideRedirect property.

This commit is contained in:
Luke Taylor 2008-12-14 23:56:30 +00:00
parent cf3cac90ad
commit a0bcf7184c
2 changed files with 13 additions and 12 deletions

View File

@ -18,6 +18,7 @@ package org.springframework.security.ui.webapp;
import org.springframework.security.AuthenticationException; import org.springframework.security.AuthenticationException;
import org.springframework.security.ui.AuthenticationEntryPoint; import org.springframework.security.ui.AuthenticationEntryPoint;
import org.springframework.security.ui.ExceptionTranslationFilter;
import org.springframework.security.util.PortMapper; import org.springframework.security.util.PortMapper;
import org.springframework.security.util.PortMapperImpl; import org.springframework.security.util.PortMapperImpl;
@ -42,8 +43,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
/** /**
* <p> * Used by the {@link ExceptionTranslationFilter} to commence a form login
* Used by the <code>SecurityEnforcementFilter</code> to commence
* authentication via the {@link AuthenticationProcessingFilter}. This object * authentication via the {@link AuthenticationProcessingFilter}. This object
* holds the location of the login form, relative to the web app context path, * holds the location of the login form, relative to the web app context path,
* and is used to commence a redirect to that form. * 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 forceHttps = false;
private boolean serverSideRedirect = false; private boolean useForward = false;
//~ Methods ======================================================================================================== //~ Methods ========================================================================================================
@ -112,7 +112,7 @@ public class AuthenticationProcessingFilterEntryPoint implements AuthenticationE
String redirectUrl = null; String redirectUrl = null;
if (serverSideRedirect) { if (useForward) {
if (forceHttps && "http".equals(request.getScheme())) { if (forceHttps && "http".equals(request.getScheme())) {
redirectUrl = buildHttpsRedirectUrlForRequest(httpRequest); redirectUrl = buildHttpsRedirectUrlForRequest(httpRequest);
@ -243,15 +243,16 @@ public class AuthenticationProcessingFilterEntryPoint implements AuthenticationE
} }
/** /**
* Tells if we are to do a server side include of the <code>loginFormUrl</code> instead of a 302 redirect. * Tells if we are to do a forward to the <code>loginFormUrl</code> using the <tt>RequestDispatcher</tt>,
* instead of a 302 redirect.
* *
* @param serverSideRedirect * @param useForward
*/ */
public void setServerSideRedirect(boolean serverSideRedirect) { public void setUseForward(boolean useForward) {
this.serverSideRedirect = serverSideRedirect; this.useForward = useForward;
} }
protected boolean isServerSideRedirect() { protected boolean isUseForward() {
return serverSideRedirect; return useForward;
} }
} }

View File

@ -215,7 +215,7 @@ public class AuthenticationProcessingFilterEntryPointTests extends TestCase {
public void testServerSideRedirectWithoutForceHttpsForwardsToLoginPage() throws Exception { public void testServerSideRedirectWithoutForceHttpsForwardsToLoginPage() throws Exception {
AuthenticationProcessingFilterEntryPoint ep = new AuthenticationProcessingFilterEntryPoint(); AuthenticationProcessingFilterEntryPoint ep = new AuthenticationProcessingFilterEntryPoint();
ep.setLoginFormUrl("/hello"); ep.setLoginFormUrl("/hello");
ep.setServerSideRedirect(true); ep.setUseForward(true);
ep.afterPropertiesSet(); ep.afterPropertiesSet();
MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletRequest request = new MockHttpServletRequest();
request.setRequestURI("/bigWebApp/some_path"); request.setRequestURI("/bigWebApp/some_path");
@ -235,7 +235,7 @@ public class AuthenticationProcessingFilterEntryPointTests extends TestCase {
public void testServerSideRedirectWithForceHttpsRedirectsCurrentRequest() throws Exception { public void testServerSideRedirectWithForceHttpsRedirectsCurrentRequest() throws Exception {
AuthenticationProcessingFilterEntryPoint ep = new AuthenticationProcessingFilterEntryPoint(); AuthenticationProcessingFilterEntryPoint ep = new AuthenticationProcessingFilterEntryPoint();
ep.setLoginFormUrl("/hello"); ep.setLoginFormUrl("/hello");
ep.setServerSideRedirect(true); ep.setUseForward(true);
ep.setForceHttps(true); ep.setForceHttps(true);
ep.afterPropertiesSet(); ep.afterPropertiesSet();
MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletRequest request = new MockHttpServletRequest();