Search in sources :

Example 1 with RestMultifactorAuthenticationProviderBypassEvaluator

use of org.apereo.cas.authentication.bypass.RestMultifactorAuthenticationProviderBypassEvaluator in project cas by apereo.

the class GoogleAuthenticatorAuthenticationMultifactorProviderBypassConfiguration method googleAuthenticatorRestMultifactorAuthenticationProviderBypass.

@ConditionalOnMissingBean(name = "googleAuthenticatorRestMultifactorAuthenticationProviderBypass")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public MultifactorAuthenticationProviderBypassEvaluator googleAuthenticatorRestMultifactorAuthenticationProviderBypass(final CasConfigurationProperties casProperties) {
    val gauth = casProperties.getAuthn().getMfa().getGauth();
    val props = gauth.getBypass();
    return new RestMultifactorAuthenticationProviderBypassEvaluator(props, gauth.getId());
}
Also used : lombok.val(lombok.val) RestMultifactorAuthenticationProviderBypassEvaluator(org.apereo.cas.authentication.bypass.RestMultifactorAuthenticationProviderBypassEvaluator) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with RestMultifactorAuthenticationProviderBypassEvaluator

use of org.apereo.cas.authentication.bypass.RestMultifactorAuthenticationProviderBypassEvaluator in project cas by apereo.

the class U2FAuthenticationMultifactorProviderBypassConfiguration method u2fRestMultifactorAuthenticationProviderBypass.

@ConditionalOnMissingBean(name = "u2fRestMultifactorAuthenticationProviderBypass")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public MultifactorAuthenticationProviderBypassEvaluator u2fRestMultifactorAuthenticationProviderBypass(final CasConfigurationProperties casProperties) {
    val u2f = casProperties.getAuthn().getMfa().getU2f();
    val props = u2f.getBypass();
    return new RestMultifactorAuthenticationProviderBypassEvaluator(props, u2f.getId());
}
Also used : lombok.val(lombok.val) RestMultifactorAuthenticationProviderBypassEvaluator(org.apereo.cas.authentication.bypass.RestMultifactorAuthenticationProviderBypassEvaluator) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 3 with RestMultifactorAuthenticationProviderBypassEvaluator

use of org.apereo.cas.authentication.bypass.RestMultifactorAuthenticationProviderBypassEvaluator in project cas by apereo.

the class YubiKeyAuthenticationMultifactorProviderBypassConfiguration method yubikeyRestMultifactorAuthenticationProviderBypass.

@ConditionalOnMissingBean(name = "yubikeyRestMultifactorAuthenticationProviderBypass")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public MultifactorAuthenticationProviderBypassEvaluator yubikeyRestMultifactorAuthenticationProviderBypass(final CasConfigurationProperties casProperties) {
    val yubikey = casProperties.getAuthn().getMfa().getYubikey();
    val props = yubikey.getBypass();
    return new RestMultifactorAuthenticationProviderBypassEvaluator(props, yubikey.getId());
}
Also used : lombok.val(lombok.val) RestMultifactorAuthenticationProviderBypassEvaluator(org.apereo.cas.authentication.bypass.RestMultifactorAuthenticationProviderBypassEvaluator) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 4 with RestMultifactorAuthenticationProviderBypassEvaluator

use of org.apereo.cas.authentication.bypass.RestMultifactorAuthenticationProviderBypassEvaluator in project cas by apereo.

the class RestMultifactorAuthenticationProviderBypassEvaluatorTests method verifyOperationFailsWithNoProvider.

@Test
public void verifyOperationFailsWithNoProvider() {
    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(), null, new MockHttpServletRequest());
        assertTrue(res);
    }
}
Also used : lombok.val(lombok.val) MultifactorAuthenticationProviderBypassProperties(org.apereo.cas.configuration.model.support.mfa.MultifactorAuthenticationProviderBypassProperties) TestMultifactorAuthenticationProvider(org.apereo.cas.authentication.mfa.TestMultifactorAuthenticationProvider) RestMultifactorAuthenticationProviderBypassEvaluator(org.apereo.cas.authentication.bypass.RestMultifactorAuthenticationProviderBypassEvaluator) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) MockWebServer(org.apereo.cas.util.MockWebServer) ByteArrayResource(org.springframework.core.io.ByteArrayResource) Test(org.junit.jupiter.api.Test)

Example 5 with RestMultifactorAuthenticationProviderBypassEvaluator

use of org.apereo.cas.authentication.bypass.RestMultifactorAuthenticationProviderBypassEvaluator in project cas by apereo.

the class InweboAuthenticationMultifactorProviderBypassConfiguration method inweboRestMultifactorAuthenticationProviderBypass.

@ConditionalOnMissingBean(name = "inweboRestMultifactorAuthenticationProviderBypass")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public MultifactorAuthenticationProviderBypassEvaluator inweboRestMultifactorAuthenticationProviderBypass(final CasConfigurationProperties casProperties) {
    val inwebo = casProperties.getAuthn().getMfa().getInwebo();
    val props = inwebo.getBypass();
    return new RestMultifactorAuthenticationProviderBypassEvaluator(props, inwebo.getId());
}
Also used : lombok.val(lombok.val) RestMultifactorAuthenticationProviderBypassEvaluator(org.apereo.cas.authentication.bypass.RestMultifactorAuthenticationProviderBypassEvaluator) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

lombok.val (lombok.val)13 RestMultifactorAuthenticationProviderBypassEvaluator (org.apereo.cas.authentication.bypass.RestMultifactorAuthenticationProviderBypassEvaluator)13 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)11 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)11 Bean (org.springframework.context.annotation.Bean)11 TestMultifactorAuthenticationProvider (org.apereo.cas.authentication.mfa.TestMultifactorAuthenticationProvider)2 MultifactorAuthenticationProviderBypassProperties (org.apereo.cas.configuration.model.support.mfa.MultifactorAuthenticationProviderBypassProperties)2 MockWebServer (org.apereo.cas.util.MockWebServer)2 Test (org.junit.jupiter.api.Test)2 ByteArrayResource (org.springframework.core.io.ByteArrayResource)2 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)2 StringUtils (org.apache.commons.lang3.StringUtils)1 DuoSecurityAuthenticationService (org.apereo.cas.adaptors.duo.authn.DuoSecurityAuthenticationService)1 AuthenticationMultifactorAuthenticationProviderBypassEvaluator (org.apereo.cas.authentication.bypass.AuthenticationMultifactorAuthenticationProviderBypassEvaluator)1 ChainingMultifactorAuthenticationProviderBypassEvaluator (org.apereo.cas.authentication.bypass.ChainingMultifactorAuthenticationProviderBypassEvaluator)1 CredentialMultifactorAuthenticationProviderBypassEvaluator (org.apereo.cas.authentication.bypass.CredentialMultifactorAuthenticationProviderBypassEvaluator)1 DefaultChainingMultifactorAuthenticationBypassProvider (org.apereo.cas.authentication.bypass.DefaultChainingMultifactorAuthenticationBypassProvider)1 GroovyMultifactorAuthenticationProviderBypassEvaluator (org.apereo.cas.authentication.bypass.GroovyMultifactorAuthenticationProviderBypassEvaluator)1 HttpRequestMultifactorAuthenticationProviderBypassEvaluator (org.apereo.cas.authentication.bypass.HttpRequestMultifactorAuthenticationProviderBypassEvaluator)1 MultifactorAuthenticationProviderBypassEvaluator (org.apereo.cas.authentication.bypass.MultifactorAuthenticationProviderBypassEvaluator)1