use of org.apereo.cas.authentication.credential.UsernamePasswordCredential in project cas by apereo.
the class FileAuthenticationHandlerTests method verifyAuthenticateNoFileName.
@Test
public void verifyAuthenticateNoFileName() {
val c = new UsernamePasswordCredential();
this.authenticationHandler = new FileAuthenticationHandler(StringUtils.EMPTY, null, null, new ClassPathResource("fff"), FileAuthenticationHandler.DEFAULT_SEPARATOR);
c.setUsername("scott");
c.setPassword("rutgers");
assertThrows(PreventedException.class, () -> this.authenticationHandler.authenticate(c));
}
use of org.apereo.cas.authentication.credential.UsernamePasswordCredential in project cas by apereo.
the class FileAuthenticationHandlerTests method verifySupportsProperUserCredentials.
@Test
public void verifySupportsProperUserCredentials() throws Exception {
val c = new UsernamePasswordCredential();
c.setUsername("scott");
c.setPassword("rutgers");
assertNotNull(this.authenticationHandler.authenticate(c));
}
use of org.apereo.cas.authentication.credential.UsernamePasswordCredential in project cas by apereo.
the class FileAuthenticationHandlerTests method verifyAuthenticatesUserInFileWithDefaultSeparator.
@Test
public void verifyAuthenticatesUserInFileWithDefaultSeparator() throws Exception {
val c = new UsernamePasswordCredential();
c.setUsername("scott");
c.setPassword("rutgers");
assertNotNull(this.authenticationHandler.authenticate(c));
}
use of org.apereo.cas.authentication.credential.UsernamePasswordCredential in project cas by apereo.
the class FileAuthenticationHandlerTests method verifyFailsNullPassword.
@Test
public void verifyFailsNullPassword() {
val c = new UsernamePasswordCredential();
c.setUsername("scott");
c.setPassword(null);
assertThrows(FailedLoginException.class, () -> this.authenticationHandler.authenticate(c));
}
use of org.apereo.cas.authentication.credential.UsernamePasswordCredential in project cas by apereo.
the class FileAuthenticationHandlerTests method verifyAuthenticatesUserInFileWithCommaSeparator.
@Test
public void verifyAuthenticatesUserInFileWithCommaSeparator() throws Exception {
val c = new UsernamePasswordCredential();
this.authenticationHandler = new FileAuthenticationHandler(StringUtils.EMPTY, null, null, new ClassPathResource("authentication2.txt"), ",");
c.setUsername("scott");
c.setPassword("rutgers");
assertNotNull(this.authenticationHandler.authenticate(c));
}
Aggregations