Search in sources :

Example 91 with RefreshScope

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

the class CasCookieConfiguration method ticketGrantingTicketCookieGenerator.

@Autowired
@Bean
@RefreshScope
public CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator(@Qualifier("cookieCipherExecutor") final CipherExecutor cipherExecutor) {
    final TicketGrantingCookieProperties tgc = casProperties.getTgc();
    final int rememberMeMaxAge = Long.valueOf(tgc.getRememberMeMaxAge()).intValue();
    return new TGCCookieRetrievingCookieGenerator(cookieValueManager(cipherExecutor), tgc.getName(), tgc.getPath(), tgc.getDomain(), rememberMeMaxAge, tgc.isSecure(), tgc.getMaxAge());
}
Also used : TGCCookieRetrievingCookieGenerator(org.apereo.cas.web.support.TGCCookieRetrievingCookieGenerator) TicketGrantingCookieProperties(org.apereo.cas.configuration.model.support.cookie.TicketGrantingCookieProperties) 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 92 with RefreshScope

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

the class CasCoreAuthenticationHandlersConfiguration method jaasAuthenticationHandler.

@RefreshScope
@Bean
public AuthenticationHandler jaasAuthenticationHandler() {
    final JaasAuthenticationProperties jaas = casProperties.getAuthn().getJaas();
    final JaasAuthenticationHandler h = new JaasAuthenticationHandler(jaas.getName(), servicesManager, jaasPrincipalFactory(), null);
    h.setKerberosKdcSystemProperty(jaas.getKerberosKdcSystemProperty());
    h.setKerberosRealmSystemProperty(jaas.getKerberosRealmSystemProperty());
    h.setRealm(jaas.getRealm());
    h.setPasswordEncoder(Beans.newPasswordEncoder(jaas.getPasswordEncoder()));
    if (jaasPasswordPolicyConfiguration != null) {
        h.setPasswordPolicyConfiguration(jaasPasswordPolicyConfiguration);
    }
    h.setPrincipalNameTransformer(Beans.newPrincipalNameTransformer(jaas.getPrincipalTransformation()));
    return h;
}
Also used : JaasAuthenticationProperties(org.apereo.cas.configuration.model.support.jaas.JaasAuthenticationProperties) JaasAuthenticationHandler(org.apereo.cas.authentication.handler.support.JaasAuthenticationHandler) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 93 with RefreshScope

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

the class CasCoreAuthenticationPrincipalConfiguration method personDirectoryPrincipalResolver.

@Autowired
@RefreshScope
@Bean
@ConditionalOnMissingBean(name = "personDirectoryPrincipalResolver")
public PrincipalResolver personDirectoryPrincipalResolver(@Qualifier("attributeRepository") final IPersonAttributeDao attributeRepository, @Qualifier("principalFactory") final PrincipalFactory principalFactory) {
    final PersonDirectoryPrincipalResolver bean = new PersonDirectoryPrincipalResolver();
    bean.setAttributeRepository(attributeRepository);
    bean.setPrincipalAttributeName(casProperties.getPersonDirectory().getPrincipalAttribute());
    bean.setReturnNullIfNoAttributes(casProperties.getPersonDirectory().isReturnNull());
    bean.setPrincipalFactory(principalFactory);
    return bean;
}
Also used : PersonDirectoryPrincipalResolver(org.apereo.cas.authentication.principal.resolvers.PersonDirectoryPrincipalResolver) 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 94 with RefreshScope

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

the class IgniteTicketRegistryConfiguration method igniteConfiguration.

/**
     * Ignite configuration ignite configuration.
     *
     * @return the ignite configuration
     */
