"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/cas-server-core-cookie-api/src/test/java/org/apereo/cas/web/support/CookieRetrievingCookieGeneratorTests.java" between
cas-6.0.4.tar.gz and cas-6.0.5.tar.gz

About: CAS (Central Authentication Service) is an authentication system (providing single sign-on service).

CookieRetrievingCookieGeneratorTests.java  (cas-6.0.4):CookieRetrievingCookieGeneratorTests.java  (cas-6.0.5)
skipping to change at line 48 skipping to change at line 48
val request = new MockHttpServletRequest(); val request = new MockHttpServletRequest();
request.addParameter(RememberMeCredential.REQUEST_PARAMETER_REMEMBER_ME, "true"); request.addParameter(RememberMeCredential.REQUEST_PARAMETER_REMEMBER_ME, "true");
WebUtils.putRememberMeAuthenticationEnabled(context, Boolean.TRUE); WebUtils.putRememberMeAuthenticationEnabled(context, Boolean.TRUE);
val response = new MockHttpServletResponse(); val response = new MockHttpServletResponse();
context.setExternalContext(new ServletExternalContext(new MockServletCon text(), request, response)); context.setExternalContext(new ServletExternalContext(new MockServletCon text(), request, response));
gen.addCookie(context, "CAS-Cookie-Value"); gen.addCookie(context, "CAS-Cookie-Value");
assertTrue(response.getCookies().length > 0); assertTrue(response.getCookies().length > 0);
} }
@Test @Test
public void verifyCookieForRememberMeByRequestContextLegacyAttribute() {
val rememberMeMaxAge = 99999;
val gen = new CookieRetrievingCookieGenerator("cas", "/", 1000, true, "e
xample.org", new NoOpCookieValueManager(), rememberMeMaxAge, true);
val context = new MockRequestContext();
val request = new MockHttpServletRequest();
val authn = CoreAuthenticationTestUtils.getAuthentication("casuser",
CollectionUtils.wrap(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_R
EMEMBER_ME, Boolean.TRUE));
WebUtils.putAuthentication(authn, context);
WebUtils.putRememberMeAuthenticationEnabled(context, Boolean.TRUE);
val response = new MockHttpServletResponse();
context.setExternalContext(new ServletExternalContext(new MockServletCon
text(), request, response));
gen.addCookie(context, "CAS-Cookie-Value");
val cookie = response.getCookie("cas");
assertNotNull(cookie);
assertEquals(rememberMeMaxAge, cookie.getMaxAge());
}
@Test
public void verifyCookieForRememberMeByRequestContext() { public void verifyCookieForRememberMeByRequestContext() {
val gen = new CookieRetrievingCookieGenerator("cas", "/", 1000, true, "e val rememberMeMaxAge = 99999;
xample.org", true); val gen = new CookieRetrievingCookieGenerator("cas", "/", 1000, true, "e
xample.org", new NoOpCookieValueManager(), rememberMeMaxAge, true);
val context = new MockRequestContext(); val context = new MockRequestContext();
val request = new MockHttpServletRequest(); val request = new MockHttpServletRequest();
val authn = CoreAuthenticationTestUtils.getAuthentication("casuser", val authn = CoreAuthenticationTestUtils.getAuthentication("casuser",
CollectionUtils.wrap(RememberMeCredential.REQUEST_PARAMETER_REMEMBER _ME, "true")); CollectionUtils.wrap(RememberMeCredential.AUTHENTICATION_ATTRIBU TE_REMEMBER_ME, CollectionUtils.wrap(Boolean.TRUE)));
WebUtils.putAuthentication(authn, context); WebUtils.putAuthentication(authn, context);
WebUtils.putRememberMeAuthenticationEnabled(context, Boolean.TRUE); WebUtils.putRememberMeAuthenticationEnabled(context, Boolean.TRUE);
val response = new MockHttpServletResponse(); val response = new MockHttpServletResponse();
context.setExternalContext(new ServletExternalContext(new MockServletCon text(), request, response)); context.setExternalContext(new ServletExternalContext(new MockServletCon text(), request, response));
gen.addCookie(context, "CAS-Cookie-Value"); gen.addCookie(context, "CAS-Cookie-Value");
assertTrue(response.getCookies().length > 0); val cookie = response.getCookie("cas");
assertNotNull(cookie);
assertEquals(rememberMeMaxAge, cookie.getMaxAge());
} }
} }
 End of changes. 4 change blocks. 
4 lines changed or deleted 28 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)