Search in sources :

Example 1 with DuoSecurityMultifactorProperties

use of org.apereo.cas.configuration.model.support.mfa.DuoSecurityMultifactorProperties in project cas by apereo.

the class DuoSecurityAuthenticationEventExecutionPlanConfiguration method duoAuthenticationHandler.

@RefreshScope
@Bean
public AuthenticationHandler duoAuthenticationHandler() {
    final List<DuoSecurityMultifactorProperties> duos = casProperties.getAuthn().getMfa().getDuo();
    if (duos.isEmpty()) {
        throw new BeanCreationException("No configuration/settings could be found for Duo Security. Review settings and ensure the correct syntax is used");
    }
    final String name = duos.get(0).getName();
    if (duos.size() > 1) {
        LOGGER.debug("Multiple Duo Security providers are available; Duo authentication handler is named after [{}]", name);
    }
    final DuoAuthenticationHandler h = new DuoAuthenticationHandler(name, servicesManager, duoPrincipalFactory(), duoMultifactorAuthenticationProvider());
    return h;
}
Also used : BeanCreationException(org.springframework.beans.factory.BeanCreationException) DuoSecurityMultifactorProperties(org.apereo.cas.configuration.model.support.mfa.DuoSecurityMultifactorProperties) DuoAuthenticationHandler(org.apereo.cas.adaptors.duo.authn.DuoAuthenticationHandler) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

DuoAuthenticationHandler (org.apereo.cas.adaptors.duo.authn.DuoAuthenticationHandler)1 DuoSecurityMultifactorProperties (org.apereo.cas.configuration.model.support.mfa.DuoSecurityMultifactorProperties)1 BeanCreationException (org.springframework.beans.factory.BeanCreationException)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1 Bean (org.springframework.context.annotation.Bean)1