use of org.springframework.security.cas.authentication.CasAuthenticationToken in project spring-security by spring-projects.
the class AbstractStatelessTicketCacheTests method getToken.
protected CasAuthenticationToken getToken() {
List<String> proxyList = new ArrayList<String>();
proxyList.add("https://localhost/newPortal/login/cas");
User user = new User("rod", "password", true, true, true, true, AuthorityUtils.createAuthorityList("ROLE_ONE", "ROLE_TWO"));
final Assertion assertion = new AssertionImpl("rod");
return new CasAuthenticationToken("key", user, "ST-0-ER94xMJmn6pha35CQRoZ", AuthorityUtils.createAuthorityList("ROLE_ONE", "ROLE_TWO"), user, assertion);
}
use of org.springframework.security.cas.authentication.CasAuthenticationToken in project spring-security by spring-projects.
the class NullStatelessTicketCacheTests method testInsertAndGet.
@Test
public void testInsertAndGet() {
final CasAuthenticationToken token = getToken();
cache.putTicketInCache(token);
assertThat(cache.getByTicketId((String) token.getCredentials())).isNull();
}
use of org.springframework.security.cas.authentication.CasAuthenticationToken in project spring-security by spring-projects.
the class CasAuthenticationTokenMixinTests method serializeCasAuthenticationTestAfterEraseCredentialInvoked.
@Test
public void serializeCasAuthenticationTestAfterEraseCredentialInvoked() throws JsonProcessingException, JSONException {
CasAuthenticationToken token = createCasAuthenticationToken();
token.eraseCredentials();
String actualJson = mapper.writeValueAsString(token);
JSONAssert.assertEquals(CAS_TOKEN_CLEARED_JSON, actualJson, true);
}
use of org.springframework.security.cas.authentication.CasAuthenticationToken in project spring-security by spring-projects.
the class CasAuthenticationTokenMixinTests method deserializeCasAuthenticationTestAfterEraseCredentialInvoked.
@Test
public void deserializeCasAuthenticationTestAfterEraseCredentialInvoked() throws Exception {
CasAuthenticationToken token = mapper.readValue(CAS_TOKEN_CLEARED_JSON, CasAuthenticationToken.class);
assertThat(((UserDetails) token.getPrincipal()).getPassword()).isNull();
}
Aggregations