List of usage examples for org.springframework.mock.web MockHttpServletRequest setSecure
public void setSecure(boolean secure)
From source file:org.opensaml.ws.security.provider.HTTPRuleTest.java
/** * Builds a mock {@link HttpServletRequest}. * /* w w w .ja va 2s .c o m*/ * @return the mock request */ protected MockHttpServletRequest buildServletRequest() { MockHttpServletRequest request = new MockHttpServletRequest(); request.setContentType(contentType); request.setMethod(method); request.setSecure(requireSecured); return request; }
From source file:org.jasig.cas.client.util.CommonUtilsTests.java
public void testConstructServiceUrlWithTrailingSlash() { final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/"; final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/"); request.setScheme("https"); request.setSecure(true); final MockHttpServletResponse response = new MockHttpServletResponse(); final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com", "service", "ticket", false); assertEquals(CONST_MY_URL, constructedUrl); }
From source file:org.jasig.cas.client.util.CommonUtilsTests.java
public void testConstructServiceUrlWithParamsCas() { final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/"; final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/"); request.setScheme("https"); request.setSecure(true); request.setQueryString("service=this&ticket=that&custom=custom"); final MockHttpServletResponse response = new MockHttpServletResponse(); final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com", Protocol.CAS3.getServiceParameterName(), Protocol.CAS3.getArtifactParameterName(), false); assertEquals("https://www.myserver.com/hello/hithere/?custom=custom", constructedUrl); }
From source file:org.jasig.cas.client.util.CommonUtilsTests.java
public void testConstructServiceUrlWithParamsSaml() { final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/"; final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/"); request.setScheme("https"); request.setSecure(true); request.setQueryString("TARGET=this&SAMLart=that&custom=custom"); final MockHttpServletResponse response = new MockHttpServletResponse(); final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com", Protocol.SAML11.getServiceParameterName(), Protocol.SAML11.getArtifactParameterName(), false); assertEquals("https://www.myserver.com/hello/hithere/?custom=custom", constructedUrl); }
From source file:org.jasig.cas.client.util.CommonUtilsTests.java
public void testConstructServiceUrlWithEncodedParamsSaml() { final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/"; final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/"); request.setScheme("https"); request.setSecure(true); request.setQueryString("TARGET%3Dthis%26SAMLart%3Dthat%26custom%3Dcustom"); final MockHttpServletResponse response = new MockHttpServletResponse(); final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com", Protocol.SAML11.getServiceParameterName(), Protocol.SAML11.getArtifactParameterName(), false); assertEquals("https://www.myserver.com/hello/hithere/?custom=custom", constructedUrl); }
From source file:org.jasig.cas.client.util.CommonUtilsTests.java
public void testConstructServiceUrlWithNoServiceParametersPassed() { final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/"; final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/"); request.setScheme("https"); request.setSecure(true); request.setQueryString("TARGET=Test1&service=Test2&custom=custom"); final MockHttpServletResponse response = new MockHttpServletResponse(); final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com", Protocol.SAML11.getArtifactParameterName(), true); assertEquals("https://www.myserver.com/hello/hithere/?custom=custom", constructedUrl); }
From source file:org.jasig.cas.client.util.CommonUtilsTests.java
public void testConstructServiceUrlWithParamsCasAndServerNameWithSchema() { final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/"; final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/"); request.setScheme("https"); request.setSecure(true); request.setQueryString("service=this&ticket=that&custom=custom"); final MockHttpServletResponse response = new MockHttpServletResponse(); final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "https://www.myserver.com", Protocol.CAS3.getServiceParameterName(), Protocol.CAS3.getArtifactParameterName(), false); assertEquals("https://www.myserver.com/hello/hithere/?custom=custom", constructedUrl); }
From source file:org.jasig.cas.client.util.CommonUtilsTests.java
public void testConstructServiceUrlWithEncodedParams2Saml() { final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/"; final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/"); request.setScheme("https"); request.setSecure(true); request.setQueryString("TARGET%3Dthis%26SAMLart%3Dthat%26custom%3Dcustom%20value%20here%26another%3Dgood"); final MockHttpServletResponse response = new MockHttpServletResponse(); final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com", Protocol.SAML11.getServiceParameterName(), Protocol.SAML11.getArtifactParameterName(), true); assertEquals("https://www.myserver.com/hello/hithere/?custom=custom+value+here&another=good", constructedUrl);// ww w .j a v a2s . co m }
From source file:org.jasig.cas.client.util.CommonUtilsTests.java
public void testConstructServiceUrlWithoutEncodedParamsSamlAndNoEncoding() { final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/"; final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/"); request.setScheme("https"); request.setSecure(true); request.setQueryString("TARGET=this&SAMLart=that&custom=custom value here&another=good"); final MockHttpServletResponse response = new MockHttpServletResponse(); final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com", Protocol.SAML11.getServiceParameterName(), Protocol.SAML11.getArtifactParameterName(), false); assertEquals("https://www.myserver.com/hello/hithere/?custom=custom value here&another=good", constructedUrl);//from ww w.j a va 2 s . c om }
From source file:org.jasig.cas.client.util.CommonUtilsTests.java
public void testConstructServiceUrlWithEncodedParamsSamlAndNoEncoding() { final String CONST_MY_URL = "https://www.myserver.com/hello/hithere/"; final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hello/hithere/"); request.setScheme("https"); request.setSecure(true); request.setQueryString("TARGET=this&SAMLart=that&custom=custom+value+here&another=good"); final MockHttpServletResponse response = new MockHttpServletResponse(); final String constructedUrl = CommonUtils.constructServiceUrl(request, response, null, "www.myserver.com", Protocol.SAML11.getServiceParameterName(), Protocol.SAML11.getArtifactParameterName(), true); assertEquals("https://www.myserver.com/hello/hithere/?custom=custom+value+here&another=good", constructedUrl);// ww w.j ava2 s . c om }