Search in sources :

Example 1 with DefaultRequestedAuthenticationContextValidator

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);
}
Also used : lombok.val(lombok.val) DefaultMultifactorAuthenticationContextValidator(org.apereo.cas.authentication.DefaultMultifactorAuthenticationContextValidator) DefaultRequestedAuthenticationContextValidator(org.apereo.cas.authentication.DefaultRequestedAuthenticationContextValidator) WebApplicationService(org.apereo.cas.authentication.principal.WebApplicationService) RegisteredService(org.apereo.cas.services.RegisteredService) Service(org.apereo.cas.authentication.principal.Service)

Aggregations

lombok.val (lombok.val)1 DefaultMultifactorAuthenticationContextValidator (org.apereo.cas.authentication.DefaultMultifactorAuthenticationContextValidator)1 DefaultRequestedAuthenticationContextValidator (org.apereo.cas.authentication.DefaultRequestedAuthenticationContextValidator)1 Service (org.apereo.cas.authentication.principal.Service)1 WebApplicationService (org.apereo.cas.authentication.principal.WebApplicationService)1 RegisteredService (org.apereo.cas.services.RegisteredService)1