use of org.springframework.security.authentication.DisabledException in project midpoint by Evolveum.
the class TestAbstractAuthenticationEvaluator method loginJackGoodPasswordExpectDenied.
private void loginJackGoodPasswordExpectDenied(final String TEST_NAME, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
display("now", clock.currentTimeXMLGregorianCalendar());
ConnectionEnvironment connEnv = createConnectionEnvironment();
XMLGregorianCalendar startTs = clock.currentTimeXMLGregorianCalendar();
// WHEN
TestUtil.displayWhen(TEST_NAME);
try {
getAuthenticationEvaluator().authenticate(connEnv, getAuthenticationContext(USER_JACK_USERNAME, getGoodPasswordJack()));
AssertJUnit.fail("Unexpected success");
} catch (DisabledException e) {
// This is expected
// THEN
TestUtil.displayThen(TEST_NAME);
display("expected exception", e);
// this is important. The exception should give no indication whether the password is
// good or bad
assertDisabledException(e, USER_JACK_USERNAME);
}
PrismObject<UserType> userAfter = getUser(USER_JACK_OID);
display("user after", userAfter);
assertFailedLogins(userAfter, 0);
}
Aggregations