use of org.apereo.cas.authentication.credential.UsernamePasswordCredential in project cas by apereo.
the class FileAuthenticationHandlerTests method verifyFailsUserNotInFileWithCommaSeparator.
@Test
public void verifyFailsUserNotInFileWithCommaSeparator() {
val c = new UsernamePasswordCredential();
this.authenticationHandler = new FileAuthenticationHandler(StringUtils.EMPTY, null, null, new ClassPathResource("authentication2.txt"), ",");
c.setUsername("fds");
c.setPassword("rutgers");
assertThrows(AccountNotFoundException.class, () -> this.authenticationHandler.authenticate(c));
}
use of org.apereo.cas.authentication.credential.UsernamePasswordCredential in project cas by apereo.
the class FileAuthenticationHandlerTests method verifyFailsNullUserName.
@Test
public void verifyFailsNullUserName() {
val c = new UsernamePasswordCredential();
c.setUsername(null);
c.setPassword("user");
assertThrows(AccountNotFoundException.class, () -> this.authenticationHandler.authenticate(c));
}
use of org.apereo.cas.authentication.credential.UsernamePasswordCredential in project cas by apereo.
the class RejectUsersAuthenticationHandlerTests method verifyPassesNullUserName.
@Test
public void verifyPassesNullUserName() {
val c = new UsernamePasswordCredential();
c.setUsername(null);
c.setPassword("user");
assertThrows(AccountNotFoundException.class, () -> this.authenticationHandler.authenticate(c));
}
use of org.apereo.cas.authentication.credential.UsernamePasswordCredential in project cas by apereo.
the class RejectUsersAuthenticationHandlerTests method verifyFailsUserInMap.
@Test
public void verifyFailsUserInMap() {
val c = new UsernamePasswordCredential();
c.setUsername("scott");
c.setPassword("rutgers");
assertThrows(FailedLoginException.class, () -> this.authenticationHandler.authenticate(c));
}
use of org.apereo.cas.authentication.credential.UsernamePasswordCredential in project cas by apereo.
the class RememberMeAuthenticationMetaDataPopulatorTests method newBuilder.
private static AuthenticationBuilder newBuilder(final Credential credential, final RememberMeAuthenticationProperties properties) {
val populator = new RememberMeAuthenticationMetaDataPopulator(properties);
val meta = new BasicCredentialMetaData(new UsernamePasswordCredential());
val handler = new SimpleTestUsernamePasswordAuthenticationHandler();
val builder = new DefaultAuthenticationBuilder(CoreAuthenticationTestUtils.getPrincipal()).addCredential(meta).addSuccess("test", new DefaultAuthenticationHandlerExecutionResult(handler, meta));
if (populator.supports(credential)) {
populator.populateAttributes(builder, new DefaultAuthenticationTransactionFactory().newTransaction(credential));
}
return builder;
}
Aggregations