use of org.apereo.cas.impl.token.InMemoryPasswordlessTokenRepository in project cas by apereo.
the class PasswordlessTokenAuthenticationHandlerTests method verifyAction.
@Test
public void verifyAction() throws Exception {
val repository = new InMemoryPasswordlessTokenRepository(60);
repository.saveToken("casuser", "123456");
val h = new PasswordlessTokenAuthenticationHandler(null, mock(ServicesManager.class), PrincipalFactoryUtils.newPrincipalFactory(), 0, repository);
val c = new OneTimePasswordCredential("casuser", "123456");
assertNotNull(h.authenticate(c));
assertThrows(FailedLoginException.class, () -> h.authenticate(new OneTimePasswordCredential("1", "2")));
assertTrue(h.supports(c));
assertTrue(h.supports(c.getCredentialClass()));
assertFalse(h.supports(new UsernamePasswordCredential()));
}
Aggregations