Search in sources :

Example 61 with Autowired

use of org.springframework.beans.factory.annotation.Autowired in project cas by apereo.

the class EhcacheTicketRegistryConfiguration method ticketRegistry.

@Autowired
@RefreshScope
@Bean
public TicketRegistry ticketRegistry(@Qualifier("ehcacheTicketCacheManager") final CacheManager manager, @Qualifier("ticketCatalog") final TicketCatalog ticketCatalog) {
    final EncryptionRandomizedSigningJwtCryptographyProperties crypto = casProperties.getTicket().getRegistry().getEhcache().getCrypto();
    final Collection<TicketDefinition> definitions = ticketCatalog.findAll();
    definitions.forEach(t -> {
        final Ehcache ehcache = buildCache(t);
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Created Ehcache cache [{}] for [{}]", ehcache.getName(), t);
            final CacheConfiguration config = ehcache.getCacheConfiguration();
            LOGGER.debug("TicketCache.maxEntriesLocalHeap=[{}]", config.getMaxEntriesLocalHeap());
            LOGGER.debug("TicketCache.maxEntriesLocalDisk=[{}]", config.getMaxEntriesLocalDisk());
            LOGGER.debug("TicketCache.maxEntriesInCache=[{}]", config.getMaxEntriesInCache());
            LOGGER.debug("TicketCache.persistenceConfiguration=[{}]", config.getPersistenceConfiguration().getStrategy());
            LOGGER.debug("TicketCache.synchronousWrites=[{}]", config.getPersistenceConfiguration().getSynchronousWrites());
            LOGGER.debug("TicketCache.timeToLive=[{}]", config.getTimeToLiveSeconds());
            LOGGER.debug("TicketCache.timeToIdle=[{}]", config.getTimeToIdleSeconds());
            LOGGER.debug("TicketCache.cacheManager=[{}]", ehcache.getCacheManager().getName());
        }
        manager.addDecoratedCacheIfAbsent(ehcache);
    });
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("The following caches are available: [{}]", (Object[]) manager.getCacheNames());
    }
    return new EhCacheTicketRegistry(ticketCatalog, manager, CoreTicketUtils.newTicketRegistryCipherExecutor(crypto, "ehcache"));
}
Also used : EhCacheTicketRegistry(org.apereo.cas.ticket.registry.EhCacheTicketRegistry) TicketDefinition(org.apereo.cas.ticket.TicketDefinition) Ehcache(net.sf.ehcache.Ehcache) CacheConfiguration(net.sf.ehcache.config.CacheConfiguration) EncryptionRandomizedSigningJwtCryptographyProperties(org.apereo.cas.configuration.model.core.util.EncryptionRandomizedSigningJwtCryptographyProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Autowired(org.springframework.beans.factory.annotation.Autowired) EhCacheFactoryBean(org.springframework.cache.ehcache.EhCacheFactoryBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 62 with Autowired

use of org.springframework.beans.factory.annotation.Autowired in project cas by apereo.

the class JpaServiceRegistryConfiguration method transactionManagerServiceReg.

@Autowired
@Bean
public PlatformTransactionManager transactionManagerServiceReg(@Qualifier("serviceEntityManagerFactory") final EntityManagerFactory emf) {
    final JpaTransactionManager mgmr = new JpaTransactionManager();
    mgmr.setEntityManagerFactory(emf);
    return mgmr;
}
Also used : JpaTransactionManager(org.springframework.orm.jpa.JpaTransactionManager) Autowired(org.springframework.beans.factory.annotation.Autowired) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 63 with Autowired

use of org.springframework.beans.factory.annotation.Autowired in project cas by apereo.

the class GrouperMultifactorAuthenticationConfiguration method grouperMultifactorAuthenticationWebflowEventResolver.

@Autowired
@Bean
@RefreshScope
public CasWebflowEventResolver grouperMultifactorAuthenticationWebflowEventResolver(@Qualifier("defaultAuthenticationSystemSupport") final AuthenticationSystemSupport authenticationSystemSupport) {
    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);
    }
    this.initialAuthenticationAttemptWebflowEventResolver.addDelegate(r);
    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) Autowired(org.springframework.beans.factory.annotation.Autowired) Bean(org.springframework.context.annotation.Bean)

Example 64 with Autowired

use of org.springframework.beans.factory.annotation.Autowired in project cas by apereo.

the class CasThrottlingConfiguration method authenticationThrottle.

