use of org.apereo.cas.configuration.model.support.saml.idp.metadata.SamlIdPMetadataProperties in project cas by apereo.
the class SamlIdPJpaMetadataConfiguration method samlMetadataEntityManagerFactory.
@Lazy
@Bean
public LocalContainerEntityManagerFactoryBean samlMetadataEntityManagerFactory() {
final SamlIdPMetadataProperties idp = casProperties.getAuthn().getSamlIdp().getMetadata();
final LocalContainerEntityManagerFactoryBean bean = JpaBeans.newHibernateEntityManagerFactoryBean(new JpaConfigDataHolder(jpaSamlMetadataVendorAdapter(), "jpaSamlMetadataContext", jpaSamlMetadataPackagesToScan(), dataSourceSamlMetadata()), idp.getJpa());
return bean;
}
use of org.apereo.cas.configuration.model.support.saml.idp.metadata.SamlIdPMetadataProperties in project cas by apereo.
the class DynamicMetadataResolver method resolve.
@Override
public List<MetadataResolver> resolve(final SamlRegisteredService service) {
LOGGER.info("Loading metadata dynamically for [{}]", service.getName());
final SamlIdPMetadataProperties md = samlIdPProperties.getMetadata();
final FunctionDrivenDynamicHTTPMetadataResolver resolver = new FunctionDrivenDynamicHTTPMetadataResolver(this.httpClient.getWrappedHttpClient());
resolver.setMinCacheDuration(TimeUnit.MILLISECONDS.convert(md.getCacheExpirationMinutes(), TimeUnit.MINUTES));
resolver.setRequireValidMetadata(md.isRequireValidMetadata());
if (StringUtils.isNotBlank(md.getBasicAuthnPassword()) && StringUtils.isNotBlank(md.getBasicAuthnUsername())) {
resolver.setBasicCredentials(new UsernamePasswordCredentials(md.getBasicAuthnUsername(), md.getBasicAuthnPassword()));
}
if (!md.getSupportedContentTypes().isEmpty()) {
resolver.setSupportedContentTypes(md.getSupportedContentTypes());
}
resolver.setRequestURLBuilder(new Function<String, String>() {
@Nullable
@Override
public String apply(@Nullable final String input) {
if (StringUtils.isNotBlank(input)) {
final String metadataLocation = service.getMetadataLocation().replace("{0}", EncodingUtils.urlEncode(input));
LOGGER.info("Constructed dynamic metadata query [{}] for [{}]", metadataLocation, service.getName());
return metadataLocation;
}
return null;
}
});
try {
configureAndInitializeSingleMetadataResolver(resolver, service);
return CollectionUtils.wrap(resolver);
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
return new ArrayList<>(0);
}
Aggregations