Search in sources :

Example 1 with DuoAuthenticationHandler

use of org.apereo.cas.adaptors.duo.authn.DuoAuthenticationHandler in project cas by apereo.

the class DuoSecurityAuthenticationEventExecutionPlanConfiguration method duoAuthenticationHandler.

@RefreshScope
@Bean
public AuthenticationHandler duoAuthenticationHandler() {
    final DuoAuthenticationHandler h;
    final List<MultifactorAuthenticationProperties.Duo> duos = casProperties.getAuthn().getMfa().getDuo();
    if (!duos.isEmpty()) {
        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);
        }
        h = new DuoAuthenticationHandler(name, servicesManager, duoPrincipalFactory(), duoMultifactorAuthenticationProvider());
    } else {
        h = new DuoAuthenticationHandler("", servicesManager, duoPrincipalFactory(), duoMultifactorAuthenticationProvider());
        throw new BeanCreationException("No configuration/settings could be found for Duo Security. Review settings and ensure the correct syntax is used");
    }
    return h;
}
Also used : BeanCreationException(org.springframework.beans.factory.BeanCreationException) 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 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