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;
}
Aggregations