Search in sources :

Example 6 with SavedCookie

use of org.springframework.security.web.savedrequest.SavedCookie in project spring-security by spring-projects.

the class DefaultSavedRequestMixinTests method serializeDefaultRequestBuildWithBuilderTest.

@Test
public void serializeDefaultRequestBuildWithBuilderTest() throws IOException, JSONException {
    DefaultSavedRequest request = new DefaultSavedRequest.Builder().setCookies(Collections.singletonList(new SavedCookie(new Cookie("SESSION", "123456789")))).setHeaders(Collections.singletonMap("x-auth-token", Collections.singletonList("12"))).setScheme("http").setRequestURL("http://localhost").setServerName("localhost").setRequestURI("").setLocales(Collections.singletonList(new Locale("en"))).setContextPath("").setMethod("").setServletPath("").build();
    String actualString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(request);
    JSONAssert.assertEquals(REQUEST_JSON, actualString, true);
}
Also used : SavedCookie(org.springframework.security.web.savedrequest.SavedCookie) Cookie(javax.servlet.http.Cookie) Locale(java.util.Locale) SavedCookie(org.springframework.security.web.savedrequest.SavedCookie) DefaultSavedRequest(org.springframework.security.web.savedrequest.DefaultSavedRequest) Test(org.junit.Test)

Example 7 with SavedCookie

use of org.springframework.security.web.savedrequest.SavedCookie in project spring-security by spring-projects.

the class SavedCookieTests method setUp.

@Before
public void setUp() throws Exception {
    cookie = new Cookie("name", "value");
    cookie.setComment("comment");
    cookie.setDomain("domain");
    cookie.setMaxAge(100);
    cookie.setPath("path");
    cookie.setSecure(true);
    cookie.setVersion(11);
    savedCookie = new SavedCookie(cookie);
}
Also used : SavedCookie(org.springframework.security.web.savedrequest.SavedCookie) Cookie(javax.servlet.http.Cookie) SavedCookie(org.springframework.security.web.savedrequest.SavedCookie) Before(org.junit.Before)

Aggregations

SavedCookie (org.springframework.security.web.savedrequest.SavedCookie)7 Cookie (javax.servlet.http.Cookie)6 Test (org.junit.Test)6 Locale (java.util.Locale)2 DefaultSavedRequest (org.springframework.security.web.savedrequest.DefaultSavedRequest)2 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1 PortResolverImpl (org.springframework.security.web.PortResolverImpl)1