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
Deprecated.
|
private HttpClient |
httpClient
HTTP Client used to pull the metadata.
|
private org.opensaml.security.httpclient.HttpClientSecurityParameters |
httpClientSecurityParameters
Optional HttpClient security parameters.
|
private org.slf4j.Logger |
log
Class logger.
|
private URI |
metadataURI
URL to the Metadata.
|
private org.opensaml.security.trust.TrustEngine<? super org.opensaml.security.x509.X509Credential> |
tlsTrustEngine
Deprecated.
|
| 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()
Deprecated.
|
protected HttpClientContext |
buildHttpClientContext(HttpUriRequest request)
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)
Deprecated.
use
HttpClientSecuritySupport.checkTLSCredentialEvaluated(HttpClientContext, String) |
protected void |
doDestroy() |
protected byte[] |
fetchMetadata()
Gets the metadata document from the remote server.
|
protected org.opensaml.security.httpclient.HttpClientSecurityParameters |
getHttpClientSecurityParameters()
Get the instance of
HttpClientSecurityParameters which provides various parameters to influence
the security behavior of the HttpClient instance. |
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)
Deprecated.
|
void |
setBasicCredentialsWithScope(UsernamePasswordCredentials credentials,
AuthScope scope)
Deprecated.
|
void |
setHttpClientSecurityParameters(org.opensaml.security.httpclient.HttpClientSecurityParameters params)
Set an instance of
HttpClientSecurityParameters which provides various parameters to influence
the security behavior of the HttpClient instance. |
void |
setTLSTrustEngine(org.opensaml.security.trust.TrustEngine<? super org.opensaml.security.x509.X509Credential> engine)
Deprecated.
|
computeNextRefreshDelay, getExpirationTime, getExpirationWarningThreshold, getLastRefresh, getLastSuccessfulRefresh, getLastUpdate, getMaxRefreshDelay, getMinRefreshDelay, getNextRefresh, getRefreshDelayFactor, initMetadataResolver, inputstreamToByteArray, postProcessMetadata, processCachedMetadata, processNewMetadata, processNonExpiredMetadata, processPreExpiredMetadata, refresh, setCacheSourceMetadata, setExpirationWarningThreshold, setMaxRefreshDelay, setMinRefreshDelay, setRefreshDelayFactor, unmarshallMetadata, wasLastRefreshSuccesscreateNewBackingStore, getBackingStore, getCachedFilteredMetadata, getCachedOriginalMetadata, getIndexes, getRootValidUntil, indexEntityDescriptor, isCacheSourceMetadata, isResolveViaPredicatesOnly, isRootValid, iterator, lookupByIndexes, preProcessNewMetadata, resolve, setIndexes, setResolveViaPredicatesOnlydoInitialize, filterMetadata, getCriterionPredicateRegistry, getLogPrefix, getMetadataFilter, getParserPool, getUnmarshallerFactory, isFailFastInitialization, isRequireValidMetadata, isSatisfyAnyPredicates, isUseDefaultPredicateRegistry, isValid, lookupEntityID, lookupIndexedEntityID, predicateFilterCandidates, preProcessEntitiesDescriptor, preProcessEntityDescriptor, releaseMetadataDOM, removeByEntityID, resolveSingle, setBackingStore, setCriterionPredicateRegistry, setFailFastInitialization, setMetadataFilter, setParserPool, setRequireValidMetadata, setSatisfyAnyPredicates, setUseDefaultPredicateRegistry, unmarshallMetadatasetIdgetIddestroy, initialize, isDestroyed, isInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMetadataFilter, isRequireValidMetadata, setMetadataFilter, setRequireValidMetadataresolve, resolveSinglegetIdforEach, spliteratorprivate final org.slf4j.Logger log
private HttpClient httpClient
private URI metadataURI
private String cachedMetadataETag
private String cachedMetadataLastModified
@Nullable private BasicCredentialsProvider credentialsProvider
httpClientSecurityParameters.@Nullable private org.opensaml.security.trust.TrustEngine<? super org.opensaml.security.x509.X509Credential> tlsTrustEngine
httpClientSecurityParameters.@Nullable private org.opensaml.security.httpclient.HttpClientSecurityParameters httpClientSecurityParameters
public HTTPMetadataResolver(HttpClient client, String metadataURL) throws ResolverException
client - HTTP client used to pull in remote metadatametadataURL - URL to the remove remote metadataResolverException - thrown if the HTTP client is null or the metadata URL provided is invalidpublic HTTPMetadataResolver(Timer backgroundTaskTimer, HttpClient client, String metadataURL) throws ResolverException
backgroundTaskTimer - timer used to schedule background metadata refresh tasksclient - HTTP client used to pull in remote metadatametadataURL - URL to the remove remote metadataResolverException - 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)
setHttpClientSecurityParameters(HttpClientSecurityParameters)
See TLS socket factory requirements documented for
setHttpClientSecurityParameters(HttpClientSecurityParameters).
engine - the trust engine instance to usepublic void setBasicCredentials(@Nullable UsernamePasswordCredentials credentials)
setHttpClientSecurityParameters(HttpClientSecurityParameters)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)
setHttpClientSecurityParameters(HttpClientSecurityParameters)
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 null@Nullable protected org.opensaml.security.httpclient.HttpClientSecurityParameters getHttpClientSecurityParameters()
HttpClientSecurityParameters which provides various parameters to influence
the security behavior of the HttpClient instance.public void setHttpClientSecurityParameters(@Nullable org.opensaml.security.httpclient.HttpClientSecurityParameters params)
HttpClientSecurityParameters which provides various parameters to influence
the security behavior of the HttpClient instance.
For all TLS-related parameters, must be used in conjunction with an HttpClient instance which is configured with either a:
TLSSocketFactory
SecurityEnhancedTLSSocketFactory which wraps
an instance of TLSSocketFactory, with
the latter likely configured in a "no trust" configuration. This variant is required if either a
trust engine or a client TLS credential is to be used.
TLSSocketFactory,
see HttpClientSupport.
ResolverException will ultimately be thrown.
params - the security parametersprotected void doDestroy()
doDestroy in class AbstractReloadingMetadataResolverprotected String getMetadataIdentifier()
getMetadataIdentifier in class AbstractReloadingMetadataResolverprotected byte[] fetchMetadata()
throws ResolverException
fetchMetadata in class AbstractReloadingMetadataResolverResolverException - thrown if there is a problem retrieving the metadata from the remote server@Deprecated protected void checkTLSCredentialTrusted(HttpClientContext context) throws SSLPeerUnverifiedException
HttpClientSecuritySupport.checkTLSCredentialEvaluated(HttpClientContext, String)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()
buildHttpClientContext(HttpUriRequest)HttpClientContext instance which will be used to invoke the HttpClient request.HttpClientContextprotected HttpClientContext buildHttpClientContext(@Nullable HttpUriRequest request)
HttpClientContext instance which will be used to invoke the HttpClient request.request - the current HTTP requestHttpClientContextprotected void processConditionalRetrievalHeaders(org.apache.http.HttpResponse response)
response - GetMethod containing a valid HTTP responseprotected byte[] getMetadataBytesFromResponse(org.apache.http.HttpResponse response)
throws ResolverException
response - GetMethod containing a valid HTTP responseResolverException - thrown if there is a problem getting the raw metadata bytes from the responseCopyright © 1999–2019 Shibboleth Consortium. All rights reserved.