use of org.apereo.cas.authentication.DefaultAuthenticationTransactionFactory in project cas by apereo.
the class RegisteredServiceAuthenticationHandlerResolverTests method checkAuthenticationHandlerResolution.
@Test
public void checkAuthenticationHandlerResolution() {
val resolver = new DefaultAuthenticationHandlerResolver();
val transaction = new DefaultAuthenticationTransactionFactory().newTransaction(RegisteredServiceTestUtils.getService("serviceid2"), RegisteredServiceTestUtils.getCredentialsWithSameUsernameAndPassword("casuser"));
val handlers = resolver.resolve(this.authenticationHandlers, transaction);
assertEquals(handlers.size(), this.authenticationHandlers.size());
}
use of org.apereo.cas.authentication.DefaultAuthenticationTransactionFactory in project cas by apereo.
the class RegisteredServiceAuthenticationHandlerResolverTests method checkAuthenticationHandlerExcluded.
@Test
public void checkAuthenticationHandlerExcluded() {
val resolver = new RegisteredServiceAuthenticationHandlerResolver(this.defaultServicesManager, new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()));
val transaction = new DefaultAuthenticationTransactionFactory().newTransaction(RegisteredServiceTestUtils.getService("serviceid3"), RegisteredServiceTestUtils.getCredentialsWithSameUsernameAndPassword("casuser"));
val handlers = resolver.resolve(this.authenticationHandlers, transaction);
assertEquals(1, handlers.size());
assertEquals("handler2", handlers.iterator().next().getName());
}
use of org.apereo.cas.authentication.DefaultAuthenticationTransactionFactory in project cas by apereo.
the class RegisteredServiceAuthenticationPolicyResolverTests method checkDefaultPolicy.
@Test
public void checkDefaultPolicy() {
val resolver = new RegisteredServiceAuthenticationPolicyResolver(this.servicesManager, new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()));
val transaction = new DefaultAuthenticationTransactionFactory().newTransaction(RegisteredServiceTestUtils.getService("serviceid2"), RegisteredServiceTestUtils.getCredentialsWithSameUsernameAndPassword("casuser"));
assertTrue(resolver.supports(transaction));
val policies = resolver.resolve(transaction);
assertFalse(policies.isEmpty());
assertTrue(policies.iterator().next() instanceof AtLeastOneCredentialValidatedAuthenticationPolicy);
}
use of org.apereo.cas.authentication.DefaultAuthenticationTransactionFactory in project cas by apereo.
the class RegisteredServiceAuthenticationPolicyResolverTests method checkDisabledPolicy.
@Test
public void checkDisabledPolicy() {
val resolver = new RegisteredServiceAuthenticationPolicyResolver(this.servicesManager, new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()));
val transaction = new DefaultAuthenticationTransactionFactory().newTransaction(RegisteredServiceTestUtils.getService("not-found-service"), RegisteredServiceTestUtils.getCredentialsWithSameUsernameAndPassword("casuser"));
assertThrows(UnauthorizedSsoServiceException.class, () -> resolver.supports(transaction));
}
use of org.apereo.cas.authentication.DefaultAuthenticationTransactionFactory in project cas by apereo.
the class RegisteredServiceAuthenticationPolicyResolverTests method checkAnyPolicy.
@Test
public void checkAnyPolicy() {
val resolver = new RegisteredServiceAuthenticationPolicyResolver(this.servicesManager, new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()));
val transaction = new DefaultAuthenticationTransactionFactory().newTransaction(RegisteredServiceTestUtils.getService("serviceid1"), RegisteredServiceTestUtils.getCredentialsWithSameUsernameAndPassword("casuser"));
val policies = resolver.resolve(transaction);
assertEquals(1, policies.size());
assertTrue(policies.iterator().next() instanceof AtLeastOneCredentialValidatedAuthenticationPolicy);
}
Aggregations