use of org.apereo.cas.authentication.policy.RegisteredServiceAuthenticationPolicyResolver 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.policy.RegisteredServiceAuthenticationPolicyResolver 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.policy.RegisteredServiceAuthenticationPolicyResolver 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);
}
use of org.apereo.cas.authentication.policy.RegisteredServiceAuthenticationPolicyResolver in project cas by apereo.
the class RegisteredServiceAuthenticationPolicyResolverTests method checkGroovyPolicy.
@Test
public void checkGroovyPolicy() {
val resolver = new RegisteredServiceAuthenticationPolicyResolver(this.servicesManager, new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()));
val transaction = new DefaultAuthenticationTransactionFactory().newTransaction(RegisteredServiceTestUtils.getService("serviceid5"), RegisteredServiceTestUtils.getCredentialsWithSameUsernameAndPassword("casuser"));
val policies = resolver.resolve(transaction);
assertEquals(1, policies.size());
assertTrue(policies.iterator().next() instanceof GroovyScriptAuthenticationPolicy);
}
use of org.apereo.cas.authentication.policy.RegisteredServiceAuthenticationPolicyResolver in project cas by apereo.
the class RegisteredServiceAuthenticationPolicyResolverTests method checkAllPolicy.
@Test
public void checkAllPolicy() {
val resolver = new RegisteredServiceAuthenticationPolicyResolver(this.servicesManager, new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()));
val transaction = new DefaultAuthenticationTransactionFactory().newTransaction(RegisteredServiceTestUtils.getService("serviceid3"), RegisteredServiceTestUtils.getCredentialsWithSameUsernameAndPassword("casuser"));
val policies = resolver.resolve(transaction);
assertEquals(1, policies.size());
assertTrue(policies.iterator().next() instanceof AllAuthenticationHandlersSucceededAuthenticationPolicy);
}
Aggregations