@RefreshScope
@ConditionalOnMissingBean(name = "authenticationThrottle")
@Bean
@Autowired
public ThrottledSubmissionHandlerInterceptor authenticationThrottle(@Qualifier("auditTrailExecutionPlan") final AuditTrailExecutionPlan auditTrailExecutionPlan) {
    final ThrottleProperties throttle = casProperties.getAuthn().getThrottle();
    if (StringUtils.isNotBlank(throttle.getUsernameParameter())) {
        LOGGER.debug("Activating authentication throttling based on IP address and username...");
        return new InMemoryThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapter(throttle.getFailure().getThreshold(), throttle.getFailure().getRangeSeconds(), throttle.getUsernameParameter(), throttle.getFailure().getCode(), auditTrailExecutionPlan, throttle.getAppcode());
    }
    LOGGER.debug("Activating authentication throttling based on IP address...");
    return new InMemoryThrottledSubmissionByIpAddressHandlerInterceptorAdapter(throttle.getFailure().getThreshold(), throttle.getFailure().getRangeSeconds(), throttle.getUsernameParameter(), throttle.getFailure().getCode(), auditTrailExecutionPlan, throttle.getAppcode());
}
Also used : InMemoryThrottledSubmissionByIpAddressHandlerInterceptorAdapter(org.apereo.cas.web.support.InMemoryThrottledSubmissionByIpAddressHandlerInterceptorAdapter) InMemoryThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapter(org.apereo.cas.web.support.InMemoryThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapter) ThrottleProperties(org.apereo.cas.configuration.model.support.throttle.ThrottleProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Autowired(org.springframework.beans.factory.annotation.Autowired) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 65 with Autowired

use of org.springframework.beans.factory.annotation.Autowired in project cas by apereo.

the class SamlIdPMetadataConfiguration method casSamlIdPMetadataResolver.

@Lazy
@Bean(initMethod = "initialize", destroyMethod = "destroy")
@DependsOn("samlIdPMetadataGenerator")
@SneakyThrows
@Autowired
public MetadataResolver casSamlIdPMetadataResolver(@Qualifier("samlMetadataLocator") final SamlIdPMetadataLocator samlMetadataLocator) {
    final SamlIdPProperties idp = casProperties.getAuthn().getSamlIdp();
    final ResourceBackedMetadataResolver resolver = new ResourceBackedMetadataResolver(ResourceHelper.of(samlMetadataLocator.getMetadata()));
    resolver.setParserPool(this.openSamlConfigBean.getParserPool());
    resolver.setFailFastInitialization(idp.getMetadata().isFailFast());
    resolver.setRequireValidMetadata(idp.getMetadata().isRequireValidMetadata());
    resolver.setId(idp.getEntityId());
    return resolver;
}
Also used : SamlIdPProperties(org.apereo.cas.configuration.model.support.saml.idp.SamlIdPProperties) ResourceBackedMetadataResolver(org.opensaml.saml.metadata.resolver.impl.ResourceBackedMetadataResolver) Lazy(org.springframework.context.annotation.Lazy) DependsOn(org.springframework.context.annotation.DependsOn) Autowired(org.springframework.beans.factory.annotation.Autowired) SneakyThrows(lombok.SneakyThrows) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) OpenSamlConfigBean(org.apereo.cas.support.saml.OpenSamlConfigBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

Autowired (org.springframework.beans.factory.annotation.Autowired)68 Bean (org.springframework.context.annotation.Bean)49 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)24 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)16 JpaTransactionManager (org.springframework.orm.jpa.JpaTransactionManager)8 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)8 ThrottleProperties (org.apereo.cas.configuration.model.support.throttle.ThrottleProperties)4 OpenSamlConfigBean (org.apereo.cas.support.saml.OpenSamlConfigBean)3 Field (java.lang.reflect.Field)2 PersonDirectoryPrincipalResolver (org.apereo.cas.authentication.principal.resolvers.PersonDirectoryPrincipalResolver)2 MonitorProperties (org.apereo.cas.configuration.model.core.monitor.MonitorProperties)2 EncryptionRandomizedSigningJwtCryptographyProperties (org.apereo.cas.configuration.model.core.util.EncryptionRandomizedSigningJwtCryptographyProperties)2 DynamoDbTicketRegistryProperties (org.apereo.cas.configuration.model.support.dynamodb.DynamoDbTicketRegistryProperties)2 CasWebflowEventResolver (org.apereo.cas.web.flow.resolver.CasWebflowEventResolver)2 V3ServiceValidateController (org.apereo.cas.web.v3.V3ServiceValidateController)2 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)2 EhCacheFactoryBean (org.springframework.cache.ehcache.EhCacheFactoryBean)2 EhCacheManagerFactoryBean (org.springframework.cache.ehcache.EhCacheManagerFactoryBean)2 Lazy (org.springframework.context.annotation.Lazy)2 DeviceResponseMessageSender (com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.DeviceResponseMessageSender)1