Search in sources :

Example 1 with AuthenticationAttributeReleaseProperties

use of org.apereo.cas.configuration.model.core.authentication.AuthenticationAttributeReleaseProperties in project cas by apereo.

the class CasCoreAuthenticationConfiguration method authenticationAttributeReleasePolicy.

@ConditionalOnMissingBean(name = "authenticationAttributeReleasePolicy")
@RefreshScope
@Bean
public AuthenticationAttributeReleasePolicy authenticationAttributeReleasePolicy() {
    final AuthenticationAttributeReleaseProperties authenticationAttributeRelease = casProperties.getAuthn().getAuthenticationAttributeRelease();
    final DefaultAuthenticationAttributeReleasePolicy policy = new DefaultAuthenticationAttributeReleasePolicy();
    policy.setAttributesToRelease(authenticationAttributeRelease.getOnlyRelease());
    final Set<String> attributesToNeverRelease = CollectionUtils.wrapSet(CasViewConstants.MODEL_ATTRIBUTE_NAME_PRINCIPAL_CREDENTIAL, RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME);
    attributesToNeverRelease.addAll(authenticationAttributeRelease.getNeverRelease());
    policy.setAttributesToNeverRelease(attributesToNeverRelease);
    return policy;
}
Also used : DefaultAuthenticationAttributeReleasePolicy(org.apereo.cas.authentication.DefaultAuthenticationAttributeReleasePolicy) AuthenticationAttributeReleaseProperties(org.apereo.cas.configuration.model.core.authentication.AuthenticationAttributeReleaseProperties) 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)

Aggregations

DefaultAuthenticationAttributeReleasePolicy (org.apereo.cas.authentication.DefaultAuthenticationAttributeReleasePolicy)1 AuthenticationAttributeReleaseProperties (org.apereo.cas.configuration.model.core.authentication.AuthenticationAttributeReleaseProperties)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1 Bean (org.springframework.context.annotation.Bean)1