use of org.apereo.cas.authentication.mfa.trigger.PrincipalAttributeMultifactorAuthenticationTrigger in project cas by apereo.
the class DefaultMultifactorAuthenticationProviderResolverTests method verifyMultipleProvidersWithPrincipalAttributes.
@Test
public void verifyMultipleProvidersWithPrincipalAttributes() {
val applicationContext = new StaticApplicationContext();
applicationContext.refresh();
val casProperties = new CasConfigurationProperties();
casProperties.getAuthn().getMfa().getTriggers().getPrincipal().setGlobalPrincipalAttributeNameTriggers("mfa-principal");
val resolver = new DefaultMultifactorAuthenticationProviderResolver(MultifactorAuthenticationPrincipalResolver.identical());
val trigger = new PrincipalAttributeMultifactorAuthenticationTrigger(casProperties, resolver, applicationContext);
assertProviderResolutionFromManyProviders(trigger, applicationContext, true);
assertThrows(UnsatisfiedAuthenticationContextTicketValidationException.class, () -> {
throw new UnsatisfiedAuthenticationContextTicketValidationException(MultifactorAuthenticationTestUtils.getService("id"));
});
}
use of org.apereo.cas.authentication.mfa.trigger.PrincipalAttributeMultifactorAuthenticationTrigger in project cas by apereo.
the class DefaultMultifactorAuthenticationProviderResolverTests method verifyInvalidPrincipalAttributes.
@Test
public void verifyInvalidPrincipalAttributes() {
val applicationContext = new StaticApplicationContext();
applicationContext.refresh();
val casProperties = new CasConfigurationProperties();
casProperties.getAuthn().getMfa().getTriggers().getPrincipal().setGlobalPrincipalAttributeNameTriggers("does-not-exist");
val resolver = new DefaultMultifactorAuthenticationProviderResolver(MultifactorAuthenticationPrincipalResolver.identical());
val trigger = new PrincipalAttributeMultifactorAuthenticationTrigger(casProperties, resolver, applicationContext);
assertProviderResolutionFromManyProviders(trigger, applicationContext, false);
}
Aggregations