use of org.apereo.cas.configuration.model.core.ticket.RememberMeAuthenticationProperties in project cas by apereo.
the class RememberMeAuthenticationMetaDataPopulatorTests method verifyWithoutRememberMeCredentials.
@Test
public void verifyWithoutRememberMeCredentials() {
val builder = newBuilder(CoreAuthenticationTestUtils.getCredentialsWithSameUsernameAndPassword(), new RememberMeAuthenticationProperties());
val auth = builder.build();
assertNull(auth.getAttributes().get(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME));
}
use of org.apereo.cas.configuration.model.core.ticket.RememberMeAuthenticationProperties in project cas by apereo.
the class RememberMeAuthenticationMetaDataPopulatorTests method verifyWithTrueRememberMeCredentials.
@Test
public void verifyWithTrueRememberMeCredentials() {
val c = new RememberMeUsernamePasswordCredential();
c.setRememberMe(true);
val builder = newBuilder(c, new RememberMeAuthenticationProperties());
val auth = builder.build();
assertEquals(true, auth.getAttributes().get(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME).get(0));
}
use of org.apereo.cas.configuration.model.core.ticket.RememberMeAuthenticationProperties in project cas by apereo.
the class RememberMeAuthenticationMetaDataPopulatorTests method verifyWithFalseRememberMeCredentials.
@Test
public void verifyWithFalseRememberMeCredentials() {
val c = new RememberMeUsernamePasswordCredential();
c.setRememberMe(false);
val builder = newBuilder(c, new RememberMeAuthenticationProperties());
val auth = builder.build();
assertNull(auth.getAttributes().get(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME));
}
use of org.apereo.cas.configuration.model.core.ticket.RememberMeAuthenticationProperties in project cas by apereo.
the class RememberMeAuthenticationMetaDataPopulatorTests method verifyRememberMeIp.
@Test
public void verifyRememberMeIp() {
val request = new MockHttpServletRequest();
request.setRemoteAddr("185.86.151.11");
request.setLocalAddr("185.88.151.11");
ClientInfoHolder.setClientInfo(new ClientInfo(request));
val c = new RememberMeUsernamePasswordCredential();
c.setRememberMe(true);
val builder = newBuilder(c, new RememberMeAuthenticationProperties().setSupportedIpAddresses("192.+"));
val auth = builder.build();
assertFalse(auth.getAttributes().containsKey(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME));
}
use of org.apereo.cas.configuration.model.core.ticket.RememberMeAuthenticationProperties in project cas by apereo.
the class RememberMeAuthenticationMetaDataPopulatorTests method verifyRememberMeUserAgentAndIp.
@Test
public void verifyRememberMeUserAgentAndIp() {
val request = new MockHttpServletRequest();
request.setRemoteAddr("185.86.151.11");
request.setLocalAddr("185.88.151.11");
request.addHeader(HttpRequestUtils.USER_AGENT_HEADER, "Chrome");
ClientInfoHolder.setClientInfo(new ClientInfo(request));
val c = new RememberMeUsernamePasswordCredential();
c.setRememberMe(true);
val builder = newBuilder(c, new RememberMeAuthenticationProperties().setSupportedUserAgents("Chrome").setSupportedIpAddresses("123.+"));
val auth = builder.build();
assertFalse(auth.getAttributes().containsKey(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME));
}
Aggregations