SEC-1328: Fixed issue with redirect to context relative URLs where the context name is part of the domain name.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package org.springframework.security.web;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Luke Taylor
|
||||
* @since 3.0
|
||||
*/
|
||||
public class DefaultRedirectStrategyTests {
|
||||
@Test
|
||||
public void contextRelativeUrlWithContextNameInHostnameIsHandledCorrectly() throws Exception {
|
||||
DefaultRedirectStrategy rds = new DefaultRedirectStrategy();
|
||||
rds.setContextRelative(true);
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.setContextPath("/context");
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
rds.sendRedirect(request, response, "http://context.blah.com/context/remainder");
|
||||
|
||||
assertEquals("remainder", response.getRedirectedUrl());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user