use of org.apereo.cas.authentication.DefaultAuthenticationTransaction in project cas by apereo.
the class SuccessfulHandlerMetaDataPopulatorTests method verifyOperation.
@Test
public void verifyOperation() {
val input = new SuccessfulHandlerMetaDataPopulator();
val transaction = new DefaultAuthenticationTransaction(CoreAuthenticationTestUtils.getWebApplicationService(), List.of(CoreAuthenticationTestUtils.getCredentialsWithSameUsernameAndPassword("cas")));
val builder = new DefaultAuthenticationBuilder();
input.populateAttributes(builder, transaction);
assertFalse(builder.hasAttribute(AuthenticationHandler.SUCCESSFUL_AUTHENTICATION_HANDLERS));
assertTrue(builder.getAttributes().get(AuthenticationHandler.SUCCESSFUL_AUTHENTICATION_HANDLERS).isEmpty());
}
use of org.apereo.cas.authentication.DefaultAuthenticationTransaction in project cas by apereo.
the class CasAuthenticationEventListenerTests method verifyCasAuthenticationPolicyFailureEvent.
@Test
public void verifyCasAuthenticationPolicyFailureEvent() {
val event = new CasAuthenticationPolicyFailureEvent(this, CollectionUtils.wrap("error", new FailedLoginException()), new DefaultAuthenticationTransaction(CoreAuthenticationTestUtils.getService(), CollectionUtils.wrap(CoreAuthenticationTestUtils.getCredentialsWithSameUsernameAndPassword())), CoreAuthenticationTestUtils.getAuthentication());
applicationContext.publishEvent(event);
assertFalse(casEventRepository.load().findAny().isEmpty());
}
Aggregations