use of org.apereo.cas.authentication.bypass.HttpRequestMultifactorAuthenticationProviderBypassEvaluator in project cas by apereo.
the class DefaultChainingMultifactorAuthenticationProviderTests method verifyOperation.
@Test
public void verifyOperation() {
val props = new MultifactorAuthenticationProviderBypassProperties();
props.setHttpRequestHeaders("headerbypass");
val provider = TestMultifactorAuthenticationProvider.registerProviderIntoApplicationContext(applicationContext);
provider.setBypassEvaluator(new HttpRequestMultifactorAuthenticationProviderBypassEvaluator(props, provider.getId()));
val casProperties = new CasConfigurationProperties();
casProperties.getAuthn().getMfa().getCore().setGlobalFailureMode(BaseMultifactorAuthenticationProviderProperties.MultifactorAuthenticationProviderFailureModes.OPEN);
val failureEvaluator = new DefaultMultifactorAuthenticationFailureModeEvaluator(casProperties);
val p = new DefaultChainingMultifactorAuthenticationProvider(failureEvaluator);
p.addMultifactorAuthenticationProviders(provider);
assertNotNull(p.getBypassEvaluator());
assertNotNull(p.getId());
assertNotNull(p.getFriendlyName());
assertEquals(BaseMultifactorAuthenticationProviderProperties.MultifactorAuthenticationProviderFailureModes.NONE, p.getFailureMode());
assertFalse(p.getMultifactorAuthenticationProviders().isEmpty());
val service = MultifactorAuthenticationTestUtils.getRegisteredService();
assertTrue(p.isAvailable(service));
assertTrue(p.matches(provider.getId()));
}
Aggregations