public class HTTPMetadataProvider extends AbstractMetadataProvider
HTTPMetadataResolver
,
FileBackedHTTPMetadataResolver
AbstractMetadataProvider.EntityDescriptorIterator
Constructor and Description |
---|
HTTPMetadataProvider(String metadataUrl,
String backupFile)
Creates a provider that periodically downloads data from the URL given by
metadataUrl . |
HTTPMetadataProvider(String metadataUrl,
String backupFile,
org.apache.http.client.HttpClient httpClient,
HttpClientSecurityParameters tlsSecurityParameters)
Creates a provider that peiodically downloads data from the URL given by
metadataUrl . |
HTTPMetadataProvider(String metadataUrl,
String backupFile,
HttpClientSecurityParameters tlsSecurityParameters)
Creates a provider that peiodically downloads data from the URL given by
metadataUrl . |
Modifier and Type | Method and Description |
---|---|
static org.apache.http.client.HttpClient |
createDefaultHttpClient()
Creates a default
HttpClient instance that uses system properties and sets a SSLSocketFactory that is
configured in a "no trust" mode, meaning that all peer certificates are accepted and no hostname check is made. |
protected void |
createMetadataResolver(boolean requireValidMetadata,
boolean failFastInitialization,
MetadataFilter filter)
Creates the specific
MetadataResolver instance for the provider implementation. |
static TrustEngine<? super X509Credential> |
createTlsTrustEngine(KeyStore trustStore)
Creates a
TrustEngine instance based on the supplied trust key store. |
protected void |
destroyMetadataResolver()
Destroys the metadata resolver.
|
String |
getID()
Returns the identifier for the provider.
|
MetadataResolver |
getMetadataResolver()
Returns the underlying OpenSAML metadata resolver.
|
protected void |
initializeMetadataResolver()
Initializes the metadata resolver.
|
createFilter, doDestroy, doInitialize, getEntityDescriptor, getIdentityProviders, getIDPSSODescriptor, getLastUpdate, getMetadata, getMetadataDOM, getServiceProviders, getSPSSODescriptor, iterator, iterator, refresh, setExclusionPredicates, setFailFastInitialization, setInclusionPredicates, setPerformSchemaValidation, setRequireValidMetadata, setSignatureVerificationCertificate
destroy, initialize, isDestroyed, isInitialized
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initialize, isInitialized
destroy, isDestroyed
public HTTPMetadataProvider(String metadataUrl, String backupFile) throws ResolverException
metadataUrl
. If the
backupFile
parameter is given the provider also stores the downloaded metadata on disk as backup.
This constructor will initialize the underlying MetadataResolver
with a default HttpClient
instance
that is initialized according to createDefaultHttpClient()
.
Since no security parameters for TLS connections are given, this will be read from the system properties
javax.net.ssl.trustStore
and javax.net.ssl.trustStorePassword
.
metadataUrl
- the URL to use when downloading metadatabackupFile
- optional path to the file to where the provider should store downloaded metadataResolverException
- if the supplied metadata URL is invalidpublic HTTPMetadataProvider(String metadataUrl, String backupFile, HttpClientSecurityParameters tlsSecurityParameters) throws ResolverException
metadataUrl
. If the
backupFile
parameter is given the provider also stores the downloaded metadata on disk as backup.
This constructor will initialize the underlying MetadataResolver
with a default HttpClient
instance
that is initialized according to createDefaultHttpClient()
and the supplied security parameters.
metadataUrl
- the URL to use when downloading metadatabackupFile
- optional path to the file to where the provider should store downloaded metadatatlsSecurityParameters
- security parameters to use for TLS connections (including TLS truststore). If not set, default system
settings will be appliedResolverException
- if the supplied metadata URL is invalidpublic HTTPMetadataProvider(String metadataUrl, String backupFile, org.apache.http.client.HttpClient httpClient, HttpClientSecurityParameters tlsSecurityParameters) throws ResolverException
metadataUrl
. If the
backupFile
parameter is given the provider also stores the downloaded metadata on disk as backup.metadataUrl
- the URL to use when downloading metadatabackupFile
- optional path to the file to where the provider should store downloaded metadatahttpClient
- the HttpClient
that should be used to download the metadatatlsSecurityParameters
- security parameters to use for TLS connections (including TLS truststore). If not set, default system
settings will be appliedResolverException
- if the supplied metadata URL is invalidpublic static org.apache.http.client.HttpClient createDefaultHttpClient()
HttpClient
instance that uses system properties and sets a SSLSocketFactory that is
configured in a "no trust" mode, meaning that all peer certificates are accepted and no hostname check is made.
TLS security parameters, such as a trust engine, may later be added by assigning a configured
HttpClientSecurityParameters
instance in the constructor.
HttpClient
instancepublic String getID()
public MetadataResolver getMetadataResolver()
protected void createMetadataResolver(boolean requireValidMetadata, boolean failFastInitialization, MetadataFilter filter) throws ResolverException
MetadataResolver
instance for the provider implementation.
The filter
parameter is a MetadataFilter
that must be installed for the resolver. Any other
filters that should be installed by the specific instance should be placed last in a filter chain.
createMetadataResolver
in class AbstractMetadataProvider
requireValidMetadata
- should be passed into MetadataResolver.setRequireValidMetadata(boolean)
failFastInitialization
- should be passed into AbstractMetadataResolver.setFailFastInitialization(boolean)
(if applicable)filter
- filter that must be installed for the resolverResolverException
- for errors creating the resolverpublic static TrustEngine<? super X509Credential> createTlsTrustEngine(KeyStore trustStore) throws KeyStoreException
TrustEngine
instance based on the supplied trust key store.trustStore
- the keystore holding the trusted certificatesTrustEngine
instanceKeyStoreException
- for errors reading the TLS trust key storeprotected void initializeMetadataResolver() throws ComponentInitializationException
initializeMetadataResolver
in class AbstractMetadataProvider
ComponentInitializationException
- for initialization errorsprotected void destroyMetadataResolver()
destroyMetadataResolver
in class AbstractMetadataProvider
Copyright © 2018 Litsec AB. All rights reserved.