Search in sources :

Example 21 with Bean

use of org.springframework.context.annotation.Bean in project cas by apereo.

the class EhcacheTicketRegistryConfiguration method cacheManager.

@Lazy
@Bean
public EhCacheManagerFactoryBean cacheManager() {
    final EhcacheProperties cache = casProperties.getTicket().getRegistry().getEhcache();
    final EhCacheManagerFactoryBean bean = new EhCacheManagerFactoryBean();
    bean.setConfigLocation(cache.getConfigLocation());
    bean.setShared(cache.isShared());
    bean.setCacheManagerName(cache.getCacheManagerName());
    return bean;
}
Also used : EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) EhcacheProperties(org.apereo.cas.configuration.model.support.ehcache.EhcacheProperties) Lazy(org.springframework.context.annotation.Lazy) EhCacheFactoryBean(org.springframework.cache.ehcache.EhCacheFactoryBean) EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 22 with Bean

use of org.springframework.context.annotation.Bean 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 23 with Bean

use of org.springframework.context.annotation.Bean 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 24 with Bean

use of org.springframework.context.annotation.Bean 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 25 with Bean

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

Aggregations

Bean (org.springframework.context.annotation.Bean)3865 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1065 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)444 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)389 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)309 lombok.val (lombok.val)294 HashMap (java.util.HashMap)285 Lazy (org.springframework.context.annotation.Lazy)257 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)190 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)151 Map (java.util.Map)150 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)110 Properties (java.util.Properties)94 Autowired (org.springframework.beans.factory.annotation.Autowired)92 ArrayList (java.util.ArrayList)79 Primary (org.springframework.context.annotation.Primary)75 Qualifier (org.springframework.beans.factory.annotation.Qualifier)71 CamelContextAware (org.apache.camel.CamelContextAware)69 ThreadPoolTaskExecutor (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor)68 JpaTransactionManager (org.springframework.orm.jpa.JpaTransactionManager)59