use of org.apereo.cas.authentication.bypass.RestMultifactorAuthenticationProviderBypassEvaluator in project cas by apereo.
the class CasSimpleMultifactorAuthenticationMultifactorProviderBypassConfiguration method casSimpleMultifactorRestMultifactorAuthenticationProviderBypass.
@ConditionalOnMissingBean(name = "casSimpleMultifactorRestMultifactorAuthenticationProviderBypass")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public MultifactorAuthenticationProviderBypassEvaluator casSimpleMultifactorRestMultifactorAuthenticationProviderBypass(final CasConfigurationProperties casProperties) {
val simple = casProperties.getAuthn().getMfa().getSimple();
val props = simple.getBypass();
return new RestMultifactorAuthenticationProviderBypassEvaluator(props, simple.getId());
}
use of org.apereo.cas.authentication.bypass.RestMultifactorAuthenticationProviderBypassEvaluator in project cas by apereo.
the class SwivelAuthenticationMultifactorProviderBypassConfiguration method swivelRestMultifactorAuthenticationProviderBypass.
@ConditionalOnMissingBean(name = "swivelRestMultifactorAuthenticationProviderBypass")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public MultifactorAuthenticationProviderBypassEvaluator swivelRestMultifactorAuthenticationProviderBypass(final CasConfigurationProperties casProperties) {
val swivel = casProperties.getAuthn().getMfa().getSwivel();
val props = swivel.getBypass();
return new RestMultifactorAuthenticationProviderBypassEvaluator(props, swivel.getId());
}
use of org.apereo.cas.authentication.bypass.RestMultifactorAuthenticationProviderBypassEvaluator in project cas by apereo.
the class RestMultifactorAuthenticationProviderBypassEvaluatorTests method verifyOperationShouldProceed.
@Test
public void verifyOperationShouldProceed() {
val applicationContext = new StaticApplicationContext();
applicationContext.refresh();
ApplicationContextProvider.holdApplicationContext(applicationContext);
ApplicationContextProvider.registerBeanIntoApplicationContext(applicationContext, MultifactorAuthenticationPrincipalResolver.identical(), UUID.randomUUID().toString());
try (val webServer = new MockWebServer(9316, new ByteArrayResource("Y".getBytes(StandardCharsets.UTF_8), "REST Output"), HttpStatus.ACCEPTED)) {
webServer.start();
val props = new MultifactorAuthenticationProviderBypassProperties();
props.getRest().setUrl("http://localhost:9316");
val provider = new TestMultifactorAuthenticationProvider();
val r = new RestMultifactorAuthenticationProviderBypassEvaluator(props, provider.getId());
val res = r.shouldMultifactorAuthenticationProviderExecute(MultifactorAuthenticationTestUtils.getAuthentication("casuser"), MultifactorAuthenticationTestUtils.getRegisteredService(), provider, new MockHttpServletRequest());
assertTrue(res);
}
}
Aggregations