Search in sources :

Example 76 with RefreshScope

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

the class CasWebAppConfiguration method themeChangeInterceptor.

@RefreshScope
@Bean
public ThemeChangeInterceptor themeChangeInterceptor() {
    final ThemeChangeInterceptor bean = new ThemeChangeInterceptor();
    bean.setParamName(casProperties.getTheme().getParamName());
    return bean;
}
Also used : ThemeChangeInterceptor(org.springframework.web.servlet.theme.ThemeChangeInterceptor) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ServletListenerRegistrationBean(org.springframework.boot.web.servlet.ServletListenerRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 77 with RefreshScope

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

the class WsFederationAuthenticationConfiguration method wsFederationHelper.

@Bean
@RefreshScope
public WsFederationHelper wsFederationHelper() {
    final WsFederationHelper h = new WsFederationHelper();
    h.setConfigBean(this.configBean);
    return h;
}
Also used : WsFederationHelper(org.apereo.cas.support.wsfederation.WsFederationHelper) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) OpenSamlConfigBean(org.apereo.cas.support.saml.OpenSamlConfigBean) Bean(org.springframework.context.annotation.Bean)

Example 78 with RefreshScope

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

the class WsFedAuthenticationEventExecutionPlanConfiguration method wsFedConfig.

@Bean
@RefreshScope
public WsFederationConfiguration wsFedConfig() {
    final WsFederationConfiguration config = new WsFederationConfiguration();
    final WsFederationDelegationProperties wsfed = casProperties.getAuthn().getWsfed();
    config.setAttributesType(WsFederationConfiguration.WsFedPrincipalResolutionAttributesType.valueOf(wsfed.getAttributesType()));
    config.setIdentityAttribute(wsfed.getIdentityAttribute());
    config.setIdentityProviderIdentifier(wsfed.getIdentityProviderIdentifier());
    config.setIdentityProviderUrl(wsfed.getIdentityProviderUrl());
    config.setTolerance(wsfed.getTolerance());
    config.setRelyingPartyIdentifier(wsfed.getRelyingPartyIdentifier());
    org.springframework.util.StringUtils.commaDelimitedListToSet(wsfed.getSigningCertificateResources()).forEach(s -> config.getSigningCertificateResources().add(this.resourceLoader.getResource(s)));
    org.springframework.util.StringUtils.commaDelimitedListToSet(wsfed.getEncryptionPrivateKey()).forEach(s -> config.setEncryptionPrivateKey(this.resourceLoader.getResource(s)));
    org.springframework.util.StringUtils.commaDelimitedListToSet(wsfed.getEncryptionCertificate()).forEach(s -> config.setEncryptionCertificate(this.resourceLoader.getResource(s)));
    config.setEncryptionPrivateKeyPassword(wsfed.getEncryptionPrivateKeyPassword());
    config.setAttributeMutator(this.attributeMutator);
    return config;
}
Also used : WsFederationDelegationProperties(org.apereo.cas.configuration.model.support.wsfed.WsFederationDelegationProperties) WsFederationConfiguration(org.apereo.cas.support.wsfederation.WsFederationConfiguration) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 79 with RefreshScope

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

the class X509AuthenticationConfiguration method x509SubjectPrincipalResolver.

