use of org.apereo.cas.authentication.bypass.GroovyMultifactorAuthenticationProviderBypassEvaluator in project cas by apereo.
the class GroovyMultifactorAuthenticationProviderBypassEvaluatorTests method runGroovyBypassFor.
private static boolean runGroovyBypassFor(final Authentication authentication) {
val request = new MockHttpServletRequest();
val properties = new MultifactorAuthenticationProviderBypassProperties();
properties.getGroovy().setLocation(new ClassPathResource("GroovyBypass.groovy"));
val provider = new TestMultifactorAuthenticationProvider();
val groovy = new GroovyMultifactorAuthenticationProviderBypassEvaluator(properties, provider.getId());
val registeredService = mock(RegisteredService.class);
when(registeredService.getName()).thenReturn("Service");
when(registeredService.getServiceId()).thenReturn("http://app.org");
when(registeredService.getId()).thenReturn(1000L);
val applicationContext = new StaticApplicationContext();
applicationContext.refresh();
ApplicationContextProvider.holdApplicationContext(applicationContext);
ApplicationContextProvider.registerBeanIntoApplicationContext(applicationContext, MultifactorAuthenticationPrincipalResolver.identical(), UUID.randomUUID().toString());
return groovy.shouldMultifactorAuthenticationProviderExecute(authentication, registeredService, provider, request);
}
use of org.apereo.cas.authentication.bypass.GroovyMultifactorAuthenticationProviderBypassEvaluator in project cas by apereo.
the class InweboAuthenticationMultifactorProviderBypassConfiguration method inweboGroovyMultifactorAuthenticationProviderBypass.
@ConditionalOnMissingBean(name = "inweboGroovyMultifactorAuthenticationProviderBypass")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public MultifactorAuthenticationProviderBypassEvaluator inweboGroovyMultifactorAuthenticationProviderBypass(final CasConfigurationProperties casProperties) {
val inwebo = casProperties.getAuthn().getMfa().getInwebo();
val props = inwebo.getBypass();
return new GroovyMultifactorAuthenticationProviderBypassEvaluator(props, inwebo.getId());
}
use of org.apereo.cas.authentication.bypass.GroovyMultifactorAuthenticationProviderBypassEvaluator in project cas by apereo.
the class WebAuthnMultifactorProviderBypassConfiguration method webAuthnGroovyMultifactorAuthenticationProviderBypass.
@ConditionalOnMissingBean(name = "webAuthnGroovyMultifactorAuthenticationProviderBypass")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public MultifactorAuthenticationProviderBypassEvaluator webAuthnGroovyMultifactorAuthenticationProviderBypass(final CasConfigurationProperties casProperties) {
val webAuthn = casProperties.getAuthn().getMfa().getWebAuthn();
val props = webAuthn.getBypass();
return new GroovyMultifactorAuthenticationProviderBypassEvaluator(props, webAuthn.getId());
}
use of org.apereo.cas.authentication.bypass.GroovyMultifactorAuthenticationProviderBypassEvaluator in project cas by apereo.
the class DuoSecurityMultifactorProviderBypassConfiguration method duoSecurityGroovyMultifactorAuthenticationProviderBypass.
@ConditionalOnMissingBean(name = "duoSecurityGroovyMultifactorAuthenticationProviderBypass")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public MultifactorAuthenticationProviderBypassEvaluator duoSecurityGroovyMultifactorAuthenticationProviderBypass(final ConfigurableApplicationContext applicationContext, final CasConfigurationProperties casProperties) {
return BeanSupplier.of(MultifactorAuthenticationProviderBypassEvaluator.class).when(DuoSecurityAuthenticationService.CONDITION.given(applicationContext.getEnvironment())).supply(() -> {
val duoProps = casProperties.getAuthn().getMfa().getDuo();
val bypass = new DefaultChainingMultifactorAuthenticationBypassProvider();
duoProps.stream().filter(duo -> duo.getBypass().getGroovy().getLocation() != null).forEach(duo -> bypass.addMultifactorAuthenticationProviderBypassEvaluator(new GroovyMultifactorAuthenticationProviderBypassEvaluator(duo.getBypass(), duo.getId())));
if (bypass.isEmpty()) {
return NeverAllowMultifactorAuthenticationProviderBypassEvaluator.getInstance();
}
return bypass;
}).otherwiseProxy().get();
}
use of org.apereo.cas.authentication.bypass.GroovyMultifactorAuthenticationProviderBypassEvaluator in project cas by apereo.
the class AccepttoMultifactorAuthenticationMultifactorProviderBypassConfiguration method casAccepttoMultifactorGroovyMultifactorAuthenticationProviderBypass.
@ConditionalOnMissingBean(name = "casAccepttoMultifactorGroovyMultifactorAuthenticationProviderBypass")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public MultifactorAuthenticationProviderBypassEvaluator casAccepttoMultifactorGroovyMultifactorAuthenticationProviderBypass(final CasConfigurationProperties casProperties) {
val simple = casProperties.getAuthn().getMfa().getAcceptto();
val props = simple.getBypass();
return new GroovyMultifactorAuthenticationProviderBypassEvaluator(props, simple.getId());
}
Aggregations