public class HTTPMetadataResolver extends AbstractReloadingMetadataResolver
AbstractInitializableComponent.initialize(), if any properties of this
provider are changed.AbstractBatchMetadataResolver.BatchEntityBackingStoreAbstractMetadataResolver.EntityBackingStore| Modifier and Type | Field and Description |
|---|---|
private String |
cachedMetadataETag
The ETag provided when the currently cached metadata was fetched.
|
private String |
cachedMetadataLastModified
The Last-Modified information provided when the currently cached metadata was fetched.
|
private BasicCredentialsProvider |
credentialsProvider
HttpClient credentials provider.
|
private HttpClient |
httpClient
HTTP Client used to pull the metadata.
|
private Logger |
log
Class logger.
|
private URI |
metadataURI
URL to the Metadata.
|
private org.opensaml.security.trust.TrustEngine<? super org.opensaml.security.x509.X509Credential> |
tlsTrustEngine
Optional trust engine used in evaluating server TLS credentials.
|
| Constructor and Description |
|---|
HTTPMetadataResolver(HttpClient client,
String metadataURL)
Constructor.
|
HTTPMetadataResolver(Timer backgroundTaskTimer,
HttpClient client,
String metadataURL)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected HttpClientContext |
buildHttpClientContext()
Build the
HttpClientContext instance which will be used to invoke the HttpClient request. |
protected HttpGet |
buildHttpGet()
Builds the
HttpGet instance used to fetch the metadata. |
protected void |
checkTLSCredentialTrusted(HttpClientContext context)
Check that trust engine evaluation of the server TLS credential was actually performed.
|
protected void |
doDestroy() |
protected byte[] |
fetchMetadata()
Gets the metadata document from the remote server.
|
protected byte[] |
getMetadataBytesFromResponse(org.apache.http.HttpResponse response)
Extracts the raw metadata bytes from the response taking in to account possible deflate and GZip compression.
|
protected String |
getMetadataIdentifier()
Gets an identifier which may be used to distinguish this metadata in logging statements.
|
String |
getMetadataURI()
Gets the URL to fetch the metadata.
|
protected void |
processConditionalRetrievalHeaders(org.apache.http.HttpResponse response)
Records the ETag and Last-Modified headers, from the response, if they are present.
|
void |
setBasicCredentials(UsernamePasswordCredentials credentials)
Sets the username and password used to access the metadata URL.
|
void |
setBasicCredentialsWithScope(UsernamePasswordCredentials credentials,
AuthScope scope)
Sets the username and password used to access the metadata URL.
|
void |
setTLSTrustEngine(org.opensaml.security.trust.TrustEngine<? super org.opensaml.security.x509.X509Credential> engine)
Sets the optional trust engine used in evaluating server TLS credentials.
|
computeNextRefreshDelay, getExpirationTime, getLastRefresh, getLastUpdate, getMaxRefreshDelay, getMinRefreshDelay, getNextRefresh, getRefreshDelayFactor, initMetadataResolver, inputstreamToByteArray, postProcessMetadata, processCachedMetadata, processNewMetadata, processNonExpiredMetadata, processPreExpiredMetadata, refresh, setCacheSourceMetadata, setMaxRefreshDelay, setMinRefreshDelay, setRefreshDelayFactor, unmarshallMetadatacreateNewBackingStore, getBackingStore, getCachedFilteredMetadata, getCachedOriginalMetadata, isCacheSourceMetadata, iterator, preProcessNewMetadata, resolvedoInitialize, filterMetadata, getMetadataFilter, getParserPool, getUnmarshallerFactory, indexEntityDescriptor, isFailFastInitialization, isRequireValidMetadata, isValid, lookupEntityID, lookupIndexedEntityID, preProcessEntitiesDescriptor, preProcessEntityDescriptor, releaseMetadataDOM, removeByEntityID, resolveSingle, setBackingStore, setFailFastInitialization, setMetadataFilter, setParserPool, setRequireValidMetadata, unmarshallMetadatasetIdgetIddestroy, initialize, isDestroyed, isInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMetadataFilter, isRequireValidMetadata, setMetadataFilter, setRequireValidMetadataprivate final Logger log
private HttpClient httpClient
private URI metadataURI
private String cachedMetadataETag
private String cachedMetadataLastModified
private BasicCredentialsProvider credentialsProvider
private org.opensaml.security.trust.TrustEngine<? super org.opensaml.security.x509.X509Credential> tlsTrustEngine
public HTTPMetadataResolver(HttpClient client, String metadataURL) throws net.shibboleth.utilities.java.support.resolver.ResolverException
client - HTTP client used to pull in remote metadatametadataURL - URL to the remove remote metadatanet.shibboleth.utilities.java.support.resolver.ResolverException - thrown if the HTTP client is null or the metadata URL provided is invalidpublic HTTPMetadataResolver(Timer backgroundTaskTimer, HttpClient client, String metadataURL) throws net.shibboleth.utilities.java.support.resolver.ResolverException
backgroundTaskTimer - timer used to schedule background metadata refresh tasksclient - HTTP client used to pull in remote metadatametadataURL - URL to the remove remote metadatanet.shibboleth.utilities.java.support.resolver.ResolverException - thrown if the HTTP client is null or the metadata URL provided is invalidpublic String getMetadataURI()
public void setTLSTrustEngine(@Nullable org.opensaml.security.trust.TrustEngine<? super org.opensaml.security.x509.X509Credential> engine)
Must be used in conjunction with an HttpClient instance which is configured with a
TrustEngineTLSSocketFactory. If this socket
factory is not configured, then this will result in no TLS trust evaluation being performed
and a ResolverException will ultimately be thrown.
engine - the trust engine instance to usepublic void setBasicCredentials(@Nullable UsernamePasswordCredentials credentials)
AuthScope will be generated based off the metadata URI's hostname and port.credentials - the username and password credentialspublic void setBasicCredentialsWithScope(@Nullable UsernamePasswordCredentials credentials, @Nullable AuthScope scope)
If the authScope is null, an AuthScope will be generated based off the metadata URI's
hostname and port.
credentials - the username and password credentialsscope - the HTTP client auth scope with which to scope the credentials, may be nullprotected void doDestroy()
doDestroy in class AbstractReloadingMetadataResolverprotected String getMetadataIdentifier()
getMetadataIdentifier in class AbstractReloadingMetadataResolverprotected byte[] fetchMetadata()
throws net.shibboleth.utilities.java.support.resolver.ResolverException
fetchMetadata in class AbstractReloadingMetadataResolvernet.shibboleth.utilities.java.support.resolver.ResolverException - thrown if there is a problem retrieving the metadata from the remote serverprotected void checkTLSCredentialTrusted(HttpClientContext context) throws SSLPeerUnverifiedException
context - the current HTTP context instance in useSSLPeerUnverifiedException - thrown if the TLS credential was not actually evaluated by the trust engineprotected HttpGet buildHttpGet()
HttpGet instance used to fetch the metadata. The returned method advertises support for GZIP
and deflate compression, enables conditional GETs if the cached metadata came with either an ETag or
Last-Modified information, and sets up basic authentication if such is configured.protected HttpClientContext buildHttpClientContext()
HttpClientContext instance which will be used to invoke the HttpClient request.HttpClientContextprotected void processConditionalRetrievalHeaders(org.apache.http.HttpResponse response)
response - GetMethod containing a valid HTTP responseprotected byte[] getMetadataBytesFromResponse(org.apache.http.HttpResponse response)
throws net.shibboleth.utilities.java.support.resolver.ResolverException
response - GetMethod containing a valid HTTP responsenet.shibboleth.utilities.java.support.resolver.ResolverException - thrown if there is a problem getting the raw metadata bytes from the responseCopyright © 1999–2015. All rights reserved.