@Bean
@RefreshScope
public PrincipalResolver x509SubjectPrincipalResolver() {
    final X509Properties x509 = casProperties.getAuthn().getX509();
    final X509SubjectPrincipalResolver r = new X509SubjectPrincipalResolver(x509.getPrincipalDescriptor());
    r.setAttributeRepository(attributeRepository);
    r.setPrincipalAttributeName(x509.getPrincipal().getPrincipalAttribute());
    r.setReturnNullIfNoAttributes(x509.getPrincipal().isReturnNull());
    r.setPrincipalFactory(x509PrincipalFactory());
    return r;
}
Also used : X509SubjectPrincipalResolver(org.apereo.cas.adaptors.x509.authentication.principal.X509SubjectPrincipalResolver) X509Properties(org.apereo.cas.configuration.model.support.x509.X509Properties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 80 with RefreshScope

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

the class DynamoDbServiceRegistryConfiguration method amazonDynamoDbClient.

@RefreshScope
@Bean
public AmazonDynamoDBClient amazonDynamoDbClient() {
    try {
        final DynamoDbServiceRegistryProperties dynamoDbProperties = casProperties.getServiceRegistry().getDynamoDb();
        final ClientConfiguration cfg = new ClientConfiguration();
        cfg.setConnectionTimeout(dynamoDbProperties.getConnectionTimeout());
        cfg.setMaxConnections(dynamoDbProperties.getMaxConnections());
        cfg.setRequestTimeout(dynamoDbProperties.getRequestTimeout());
        cfg.setSocketTimeout(dynamoDbProperties.getSocketTimeout());
        cfg.setUseGzip(dynamoDbProperties.isUseGzip());
        cfg.setUseReaper(dynamoDbProperties.isUseReaper());
        cfg.setUseThrottleRetries(dynamoDbProperties.isUseThrottleRetries());
        cfg.setUseTcpKeepAlive(dynamoDbProperties.isUseTcpKeepAlive());
        cfg.setProtocol(Protocol.valueOf(dynamoDbProperties.getProtocol().toUpperCase()));
        cfg.setClientExecutionTimeout(dynamoDbProperties.getClientExecutionTimeout());
        cfg.setCacheResponseMetadata(dynamoDbProperties.isCacheResponseMetadata());
        if (StringUtils.isNotBlank(dynamoDbProperties.getLocalAddress())) {
            cfg.setLocalAddress(InetAddress.getByName(dynamoDbProperties.getLocalAddress()));
        }
        AWSCredentials credentials = null;
        if (dynamoDbProperties.getCredentialsPropertiesFile() != null) {
            credentials = new PropertiesCredentials(dynamoDbProperties.getCredentialsPropertiesFile().getInputStream());
        } else if (StringUtils.isNotBlank(dynamoDbProperties.getCredentialAccessKey()) && StringUtils.isNotBlank(dynamoDbProperties.getCredentialSecretKey())) {
            credentials = new BasicAWSCredentials(dynamoDbProperties.getCredentialAccessKey(), dynamoDbProperties.getCredentialSecretKey());
        }
        final AmazonDynamoDBClient client;
        if (credentials == null) {
            client = new AmazonDynamoDBClient(cfg);
        } else {
            client = new AmazonDynamoDBClient(credentials, cfg);
        }
        if (StringUtils.isNotBlank(dynamoDbProperties.getEndpoint())) {
            client.setEndpoint(dynamoDbProperties.getEndpoint());
        }
        if (StringUtils.isNotBlank(dynamoDbProperties.getRegion())) {
            client.setRegion(Region.getRegion(Regions.valueOf(dynamoDbProperties.getRegion())));
        }
        if (StringUtils.isNotBlank(dynamoDbProperties.getRegionOverride())) {
            client.setSignerRegionOverride(dynamoDbProperties.getRegionOverride());
        }
        if (StringUtils.isNotBlank(dynamoDbProperties.getServiceNameIntern())) {
            client.setServiceNameIntern(dynamoDbProperties.getServiceNameIntern());
        }
        if (dynamoDbProperties.getTimeOffset() != 0) {
            client.setTimeOffset(dynamoDbProperties.getTimeOffset());
        }
        return client;
    } catch (final Exception e) {
        throw Throwables.propagate(e);
    }
}
Also used : DynamoDbServiceRegistryProperties(org.apereo.cas.configuration.model.support.dynamodb.DynamoDbServiceRegistryProperties) PropertiesCredentials(com.amazonaws.auth.PropertiesCredentials) AmazonDynamoDBClient(com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) AWSCredentials(com.amazonaws.auth.AWSCredentials) ClientConfiguration(com.amazonaws.ClientConfiguration) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Aggregations

RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)97 Bean (org.springframework.context.annotation.Bean)97 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)68 STSPropertiesMBean (org.apache.cxf.sts.STSPropertiesMBean)11 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)11 ArrayList (java.util.ArrayList)10 Autowired (org.springframework.beans.factory.annotation.Autowired)6 CipherBean (org.cryptacular.bean.CipherBean)5 MultifactorAuthenticationProperties (org.apereo.cas.configuration.model.support.mfa.MultifactorAuthenticationProperties)4 SpnegoProperties (org.apereo.cas.configuration.model.support.spnego.SpnegoProperties)4 WsFederationProperties (org.apereo.cas.configuration.model.support.wsfed.WsFederationProperties)4 X509Properties (org.apereo.cas.configuration.model.support.x509.X509Properties)4 IPersonAttributeDao (org.apereo.services.persondir.IPersonAttributeDao)4 HashMap (java.util.HashMap)3 List (java.util.List)3 Properties (java.util.Properties)3 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)3 ConnectionFactory (org.ldaptive.ConnectionFactory)3 EnableConfigurationProperties (org.springframework.boot.context.properties.EnableConfigurationProperties)3 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)3