use of org.apereo.cas.authentication.DefaultRequestedAuthenticationContextValidator in project cas by apereo.
the class MultifactorAuthenticationTestUtils method mockRequestAuthnContextValidator.
public static RequestedAuthenticationContextValidator mockRequestAuthnContextValidator(final ServicesManager servicesManager, final Optional<MultifactorAuthenticationProvider> provider, final ConfigurableApplicationContext applicationContext, final String failureMode) {
val multifactorTrigger = mock(MultifactorAuthenticationTriggerSelectionStrategy.class);
val service = MultifactorAuthenticationTestUtils.getRegisteredService("https://www.github.com/apereo/cas", failureMode);
when(servicesManager.findServiceBy(any(Service.class))).thenReturn(service);
when(multifactorTrigger.resolve(any(), any(), any(), any(), any())).thenReturn(provider);
val multifactorContextValidator = new DefaultMultifactorAuthenticationContextValidator("authn_method", "trusted_authn", applicationContext);
return new DefaultRequestedAuthenticationContextValidator(servicesManager, multifactorTrigger, multifactorContextValidator);
}
Aggregations