Search in sources :

Example 6 with RefreshScope

use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.

the class AzureAuthenticatorAuthenticationEventExecutionPlanConfiguration method azureAuthenticatorAuthenticationProvider.

@Bean
@RefreshScope
public MultifactorAuthenticationProvider azureAuthenticatorAuthenticationProvider() {
    final MultifactorAuthenticationProperties.Azure azure = casProperties.getAuthn().getMfa().getAzure();
    final AzureAuthenticatorMultifactorAuthenticationProvider p = new AzureAuthenticatorMultifactorAuthenticationProvider();
    p.setBypassEvaluator(azureBypassEvaluator());
    p.setGlobalFailureMode(casProperties.getAuthn().getMfa().getGlobalFailureMode());
    p.setOrder(azure.getRank());
    p.setId(azure.getId());
    return p;
}
Also used : AzureAuthenticatorMultifactorAuthenticationProvider(org.apereo.cas.adaptors.azure.AzureAuthenticatorMultifactorAuthenticationProvider) MultifactorAuthenticationProperties(org.apereo.cas.configuration.model.support.mfa.MultifactorAuthenticationProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 7 with RefreshScope

use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.

the class CasSupportActionsAcceptableUsagePolicyLdapConfiguration method acceptableUsagePolicyRepository.

@RefreshScope
@Bean
public AcceptableUsagePolicyRepository acceptableUsagePolicyRepository() {
    final AcceptableUsagePolicyProperties.Ldap ldap = casProperties.getAcceptableUsagePolicy().getLdap();
    final ConnectionFactory connectionFactory = Beans.newLdaptivePooledConnectionFactory(ldap);
    final LdapAcceptableUsagePolicyRepository r = new LdapAcceptableUsagePolicyRepository(ticketRegistrySupport, connectionFactory, ldap.getUserFilter(), ldap.getBaseDn());
    r.setAupAttributeName(casProperties.getAcceptableUsagePolicy().getAupAttributeName());
    return r;
}
Also used : ConnectionFactory(org.ldaptive.ConnectionFactory) LdapAcceptableUsagePolicyRepository(org.apereo.cas.web.flow.LdapAcceptableUsagePolicyRepository) AcceptableUsagePolicyProperties(org.apereo.cas.configuration.model.support.aup.AcceptableUsagePolicyProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Example 8 with RefreshScope

use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.

the class DuoSecurityAuthenticationEventExecutionPlanConfiguration method duoMultifactorAuthenticationProvider.

@Bean
@RefreshScope
public VariegatedMultifactorAuthenticationProvider duoMultifactorAuthenticationProvider() {
    final DefaultVariegatedMultifactorAuthenticationProvider provider = new DefaultVariegatedMultifactorAuthenticationProvider();
    casProperties.getAuthn().getMfa().getDuo().stream().filter(duo -> StringUtils.isNotBlank(duo.getDuoApiHost()) && StringUtils.isNotBlank(duo.getDuoIntegrationKey()) && StringUtils.isNotBlank(duo.getDuoSecretKey()) && StringUtils.isNotBlank(duo.getDuoApplicationKey())).forEach(duo -> {
        final BasicDuoAuthenticationService s = new BasicDuoAuthenticationService(duo, httpClient);
        final DefaultDuoMultifactorAuthenticationProvider pWeb = new DefaultDuoMultifactorAuthenticationProvider(s);
        pWeb.setGlobalFailureMode(casProperties.getAuthn().getMfa().getGlobalFailureMode());
        pWeb.setBypassEvaluator(new DefaultMultifactorAuthenticationProviderBypass(duo.getBypass()));
        pWeb.setOrder(duo.getRank());
        pWeb.setId(duo.getId());
        provider.addProvider(pWeb);
    });
    if (provider.getProviders().isEmpty()) {
        throw new IllegalArgumentException("At least one Duo instance must be defined");
    }
    return provider;
}
Also used : PrepareDuoWebLoginFormAction(org.apereo.cas.adaptors.duo.web.flow.action.PrepareDuoWebLoginFormAction) CasConfigurationProperties(org.apereo.cas.configuration.CasConfigurationProperties) DefaultVariegatedMultifactorAuthenticationProvider(org.apereo.cas.services.DefaultVariegatedMultifactorAuthenticationProvider) AuthenticationMetaDataPopulator(org.apereo.cas.authentication.AuthenticationMetaDataPopulator) Ordered(org.springframework.core.Ordered) HttpClient(org.apereo.cas.util.http.HttpClient) DuoMultifactorWebflowConfigurer(org.apereo.cas.adaptors.duo.web.flow.config.DuoMultifactorWebflowConfigurer) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) DefaultDuoMultifactorAuthenticationProvider(org.apereo.cas.adaptors.duo.authn.DefaultDuoMultifactorAuthenticationProvider) FlowBuilderServices(org.springframework.webflow.engine.builder.support.FlowBuilderServices) StringUtils(org.apache.commons.lang3.StringUtils) AuthenticationEventExecutionPlan(org.apereo.cas.authentication.AuthenticationEventExecutionPlan) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) AuthenticationHandler(org.apereo.cas.authentication.AuthenticationHandler) PrincipalFactory(org.apereo.cas.authentication.principal.PrincipalFactory) MultifactorAuthenticationProperties(org.apereo.cas.configuration.model.support.mfa.MultifactorAuthenticationProperties) BeanCreationException(org.springframework.beans.factory.BeanCreationException) EnableConfigurationProperties(org.springframework.boot.context.properties.EnableConfigurationProperties) BasicDuoAuthenticationService(org.apereo.cas.adaptors.duo.authn.BasicDuoAuthenticationService) Qualifier(org.springframework.beans.factory.annotation.Qualifier) DuoAuthenticationHandler(org.apereo.cas.adaptors.duo.authn.DuoAuthenticationHandler) VariegatedMultifactorAuthenticationProvider(org.apereo.cas.services.VariegatedMultifactorAuthenticationProvider) ServicesManager(org.apereo.cas.services.ServicesManager) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Order(org.springframework.core.annotation.Order) AuthenticationContextAttributeMetaDataPopulator(org.apereo.cas.authentication.metadata.AuthenticationContextAttributeMetaDataPopulator) Logger(org.slf4j.Logger) FlowDefinitionRegistry(org.springframework.webflow.definition.registry.FlowDefinitionRegistry) AutoConfigureOrder(org.springframework.boot.autoconfigure.AutoConfigureOrder) Action(org.springframework.webflow.execution.Action) AuthenticationEventExecutionPlanConfigurer(org.apereo.cas.config.support.authentication.AuthenticationEventExecutionPlanConfigurer) DefaultMultifactorAuthenticationProviderBypass(org.apereo.cas.services.DefaultMultifactorAuthenticationProviderBypass) Configuration(org.springframework.context.annotation.Configuration) List(java.util.List) CasWebflowConfigurer(org.apereo.cas.web.flow.CasWebflowConfigurer) Bean(org.springframework.context.annotation.Bean) DefaultPrincipalFactory(org.apereo.cas.authentication.principal.DefaultPrincipalFactory) BasicDuoAuthenticationService(org.apereo.cas.adaptors.duo.authn.BasicDuoAuthenticationService) DefaultMultifactorAuthenticationProviderBypass(org.apereo.cas.services.DefaultMultifactorAuthenticationProviderBypass) DefaultDuoMultifactorAuthenticationProvider(org.apereo.cas.adaptors.duo.authn.DefaultDuoMultifactorAuthenticationProvider) DefaultVariegatedMultifactorAuthenticationProvider(org.apereo.cas.services.DefaultVariegatedMultifactorAuthenticationProvider) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 9 with RefreshScope

