Search in sources :

Example 51 with RefreshScope

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

the class ElectronicFenceWebflowConfiguration method riskAwareAuthenticationWebflowEventResolver.

@ConditionalOnMissingBean(name = "riskAwareAuthenticationWebflowEventResolver")
@Bean
@Autowired
@RefreshScope
public CasWebflowEventResolver riskAwareAuthenticationWebflowEventResolver(@Qualifier("defaultAuthenticationSystemSupport") final AuthenticationSystemSupport authenticationSystemSupport) {
    final CasWebflowEventResolver r = new RiskAwareAuthenticationWebflowEventResolver(authenticationSystemSupport, centralAuthenticationService, servicesManager, ticketRegistrySupport, warnCookieGenerator, authenticationRequestServiceSelectionStrategies, multifactorAuthenticationProviderSelector, authenticationRiskEvaluator, authenticationRiskMitigator, casProperties);
    this.initialAuthenticationAttemptWebflowEventResolver.addDelegate(r, 0);
    return r;
}
Also used : CasWebflowEventResolver(org.apereo.cas.web.flow.resolver.CasWebflowEventResolver) RiskAwareAuthenticationWebflowEventResolver(org.apereo.cas.web.flow.RiskAwareAuthenticationWebflowEventResolver) 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 52 with RefreshScope

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

the class CasCoreWebConfiguration method messageSource.

@RefreshScope
@Bean
public HierarchicalMessageSource messageSource(@Qualifier("casCommonMessages") final Properties casCommonMessages) {
    final CasReloadableMessageBundle bean = new CasReloadableMessageBundle();
    final MessageBundleProperties mb = casProperties.getMessageBundle();
    bean.setDefaultEncoding(mb.getEncoding());
    bean.setCacheSeconds(mb.getCacheSeconds());
    bean.setFallbackToSystemLocale(mb.isFallbackSystemLocale());
    bean.setUseCodeAsDefaultMessage(mb.isUseCodeMessage());
    bean.setBasenames(mb.getBaseNames().toArray(new String[] {}));
    bean.setCommonMessages(casCommonMessages);
    return bean;
}
Also used : CasReloadableMessageBundle(org.apereo.cas.web.view.CasReloadableMessageBundle) MessageBundleProperties(org.apereo.cas.configuration.model.core.web.MessageBundleProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) PropertiesFactoryBean(org.springframework.beans.factory.config.PropertiesFactoryBean) FactoryBean(org.springframework.beans.factory.FactoryBean) SimpleUrlValidatorFactoryBean(org.apereo.cas.web.SimpleUrlValidatorFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 53 with RefreshScope

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

the class CasCoreWebflowConfiguration method initialAuthenticationAttemptWebflowEventResolver.

@ConditionalOnMissingBean(name = "initialAuthenticationAttemptWebflowEventResolver")
@Bean
@RefreshScope
public CasDelegatingWebflowEventResolver initialAuthenticationAttemptWebflowEventResolver() {
    final InitialAuthenticationAttemptWebflowEventResolver r = new InitialAuthenticationAttemptWebflowEventResolver(authenticationSystemSupport, centralAuthenticationService, servicesManager, ticketRegistrySupport, warnCookieGenerator, authenticationRequestServiceSelectionStrategies, multifactorAuthenticationProviderSelector, registeredServiceAccessStrategyEnforcer);
    r.addDelegate(adaptiveAuthenticationPolicyWebflowEventResolver());
    r.addDelegate(timedAuthenticationPolicyWebflowEventResolver());
    r.addDelegate(globalAuthenticationPolicyWebflowEventResolver());
    r.addDelegate(requestParameterAuthenticationPolicyWebflowEventResolver());
    r.addDelegate(requestHeaderAuthenticationPolicyWebflowEventResolver());
    r.addDelegate(requestSessionAttributeAuthenticationPolicyWebflowEventResolver());
    r.addDelegate(restEndpointAuthenticationPolicyWebflowEventResolver());
    r.addDelegate(groovyScriptAuthenticationPolicyWebflowEventResolver());
    r.addDelegate(registeredServicePrincipalAttributeAuthenticationPolicyWebflowEventResolver());
    r.addDelegate(predicatedPrincipalAttributeMultifactorAuthenticationPolicyEventResolver());
    r.addDelegate(principalAttributeAuthenticationPolicyWebflowEventResolver());
    r.addDelegate(authenticationAttributeAuthenticationPolicyWebflowEventResolver());
    r.addDelegate(registeredServiceAuthenticationPolicyWebflowEventResolver());
    r.setSelectiveResolver(selectiveAuthenticationProviderWebflowEventResolver());
    return r;
}
Also used : InitialAuthenticationAttemptWebflowEventResolver(org.apereo.cas.web.flow.resolver.impl.InitialAuthenticationAttemptWebflowEventResolver) 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 54 with RefreshScope

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

the class CasCoreWebflowConfiguration method webflowCipherExecutor.

@Bean
@RefreshScope
public CipherExecutor webflowCipherExecutor() {
    final WebflowProperties webflow = casProperties.getWebflow();
    final EncryptionRandomizedSigningJwtCryptographyProperties crypto = webflow.getCrypto();
    boolean enabled = crypto.isEnabled();
    if (!enabled && (StringUtils.isNotBlank(crypto.getEncryption().getKey())) && StringUtils.isNotBlank(crypto.getSigning().getKey())) {
        LOGGER.warn("Webflow encryption/signing is not enabled explicitly in the configuration, yet signing/encryption keys " + "are defined for operations. CAS will proceed to enable the webflow encryption/signing functionality.");
        enabled = true;
    }
    if (enabled) {
        return new WebflowConversationStateCipherExecutor(crypto.getEncryption().getKey(), crypto.getSigning().getKey(), crypto.getAlg(), crypto.getSigning().getKeySize(), crypto.getEncryption().getKeySize());
    }
    LOGGER.warn("Webflow encryption/signing is turned off. This " + "MAY NOT be safe in a production environment. Consider using other choices to handle encryption, " + "signing and verification of webflow state.");
    return CipherExecutor.noOp();
}
Also used : WebflowConversationStateCipherExecutor(org.apereo.cas.util.cipher.WebflowConversationStateCipherExecutor) WebflowProperties(org.apereo.cas.configuration.model.webapp.WebflowProperties) EncryptionRandomizedSigningJwtCryptographyProperties(org.apereo.cas.configuration.model.core.util.EncryptionRandomizedSigningJwtCryptographyProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 55 with RefreshScope

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

the class CasWebflowContextConfiguration method builder.

@RefreshScope
@Bean
public FlowBuilderServices builder() {
    final FlowBuilderServicesBuilder builder = new FlowBuilderServicesBuilder(this.applicationContext);
    builder.setViewFactoryCreator(viewFactoryCreator());
    builder.setExpressionParser(expressionParser());
    builder.setDevelopmentMode(casProperties.getWebflow().isRefresh());
    return builder.build();
}
Also used : FlowBuilderServicesBuilder(org.springframework.webflow.config.FlowBuilderServicesBuilder) 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