use of org.junit.jupiter.api.Order in project cas by apereo.
the class GroovyScriptMultifactorAuthenticationTriggerTests method verifyScriptDoesNotExist.
@Test
@Order(2)
public void verifyScriptDoesNotExist() {
val props = new CasConfigurationProperties();
var trigger = new GroovyScriptMultifactorAuthenticationTrigger(props, applicationContext);
var result = trigger.isActivated(authentication, registeredService, this.httpRequest, this.httpResponse, mock(Service.class));
assertFalse(result.isPresent());
props.getAuthn().getMfa().getGroovyScript().setLocation(new ClassPathResource("DoesNotExist.groovy"));
trigger = new GroovyScriptMultifactorAuthenticationTrigger(props, applicationContext);
result = trigger.isActivated(authentication, registeredService, this.httpRequest, this.httpResponse, mock(Service.class));
assertFalse(result.isPresent());
}
use of org.junit.jupiter.api.Order in project cas by apereo.
the class GroovyScriptMultifactorAuthenticationTriggerTests method verifyNoProvider.
@Test
@Order(0)
@Tag("DisableProviderRegistration")
public void verifyNoProvider() {
val props = new CasConfigurationProperties();
props.getAuthn().getMfa().getGroovyScript().setLocation(new ClassPathResource("GroovyMfaTrigger.groovy"));
val trigger = new GroovyScriptMultifactorAuthenticationTrigger(props, applicationContext);
assertThrows(AuthenticationException.class, () -> trigger.isActivated(authentication, registeredService, this.httpRequest, this.httpResponse, mock(Service.class)));
}
use of org.junit.jupiter.api.Order in project cas by apereo.
the class GroovyScriptMultifactorAuthenticationTriggerTests method verifyOperationByProvider.
@Test
@Order(1)
public void verifyOperationByProvider() {
val props = new CasConfigurationProperties();
props.getAuthn().getMfa().getGroovyScript().setLocation(new ClassPathResource("GroovyMfaTrigger.groovy"));
val trigger = new GroovyScriptMultifactorAuthenticationTrigger(props, applicationContext);
var result = trigger.isActivated(authentication, registeredService, this.httpRequest, this.httpResponse, mock(Service.class));
assertTrue(result.isPresent());
val service = MultifactorAuthenticationTestUtils.getService("nomfa");
result = trigger.isActivated(authentication, registeredService, this.httpRequest, this.httpResponse, service);
assertFalse(result.isPresent());
}
use of org.junit.jupiter.api.Order in project cas by apereo.
the class GlobalMultifactorAuthenticationTriggerTests method verifyOperationByUnresolvedProvider.
@Test
@Order(4)
public void verifyOperationByUnresolvedProvider() {
val props = new CasConfigurationProperties();
props.getAuthn().getMfa().getTriggers().getGlobal().setGlobalProviderId("does-not-exist");
val trigger = new GlobalMultifactorAuthenticationTrigger(props, applicationContext, (providers, service, principal) -> providers.iterator().next());
assertThrows(AuthenticationException.class, () -> trigger.isActivated(authentication, registeredService, this.httpRequest, this.httpResponse, mock(Service.class)));
}
use of org.junit.jupiter.api.Order in project cas by apereo.
the class GlobalMultifactorAuthenticationTriggerTests method verifyOperationByProvider.
@Test
@Order(1)
public void verifyOperationByProvider() {
val props = new CasConfigurationProperties();
props.getAuthn().getMfa().getTriggers().getGlobal().setGlobalProviderId(TestMultifactorAuthenticationProvider.ID);
val trigger = new GlobalMultifactorAuthenticationTrigger(props, applicationContext, (providers, service, principal) -> providers.iterator().next());
val result = trigger.isActivated(authentication, registeredService, this.httpRequest, this.httpResponse, mock(Service.class));
assertTrue(result.isPresent());
}
Aggregations