Search in sources :

Example 1 with SamlIdentityProviderEntityParser

use of org.apereo.cas.entity.SamlIdentityProviderEntityParser in project cas by apereo.

the class SamlIdentityProviderDiscoveryConfiguration method samlIdentityProviderEntityParser.

@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@ConditionalOnMissingBean(name = "samlIdentityProviderEntityParser")
public Supplier<List<SamlIdentityProviderEntityParser>> samlIdentityProviderEntityParser(final CasConfigurationProperties casProperties, @Qualifier("builtClients") final Clients builtClients) {
    val parsers = new ArrayList<SamlIdentityProviderEntityParser>();
    val resource = casProperties.getAuthn().getPac4j().getSamlDiscovery().getResource();
    resource.stream().filter(res -> res.getLocation() != null).forEach(Unchecked.consumer(res -> parsers.add(new SamlIdentityProviderEntityParser(res.getLocation()))));
    builtClients.findAllClients().stream().filter(c -> c instanceof SAML2Client).map(SAML2Client.class::cast).forEach(c -> {
        c.init();
        val entity = new SamlIdentityProviderEntity();
        entity.setEntityID(c.getIdentityProviderResolvedEntityId());
        parsers.add(new SamlIdentityProviderEntityParser(entity));
    });
    return () -> parsers;
}
Also used : lombok.val(lombok.val) CasConfigurationProperties(org.apereo.cas.configuration.CasConfigurationProperties) ArgumentExtractor(org.apereo.cas.web.support.ArgumentExtractor) SAML2Client(org.pac4j.saml.client.SAML2Client) FlowBuilderServices(org.springframework.webflow.engine.builder.support.FlowBuilderServices) Supplier(java.util.function.Supplier) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ArrayList(java.util.ArrayList) Clients(org.pac4j.core.client.Clients) CasWebflowConstants(org.apereo.cas.web.flow.CasWebflowConstants) EnableConfigurationProperties(org.springframework.boot.context.properties.EnableConfigurationProperties) ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) Qualifier(org.springframework.beans.factory.annotation.Qualifier) ServicesManager(org.apereo.cas.services.ServicesManager) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Unchecked(org.jooq.lambda.Unchecked) FlowDefinitionRegistry(org.springframework.webflow.definition.registry.FlowDefinitionRegistry) lombok.val(lombok.val) ScopedProxyMode(org.springframework.context.annotation.ScopedProxyMode) ConditionalOnFeature(org.apereo.cas.util.spring.boot.ConditionalOnFeature) SamlIdentityProviderEntity(org.apereo.cas.entity.SamlIdentityProviderEntity) Configuration(org.springframework.context.annotation.Configuration) SamlIdentityProviderDiscoveryWebflowConfigurer(org.apereo.cas.web.flow.SamlIdentityProviderDiscoveryWebflowConfigurer) List(java.util.List) AuditableExecution(org.apereo.cas.audit.AuditableExecution) CasFeatureModule(org.apereo.cas.configuration.support.CasFeatureModule) SamlIdentityProviderDiscoveryFeedController(org.apereo.cas.web.SamlIdentityProviderDiscoveryFeedController) DelegatedAuthenticationAccessStrategyHelper(org.apereo.cas.validation.DelegatedAuthenticationAccessStrategyHelper) CasWebflowConfigurer(org.apereo.cas.web.flow.CasWebflowConfigurer) SamlIdentityProviderEntityParser(org.apereo.cas.entity.SamlIdentityProviderEntityParser) Bean(org.springframework.context.annotation.Bean) CasWebflowExecutionPlanConfigurer(org.apereo.cas.web.flow.CasWebflowExecutionPlanConfigurer) ArrayList(java.util.ArrayList) SAML2Client(org.pac4j.saml.client.SAML2Client) SamlIdentityProviderEntityParser(org.apereo.cas.entity.SamlIdentityProviderEntityParser) SamlIdentityProviderEntity(org.apereo.cas.entity.SamlIdentityProviderEntity) 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

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Supplier (java.util.function.Supplier)1 lombok.val (lombok.val)1 AuditableExecution (org.apereo.cas.audit.AuditableExecution)1 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)1 CasFeatureModule (org.apereo.cas.configuration.support.CasFeatureModule)1 SamlIdentityProviderEntity (org.apereo.cas.entity.SamlIdentityProviderEntity)1 SamlIdentityProviderEntityParser (org.apereo.cas.entity.SamlIdentityProviderEntityParser)1 ServicesManager (org.apereo.cas.services.ServicesManager)1 ConditionalOnFeature (org.apereo.cas.util.spring.boot.ConditionalOnFeature)1 DelegatedAuthenticationAccessStrategyHelper (org.apereo.cas.validation.DelegatedAuthenticationAccessStrategyHelper)1 SamlIdentityProviderDiscoveryFeedController (org.apereo.cas.web.SamlIdentityProviderDiscoveryFeedController)1 CasWebflowConfigurer (org.apereo.cas.web.flow.CasWebflowConfigurer)1 CasWebflowConstants (org.apereo.cas.web.flow.CasWebflowConstants)1 CasWebflowExecutionPlanConfigurer (org.apereo.cas.web.flow.CasWebflowExecutionPlanConfigurer)1 SamlIdentityProviderDiscoveryWebflowConfigurer (org.apereo.cas.web.flow.SamlIdentityProviderDiscoveryWebflowConfigurer)1 ArgumentExtractor (org.apereo.cas.web.support.ArgumentExtractor)1 Unchecked (org.jooq.lambda.Unchecked)1 Clients (org.pac4j.core.client.Clients)1