use of org.openkilda.saml.provider.UrlMetadataProvider in project open-kilda by telstra.
the class SamlMetadataManager method loadProviderMetadata.
/**
* loads the provider.
*
* @param uuid the id of provider.
* @param type the type of provider.
*/
public void loadProviderMetadata(String uuid, String type) throws MetadataProviderException {
if (type.equals("URL")) {
UrlMetadataProvider urlProvider = new UrlMetadataProvider(new Timer(true), new HttpClient(), uuid);
urlProvider.setParserPool(ParserPoolHolder.getPool());
addProviderToMetadataManager(urlProvider);
} else if (type.equals("FILE")) {
DbMetadataProvider dbProvider = new DbMetadataProvider(uuid);
dbProvider.setParserPool(ParserPoolHolder.getPool());
addProviderToMetadataManager(dbProvider);
}
}
use of org.openkilda.saml.provider.UrlMetadataProvider in project open-kilda by telstra.
the class SamlMetadataManager method updateProviderToMetadataManager.
/**
* Updates the provider in metadata manager.
* @param uuid the provider id
* @param type the provider type
*/
public void updateProviderToMetadataManager(String uuid, String type) {
List<ExtendedMetadataDelegate> providers = metadataManager.getAvailableProviders();
String metadataEntityId = null;
for (final ExtendedMetadataDelegate provider : providers) {
MetadataProvider metadataProvider = provider.getDelegate();
if (metadataProvider instanceof DbMetadataProvider) {
DbMetadataProvider dbprovider = (DbMetadataProvider) provider.getDelegate();
metadataEntityId = dbprovider.getMetaDataEntityId();
} else if (metadataProvider instanceof UrlMetadataProvider) {
UrlMetadataProvider urlprovider = (UrlMetadataProvider) provider.getDelegate();
metadataEntityId = urlprovider.getMetaDataEntityId();
}
if (uuid.equals(metadataEntityId)) {
metadataManager.removeMetadataProvider(provider);
break;
}
}
try {
loadProviderMetadata(uuid, type);
} catch (MetadataProviderException e) {
LOGGER.error("Error occurred while updating provider in metadata manager" + e);
}
}
use of org.openkilda.saml.provider.UrlMetadataProvider in project open-kilda by telstra.
the class SecurityConfig method metadata.
@Bean
@Qualifier("metadata")
public CachingMetadataManager metadata(ExtendedMetadataDelegate extendedMetadataDelegate) throws MetadataProviderException, IOException {
List<MetadataProvider> metadataProviderList = new ArrayList<>();
List<SamlConfigEntity> samlConfigEntityList = samlRepository.findAll();
if (samlConfigEntityList != null) {
for (final SamlConfigEntity samlConfigEntity : samlConfigEntityList) {
if (samlConfigEntity.getUrl() != null) {
UrlMetadataProvider urlMetadataProvider = new UrlMetadataProvider(new Timer(true), new HttpClient(), samlConfigEntity.getUuid());
urlMetadataProvider.setParserPool(ParserPoolHolder.getPool());
ExtendedMetadataDelegate metadataDelegate = new ExtendedMetadataDelegate(urlMetadataProvider, extendedMetadata());
metadataDelegate.setMetadataTrustCheck(false);
metadataDelegate.setMetadataRequireSignature(false);
metadataProviderList.add(metadataDelegate);
} else {
DbMetadataProvider metadataProvider = new DbMetadataProvider(new Timer(true), samlConfigEntity.getUuid());
metadataProvider.setParserPool(ParserPoolHolder.getPool());
ExtendedMetadataDelegate metadataDelegate = new ExtendedMetadataDelegate(metadataProvider, extendedMetadata());
metadataDelegate.setMetadataTrustCheck(false);
metadataDelegate.setMetadataRequireSignature(false);
metadataProviderList.add(metadataDelegate);
}
}
}
return new CachingMetadataManager(metadataProviderList);
}
Aggregations