use of org.springframework.cloud.context.config.annotation.RefreshScope 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)

Example 10 with RefreshScope

use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.

the class GoogleAuthenticatorAuthenticationEventExecutionPlanConfiguration method googleAuthenticatorAuthenticationProvider.

@Bean
@RefreshScope
public MultifactorAuthenticationProvider googleAuthenticatorAuthenticationProvider() {
    final MultifactorAuthenticationProperties.GAuth gauth = casProperties.getAuthn().getMfa().getGauth();
    final GoogleAuthenticatorMultifactorAuthenticationProvider p = new GoogleAuthenticatorMultifactorAuthenticationProvider();
    p.setBypassEvaluator(googleBypassEvaluator());
    p.setGlobalFailureMode(casProperties.getAuthn().getMfa().getGlobalFailureMode());
    p.setOrder(gauth.getRank());
    p.setId(gauth.getId());
    return p;
}
Also used : GoogleAuthenticatorMultifactorAuthenticationProvider(org.apereo.cas.adaptors.gauth.GoogleAuthenticatorMultifactorAuthenticationProvider) MultifactorAuthenticationProperties(org.apereo.cas.configuration.model.support.mfa.MultifactorAuthenticationProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)97 Bean (org.springframework.context.annotation.Bean)97 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)68 STSPropertiesMBean (org.apache.cxf.sts.STSPropertiesMBean)11 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)11 ArrayList (java.util.ArrayList)10 Autowired (org.springframework.beans.factory.annotation.Autowired)6 CipherBean (org.cryptacular.bean.CipherBean)5 MultifactorAuthenticationProperties (org.apereo.cas.configuration.model.support.mfa.MultifactorAuthenticationProperties)4 SpnegoProperties (org.apereo.cas.configuration.model.support.spnego.SpnegoProperties)4 WsFederationProperties (org.apereo.cas.configuration.model.support.wsfed.WsFederationProperties)4 X509Properties (org.apereo.cas.configuration.model.support.x509.X509Properties)4 IPersonAttributeDao (org.apereo.services.persondir.IPersonAttributeDao)4 HashMap (java.util.HashMap)3 List (java.util.List)3 Properties (java.util.Properties)3 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)3 ConnectionFactory (org.ldaptive.ConnectionFactory)3 EnableConfigurationProperties (org.springframework.boot.context.properties.EnableConfigurationProperties)3 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)3