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"));
}
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;
}
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;
}
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());
}
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;
}
Aggregations