Search in sources :

Example 16 with RefreshScope

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

the class ElectronicFenceConfiguration method authenticationRiskEvaluator.

@ConditionalOnMissingBean(name = "authenticationRiskEvaluator")
@Bean
@RefreshScope
public AuthenticationRiskEvaluator authenticationRiskEvaluator() {
    final RiskBasedAuthenticationProperties risk = casProperties.getAuthn().getAdaptive().getRisk();
    final Set<AuthenticationRequestRiskCalculator> calculators = new HashSet<>();
    if (risk.getIp().isEnabled()) {
        calculators.add(ipAddressAuthenticationRequestRiskCalculator());
    }
    if (risk.getAgent().isEnabled()) {
        calculators.add(userAgentAuthenticationRequestRiskCalculator());
    }
    if (risk.getDateTime().isEnabled()) {
        calculators.add(dateTimeAuthenticationRequestRiskCalculator());
    }
    if (risk.getGeoLocation().isEnabled()) {
        calculators.add(geoLocationAuthenticationRequestRiskCalculator());
    }
    if (calculators.isEmpty()) {
        LOGGER.warn("No risk calculators are defined to examine authentication requests");
    }
    return new DefaultAuthenticationRiskEvaluator(calculators);
}
Also used : RiskBasedAuthenticationProperties(org.apereo.cas.configuration.model.core.authentication.RiskBasedAuthenticationProperties) DefaultAuthenticationRiskEvaluator(org.apereo.cas.impl.engine.DefaultAuthenticationRiskEvaluator) UserAgentAuthenticationRequestRiskCalculator(org.apereo.cas.impl.calcs.UserAgentAuthenticationRequestRiskCalculator) IpAddressAuthenticationRequestRiskCalculator(org.apereo.cas.impl.calcs.IpAddressAuthenticationRequestRiskCalculator) DateTimeAuthenticationRequestRiskCalculator(org.apereo.cas.impl.calcs.DateTimeAuthenticationRequestRiskCalculator) GeoLocationAuthenticationRequestRiskCalculator(org.apereo.cas.impl.calcs.GeoLocationAuthenticationRequestRiskCalculator) AuthenticationRequestRiskCalculator(org.apereo.cas.api.AuthenticationRequestRiskCalculator) HashSet(java.util.HashSet) 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 17 with RefreshScope

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

the class ElectronicFenceConfiguration method blockAuthenticationContingencyPlan.

@ConditionalOnMissingBean(name = "blockAuthenticationContingencyPlan")
@Bean
@RefreshScope
public AuthenticationRiskContingencyPlan blockAuthenticationContingencyPlan() {
    final BlockAuthenticationContingencyPlan b = new BlockAuthenticationContingencyPlan();
    configureContingencyPlan(b);
    return b;
}
Also used : BlockAuthenticationContingencyPlan(org.apereo.cas.impl.plans.BlockAuthenticationContingencyPlan) 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 18 with RefreshScope

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

the class GrouperMultifactorAuthenticationConfiguration method grouperMultifactorAuthenticationWebflowEventResolver.

@Bean
@RefreshScope
public CasWebflowEventResolver grouperMultifactorAuthenticationWebflowEventResolver() {
    final AbstractCasWebflowEventResolver r;
    if (StringUtils.isNotBlank(casProperties.getAuthn().getMfa().getGrouperGroupField())) {
        r = new GrouperMultifactorAuthenticationPolicyEventResolver(authenticationSystemSupport, centralAuthenticationService, servicesManager, ticketRegistrySupport, warnCookieGenerator, authenticationRequestServiceSelectionStrategies, multifactorAuthenticationProviderSelector, casProperties);
        LOGGER.debug("Activating MFA event resolver based on Grouper groups...");
    } else {
        r = new NoOpCasWebflowEventResolver(authenticationSystemSupport, centralAuthenticationService, servicesManager, ticketRegistrySupport, warnCookieGenerator, authenticationRequestServiceSelectionStrategies, multifactorAuthenticationProviderSelector);
    }
    return r;
}
Also used : AbstractCasWebflowEventResolver(org.apereo.cas.web.flow.resolver.impl.AbstractCasWebflowEventResolver) NoOpCasWebflowEventResolver(org.apereo.cas.web.flow.resolver.impl.NoOpCasWebflowEventResolver) GrouperMultifactorAuthenticationPolicyEventResolver(org.apereo.cas.web.flow.GrouperMultifactorAuthenticationPolicyEventResolver) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Example 19 with RefreshScope

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

the class LdapServiceRegistryConfiguration method serviceRegistryDao.

@Bean
@RefreshScope
@Autowired
public ServiceRegistryDao serviceRegistryDao(@Qualifier("ldapServiceRegistryMapper") final LdapRegisteredServiceMapper mapper) {
    final LdapServiceRegistryProperties ldap = casProperties.getServiceRegistry().getLdap();
    final ConnectionFactory connectionFactory = Beans.newLdaptivePooledConnectionFactory(ldap);
    return new LdapServiceRegistryDao(connectionFactory, ldap.getBaseDn(), mapper, ldap);
}
Also used : ConnectionFactory(org.ldaptive.ConnectionFactory) LdapServiceRegistryProperties(org.apereo.cas.configuration.model.support.ldap.serviceregistry.LdapServiceRegistryProperties) LdapServiceRegistryDao(org.apereo.cas.adaptors.ldap.services.LdapServiceRegistryDao) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Autowired(org.springframework.beans.factory.annotation.Autowired) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 20 with RefreshScope

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

the class RejectUsersAuthenticationEventExecutionPlanConfiguration method rejectUsersAuthenticationHandler.

@RefreshScope
@Bean
public AuthenticationHandler rejectUsersAuthenticationHandler() {
    final RejectAuthenticationProperties rejectProperties = casProperties.getAuthn().getReject();
    final Set<String> users = org.springframework.util.StringUtils.commaDelimitedListToSet(rejectProperties.getUsers());
    final RejectUsersAuthenticationHandler h = new RejectUsersAuthenticationHandler(rejectProperties.getName(), servicesManager, rejectUsersPrincipalFactory(), users);
    h.setPasswordEncoder(Beans.newPasswordEncoder(rejectProperties.getPasswordEncoder()));
    if (rejectPasswordPolicyConfiguration != null) {
        h.setPasswordPolicyConfiguration(rejectPasswordPolicyConfiguration);
    }
    h.setPrincipalNameTransformer(Beans.newPrincipalNameTransformer(rejectProperties.getPrincipalTransformation()));
    return h;
}
Also used : RejectUsersAuthenticationHandler(org.apereo.cas.adaptors.generic.RejectUsersAuthenticationHandler) RejectAuthenticationProperties(org.apereo.cas.configuration.model.support.generic.RejectAuthenticationProperties) 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