use of org.apereo.cas.configuration.model.support.jdbc.authn.QueryEncodeJdbcAuthenticationProperties in project cas by apereo.
the class QueryAndEncodeDatabaseAuthenticationHandlerTests method verifyAuthenticationMultipleAccounts.
@Test
public void verifyAuthenticationMultipleAccounts() {
val properties = new QueryEncodeJdbcAuthenticationProperties().setAlgorithmName(ALG_NAME).setSql(buildSql()).setPasswordFieldName(PASSWORD_FIELD_NAME).setSaltFieldName("salt").setDisabledFieldName("ops");
val q = new QueryAndEncodeDatabaseAuthenticationHandler(properties, null, PrincipalFactoryUtils.newPrincipalFactory(), dataSource);
assertThrows(FailedLoginException.class, () -> q.authenticate(CoreAuthenticationTestUtils.getCredentialsWithDifferentUsernameAndPassword("user0", "password0")));
}
use of org.apereo.cas.configuration.model.support.jdbc.authn.QueryEncodeJdbcAuthenticationProperties in project cas by apereo.
the class QueryAndEncodeDatabaseAuthenticationHandlerTests method verifyAuthenticationFailsToFindUser.
@Test
public void verifyAuthenticationFailsToFindUser() {
val properties = new QueryEncodeJdbcAuthenticationProperties().setAlgorithmName(ALG_NAME).setSql(buildSql()).setPasswordFieldName(PASSWORD_FIELD_NAME).setSaltFieldName("salt").setDisabledFieldName("ops");
val q = new QueryAndEncodeDatabaseAuthenticationHandler(properties, null, PrincipalFactoryUtils.newPrincipalFactory(), dataSource);
assertThrows(AccountNotFoundException.class, () -> q.authenticate(CoreAuthenticationTestUtils.getCredentialsWithSameUsernameAndPassword()));
}
Aggregations