org.apereo.cas.config.SamlIdPRestfulMetadataConfiguration Maven / Gradle / Ivy
package org.apereo.cas.config;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.configuration.features.CasFeatureModule;
import org.apereo.cas.support.saml.OpenSamlConfigBean;
import org.apereo.cas.support.saml.metadata.resolver.RestfulSamlRegisteredServiceMetadataResolver;
import org.apereo.cas.support.saml.services.idp.metadata.cache.resolver.SamlRegisteredServiceMetadataResolver;
import org.apereo.cas.support.saml.services.idp.metadata.plan.SamlRegisteredServiceMetadataResolutionPlanConfigurer;
import org.apereo.cas.util.spring.boot.ConditionalOnFeatureEnabled;
import lombok.val;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ScopedProxyMode;
/**
* This is {@link SamlIdPRestfulMetadataConfiguration}.
*
* @author Misagh Moayyed
* @since 5.3.0
*/
@EnableConfigurationProperties(CasConfigurationProperties.class)
@ConditionalOnFeatureEnabled(feature = CasFeatureModule.FeatureCatalog.SAMLServiceProviderMetadata, module = "rest")
@Configuration(value = "SamlIdPRestfulMetadataConfiguration", proxyBeanMethods = false)
class SamlIdPRestfulMetadataConfiguration {
@Bean
@ConditionalOnMissingBean(name = "restSamlRegisteredServiceMetadataResolver")
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public SamlRegisteredServiceMetadataResolver restSamlRegisteredServiceMetadataResolver(
final CasConfigurationProperties casProperties,
@Qualifier(OpenSamlConfigBean.DEFAULT_BEAN_NAME)
final OpenSamlConfigBean openSamlConfigBean) {
val idp = casProperties.getAuthn().getSamlIdp();
return new RestfulSamlRegisteredServiceMetadataResolver(idp, openSamlConfigBean);
}
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@ConditionalOnMissingBean(name = "restSamlRegisteredServiceMetadataResolutionPlanConfigurer")
public SamlRegisteredServiceMetadataResolutionPlanConfigurer restSamlRegisteredServiceMetadataResolutionPlanConfigurer(
@Qualifier("restSamlRegisteredServiceMetadataResolver")
final SamlRegisteredServiceMetadataResolver restSamlRegisteredServiceMetadataResolver) {
return plan -> plan.registerMetadataResolver(restSamlRegisteredServiceMetadataResolver);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy