Search in sources :

Example 6 with DefaultMultifactorAuthenticationContextValidator

use of org.apereo.cas.authentication.DefaultMultifactorAuthenticationContextValidator in project cas by apereo.

the class DefaultMultifactorAuthenticationContextValidatorTests method verifyContextFailsValidationWithNoProviders.

@Test
public void verifyContextFailsValidationWithNoProviders() {
    val applicationContext = new StaticApplicationContext();
    applicationContext.refresh();
    val v = new DefaultMultifactorAuthenticationContextValidator("authn_method", "trusted_authn", applicationContext);
    val result = v.validate(MultifactorAuthenticationTestUtils.getAuthentication("casuser"), "invalid-context", Optional.of(MultifactorAuthenticationTestUtils.getRegisteredService()));
    assertFalse(result.isSuccess());
}
Also used : lombok.val(lombok.val) DefaultMultifactorAuthenticationContextValidator(org.apereo.cas.authentication.DefaultMultifactorAuthenticationContextValidator) StaticApplicationContext(org.springframework.context.support.StaticApplicationContext) Test(org.junit.jupiter.api.Test)

Example 7 with DefaultMultifactorAuthenticationContextValidator

use of org.apereo.cas.authentication.DefaultMultifactorAuthenticationContextValidator in project cas by apereo.

the class DefaultMultifactorAuthenticationContextValidatorTests method verifyContextFailsValidationWithMissingProvider.

@Test
public void verifyContextFailsValidationWithMissingProvider() {
    val applicationContext = getStaticApplicationContext();
    val v = new DefaultMultifactorAuthenticationContextValidator("authn_method", "trusted_authn", applicationContext);
    val result = v.validate(MultifactorAuthenticationTestUtils.getAuthentication("casuser"), "invalid-context", Optional.of(MultifactorAuthenticationTestUtils.getRegisteredService()));
    assertFalse(result.isSuccess());
}
Also used : lombok.val(lombok.val) DefaultMultifactorAuthenticationContextValidator(org.apereo.cas.authentication.DefaultMultifactorAuthenticationContextValidator) Test(org.junit.jupiter.api.Test)

Aggregations

lombok.val (lombok.val)7 DefaultMultifactorAuthenticationContextValidator (org.apereo.cas.authentication.DefaultMultifactorAuthenticationContextValidator)7 Test (org.junit.jupiter.api.Test)6 StaticApplicationContext (org.springframework.context.support.StaticApplicationContext)2 DefaultChainingMultifactorAuthenticationProvider (org.apereo.cas.authentication.DefaultChainingMultifactorAuthenticationProvider)1 DefaultMultifactorAuthenticationFailureModeEvaluator (org.apereo.cas.authentication.DefaultMultifactorAuthenticationFailureModeEvaluator)1 DefaultRequestedAuthenticationContextValidator (org.apereo.cas.authentication.DefaultRequestedAuthenticationContextValidator)1 Service (org.apereo.cas.authentication.principal.Service)1 WebApplicationService (org.apereo.cas.authentication.principal.WebApplicationService)1 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)1 RegisteredService (org.apereo.cas.services.RegisteredService)1