Search in sources :

Example 61 with RefreshScope

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

the class CasConsentCoreConfiguration method consentCipherExecutor.

@ConditionalOnMissingBean(name = "consentCipherExecutor")
@Bean
@RefreshScope
public CipherExecutor consentCipherExecutor() {
    final ConsentProperties consent = casProperties.getConsent();
    final EncryptionJwtSigningJwtCryptographyProperties crypto = consent.getCrypto();
    if (crypto.isEnabled()) {
        return new AttributeReleaseConsentCipherExecutor(crypto.getEncryption().getKey(), crypto.getSigning().getKey(), crypto.getAlg());
    }
    LOGGER.debug("Consent attributes stored by CAS are not signed/encrypted.");
    return CipherExecutor.noOp();
}
Also used : ConsentProperties(org.apereo.cas.configuration.model.support.consent.ConsentProperties) AttributeReleaseConsentCipherExecutor(org.apereo.cas.consent.AttributeReleaseConsentCipherExecutor) EncryptionJwtSigningJwtCryptographyProperties(org.apereo.cas.configuration.model.core.util.EncryptionJwtSigningJwtCryptographyProperties) 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 62 with RefreshScope

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

the class CouchbaseAuthenticationConfiguration method authenticationCouchbaseClientFactory.

@ConditionalOnMissingBean(name = "authenticationCouchbaseClientFactory")
@RefreshScope
@Bean
public CouchbaseClientFactory authenticationCouchbaseClientFactory() {
    final CouchbaseAuthenticationProperties couchbase = casProperties.getAuthn().getCouchbase();
    final Set<String> nodes = org.springframework.util.StringUtils.commaDelimitedListToSet(couchbase.getNodeSet());
    return new CouchbaseClientFactory(nodes, couchbase.getBucket(), couchbase.getPassword());
}
Also used : CouchbaseClientFactory(org.apereo.cas.couchbase.core.CouchbaseClientFactory) CouchbaseAuthenticationProperties(org.apereo.cas.configuration.model.support.couchbase.authentication.CouchbaseAuthenticationProperties) 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 63 with RefreshScope

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

the class GoogleAuthenticatorAuthenticationEventExecutionPlanConfiguration method googleAuthenticatorAuthenticationProvider.

@Bean
@RefreshScope
public MultifactorAuthenticationProvider googleAuthenticatorAuthenticationProvider() {
    final GAuthMultifactorProperties gauth = casProperties.getAuthn().getMfa().getGauth();
    final GoogleAuthenticatorMultifactorAuthenticationProvider p = new GoogleAuthenticatorMultifactorAuthenticationProvider();
    p.setBypassEvaluator(googleBypassEvaluator());
    p.setGlobalFailureMode(casProperties.getAuthn().getMfa().getGlobalFailureMode());
    p.setOrder(gauth.getRank());
    p.setId(gauth.getId());
    return p;
}
Also used : GoogleAuthenticatorMultifactorAuthenticationProvider(org.apereo.cas.adaptors.gauth.GoogleAuthenticatorMultifactorAuthenticationProvider) GAuthMultifactorProperties(org.apereo.cas.configuration.model.support.mfa.GAuthMultifactorProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 64 with RefreshScope

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

the class JsonResourceAuthenticationEventExecutionPlanConfiguration method jsonResourceAuthenticationHandler.

@RefreshScope
@Bean
public AuthenticationHandler jsonResourceAuthenticationHandler() {
    final JsonResourceAuthenticationProperties jsonProps = casProperties.getAuthn().getJson();
    final JsonResourceAuthenticationHandler h = new JsonResourceAuthenticationHandler(jsonProps.getName(), servicesManager, jsonPrincipalFactory(), null, jsonProps.getLocation());
    h.setPasswordEncoder(PasswordEncoderUtils.newPasswordEncoder(jsonProps.getPasswordEncoder()));
    if (jsonProps.getPasswordPolicy().isEnabled()) {
        h.setPasswordPolicyConfiguration(new PasswordPolicyConfiguration(jsonProps.getPasswordPolicy()));
    }
    h.setPrincipalNameTransformer(PrincipalNameTransformerUtils.newPrincipalNameTransformer(jsonProps.getPrincipalTransformation()));
    return h;
}
Also used : JsonResourceAuthenticationHandler(org.apereo.cas.adaptors.generic.JsonResourceAuthenticationHandler) PasswordPolicyConfiguration(org.apereo.cas.authentication.support.password.PasswordPolicyConfiguration) JsonResourceAuthenticationProperties(org.apereo.cas.configuration.model.support.generic.JsonResourceAuthenticationProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 65 with RefreshScope

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

the class RejectUsersAuthenticationEventExecutionPlanConfiguration method rejectUsersAuthenticationHandler.

@RefreshScope
@Bean
public AuthenticationHandler rejectUsersAuthenticationHandler() {
    final RejectAuthenticationProperties rejectProperties = casProperties.getAuthn().getReject();
    final Set<String> users = org.springframework.util.StringUtils.commaDelimitedListToSet(rejectProperties.getUsers());
    final RejectUsersAuthenticationHandler h = new RejectUsersAuthenticationHandler(rejectProperties.getName(), servicesManager, rejectUsersPrincipalFactory(), users);
    h.setPasswordEncoder(PasswordEncoderUtils.newPasswordEncoder(rejectProperties.getPasswordEncoder()));
    if (rejectPasswordPolicyConfiguration != null) {
        h.setPasswordPolicyConfiguration(rejectPasswordPolicyConfiguration);
    }
    h.setPrincipalNameTransformer(PrincipalNameTransformerUtils.newPrincipalNameTransformer(rejectProperties.getPrincipalTransformation()));
    return h;
}
Also used : RejectUsersAuthenticationHandler(org.apereo.cas.adaptors.generic.RejectUsersAuthenticationHandler) RejectAuthenticationProperties(org.apereo.cas.configuration.model.support.generic.RejectAuthenticationProperties) 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