@RefreshScope
@Bean
public IgniteConfiguration igniteConfiguration() {
    final IgniteProperties ignite = casProperties.getTicket().getRegistry().getIgnite();
    final IgniteConfiguration config = new IgniteConfiguration();
    final TcpDiscoverySpi spi = new TcpDiscoverySpi();
    spi.setHeartbeatFrequency(ignite.getHeartbeatFrequency());
    spi.setJoinTimeout(ignite.getJoinTimeout());
    if (!StringUtils.isEmpty(ignite.getLocalAddress())) {
        spi.setLocalAddress(ignite.getLocalAddress());
    }
    if (ignite.getLocalPort() != -1) {
        spi.setLocalPort(ignite.getLocalPort());
    }
    spi.setNetworkTimeout(ignite.getNetworkTimeout());
    spi.setSocketTimeout(ignite.getSocketTimeout());
    spi.setThreadPriority(ignite.getThreadPriority());
    spi.setForceServerMode(ignite.isForceServerMode());
    final TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder();
    finder.setAddresses(StringUtils.commaDelimitedListToSet(ignite.getIgniteAddresses()));
    spi.setIpFinder(finder);
    config.setDiscoverySpi(spi);
    final List<CacheConfiguration> configurations = new ArrayList<>();
    final CacheConfiguration ticketsCache = new CacheConfiguration();
    ticketsCache.setName(ignite.getTicketsCache().getCacheName());
    ticketsCache.setCacheMode(CacheMode.valueOf(ignite.getTicketsCache().getCacheMode()));
    ticketsCache.setAtomicityMode(CacheAtomicityMode.valueOf(ignite.getTicketsCache().getAtomicityMode()));
    ticketsCache.setWriteSynchronizationMode(CacheWriteSynchronizationMode.valueOf(ignite.getTicketsCache().getWriteSynchronizationMode()));
    ticketsCache.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, casProperties.getTicket().getTgt().getMaxTimeToLiveInSeconds())));
    configurations.add(ticketsCache);
    config.setCacheConfiguration(configurations.toArray(new CacheConfiguration[] {}));
    return config;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) ArrayList(java.util.ArrayList) Duration(javax.cache.expiry.Duration) IgniteProperties(org.apereo.cas.configuration.model.support.ignite.IgniteProperties) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Example 95 with RefreshScope

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

the class IgniteTicketRegistryConfiguration method ticketRegistry.

@Bean
@RefreshScope
public TicketRegistry ticketRegistry() {
    final IgniteProperties igniteProperties = casProperties.getTicket().getRegistry().getIgnite();
    final IgniteTicketRegistry r = new IgniteTicketRegistry(igniteConfiguration(), igniteProperties);
    r.setCipherExecutor(Beans.newTicketRegistryCipherExecutor(igniteProperties.getCrypto()));
    return r;
}
Also used : IgniteTicketRegistry(org.apereo.cas.ticket.registry.IgniteTicketRegistry) IgniteProperties(org.apereo.cas.configuration.model.support.ignite.IgniteProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Aggregations

RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)167 Bean (org.springframework.context.annotation.Bean)167 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)114 Autowired (org.springframework.beans.factory.annotation.Autowired)20 ArrayList (java.util.ArrayList)15 STSPropertiesMBean (org.apache.cxf.sts.STSPropertiesMBean)11 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)11 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)8 EncryptionJwtSigningJwtCryptographyProperties (org.apereo.cas.configuration.model.core.util.EncryptionJwtSigningJwtCryptographyProperties)8 EnableConfigurationProperties (org.springframework.boot.context.properties.EnableConfigurationProperties)8 List (java.util.List)7 SneakyThrows (lombok.SneakyThrows)7 IPersonAttributeDao (org.apereo.services.persondir.IPersonAttributeDao)7 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)7 ConnectionFactory (org.ldaptive.ConnectionFactory)6 Resource (org.springframework.core.io.Resource)5 Properties (java.util.Properties)4 GrouperPrincipalAttributesProperties (org.apereo.cas.configuration.model.core.authentication.GrouperPrincipalAttributesProperties)4 PrincipalAttributesProperties (org.apereo.cas.configuration.model.core.authentication.PrincipalAttributesProperties)4 IgniteProperties (org.apereo.cas.configuration.model.support.ignite.IgniteProperties)4