Search in sources :

Example 36 with RefreshScope

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

the class WsFedAuthenticationEventExecutionPlanConfiguration method wsFederationConfigurations.

@ConditionalOnMissingBean(name = "wsFederationConfigurations")
@Bean
@RefreshScope
public Collection<WsFederationConfiguration> wsFederationConfigurations() {
    final Collection<WsFederationConfiguration> col = new HashSet<>();
    casProperties.getAuthn().getWsfed().forEach(wsfed -> {
        final WsFederationConfiguration cfg = getWsFederationConfiguration(wsfed);
        col.add(cfg);
    });
    return col;
}
Also used : WsFederationConfiguration(org.apereo.cas.support.wsfederation.WsFederationConfiguration) 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 37 with RefreshScope

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

the class LdapServiceRegistryConfiguration method ldapServiceRegistry.

@Bean
@RefreshScope
public ServiceRegistry ldapServiceRegistry() {
    final LdapServiceRegistryProperties ldap = casProperties.getServiceRegistry().getLdap();
    final ConnectionFactory connectionFactory = LdapUtils.newLdaptivePooledConnectionFactory(ldap);
    return new LdapServiceRegistry(connectionFactory, ldap.getBaseDn(), ldapServiceRegistryMapper(), ldap);
}
Also used : ConnectionFactory(org.ldaptive.ConnectionFactory) LdapServiceRegistry(org.apereo.cas.adaptors.ldap.services.LdapServiceRegistry) LdapServiceRegistryProperties(org.apereo.cas.configuration.model.support.ldap.serviceregistry.LdapServiceRegistryProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 38 with RefreshScope

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

the class MongoDbTicketRegistryConfiguration method ticketRegistry.

@RefreshScope
@Bean
@Autowired
public TicketRegistry ticketRegistry(@Qualifier("ticketCatalog") final TicketCatalog ticketCatalog) {
    final MongoTicketRegistryProperties mongo = casProperties.getTicket().getRegistry().getMongo();
    final MongoDbTicketRegistry registry = new MongoDbTicketRegistry(ticketCatalog, mongoDbTicketRegistryTemplate(), mongo.isDropCollection());
    registry.setCipherExecutor(CoreTicketUtils.newTicketRegistryCipherExecutor(mongo.getCrypto(), "mongo"));
    return registry;
}
Also used : MongoTicketRegistryProperties(org.apereo.cas.configuration.model.support.mongo.ticketregistry.MongoTicketRegistryProperties) MongoDbTicketRegistry(org.apereo.cas.ticket.registry.MongoDbTicketRegistry) 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 39 with RefreshScope

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

the class ShiroAuthenticationConfiguration method shiroAuthenticationHandler.

@RefreshScope
@Bean
public AuthenticationHandler shiroAuthenticationHandler() {
    final ShiroAuthenticationProperties shiro = casProperties.getAuthn().getShiro();
    final ShiroAuthenticationHandler h = new ShiroAuthenticationHandler(shiro.getName(), servicesManager, shiroPrincipalFactory(), shiro.getRequiredRoles(), shiro.getRequiredPermissions());
    h.loadShiroConfiguration(shiro.getLocation());
    h.setPasswordEncoder(PasswordEncoderUtils.newPasswordEncoder(shiro.getPasswordEncoder()));
    if (shiroPasswordPolicyConfiguration != null) {
        h.setPasswordPolicyConfiguration(shiroPasswordPolicyConfiguration);
    }
    h.setPrincipalNameTransformer(PrincipalNameTransformerUtils.newPrincipalNameTransformer(shiro.getPrincipalTransformation()));
    return h;
}
Also used : ShiroAuthenticationHandler(org.apereo.cas.adaptors.generic.ShiroAuthenticationHandler) ShiroAuthenticationProperties(org.apereo.cas.configuration.model.support.generic.ShiroAuthenticationProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 40 with RefreshScope

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

the class SpnegoConfiguration method spnegoHandler.

@Bean
@RefreshScope
public AuthenticationHandler spnegoHandler() {
    final SpnegoProperties spnegoProperties = casProperties.getAuthn().getSpnego();
    final JcifsSpnegoAuthenticationHandler h = new JcifsSpnegoAuthenticationHandler(spnegoProperties.getName(), servicesManager, spnegoPrincipalFactory(), spnegoAuthentication(), spnegoProperties.isPrincipalWithDomainName(), spnegoProperties.isNtlmAllowed());
    h.setAuthentication(spnegoAuthentication());
    h.setPrincipalWithDomainName(spnegoProperties.isPrincipalWithDomainName());
    h.setNtlmAllowed(spnegoProperties.isNtlmAllowed());
    return h;
}
Also used : JcifsSpnegoAuthenticationHandler(org.apereo.cas.support.spnego.authentication.handler.support.JcifsSpnegoAuthenticationHandler) SpnegoProperties(org.apereo.cas.configuration.model.support.spnego.SpnegoProperties) 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)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