public abstract class AbstractDynamicHTTPMetadataResolver extends AbstractDynamicMetadataResolver
| Modifier and Type | Class and Description |
|---|---|
class |
AbstractDynamicHTTPMetadataResolver.BasicMetadataResponseHandler
Basic HttpClient response handler for processing metadata fetch requests.
|
AbstractDynamicMetadataResolver.BackingStoreCleanupSweeper, AbstractDynamicMetadataResolver.DynamicEntityBackingStore, AbstractDynamicMetadataResolver.EntityManagementDataAbstractMetadataResolver.EntityBackingStore| Modifier and Type | Field and Description |
|---|---|
private org.apache.http.client.CredentialsProvider |
credentialsProvider
HttpClient credentials provider.
|
static java.lang.String[] |
DEFAULT_CONTENT_TYPES
Default list of supported content MIME types.
|
private org.apache.http.client.HttpClient |
httpClient
HTTP Client used to pull the metadata.
|
private org.slf4j.Logger |
log
Class logger.
|
private org.apache.http.client.ResponseHandler<XMLObject> |
responseHandler
HttpClient ResponseHandler instance to use.
|
private java.util.List<java.lang.String> |
supportedContentTypes
List of supported MIME types for use in Accept request header and validation of
response Content-Type header.
|
private java.lang.String |
supportedContentTypesValue
Generated Accept request header value.
|
private TrustEngine<? super X509Credential> |
tlsTrustEngine
Optional trust engine used in evaluating server TLS credentials.
|
| Constructor and Description |
|---|
AbstractDynamicHTTPMetadataResolver(org.apache.http.client.HttpClient client)
Constructor.
|
AbstractDynamicHTTPMetadataResolver(java.util.Timer backgroundTaskTimer,
org.apache.http.client.HttpClient client)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.http.client.protocol.HttpClientContext |
buildHttpClientContext()
Build the
HttpClientContext instance which will be used to invoke the HttpClient request. |
protected org.apache.http.client.methods.HttpUriRequest |
buildHttpRequest(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
Build an appropriate instance of
HttpUriRequest based on the input criteria set. |
protected abstract java.lang.String |
buildRequestURL(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
Build the request URL based on the input criteria set.
|
protected void |
checkTLSCredentialTrusted(org.apache.http.client.protocol.HttpClientContext context,
org.apache.http.client.methods.HttpUriRequest request)
Check that trust engine evaluation of the server TLS credential was actually performed.
|
protected void |
doDestroy() |
protected XMLObject |
fetchFromOriginSource(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
Fetch the metadata from the origin source.
|
java.util.List<java.lang.String> |
getSupportedContentTypes()
Get the list of supported MIME types for use in Accept request header and validation of
response Content-Type header.
|
protected void |
initMetadataResolver()
Subclasses should override this method to perform any initialization logic necessary.
|
void |
setBasicCredentials(org.apache.http.auth.UsernamePasswordCredentials credentials)
A convenience method to set a (single) username and password used to access metadata.
|
void |
setBasicCredentialsWithScope(org.apache.http.auth.UsernamePasswordCredentials credentials,
org.apache.http.auth.AuthScope scope)
A convenience method to set a (single) username and password used to access metadata.
|
void |
setCredentialsProvider(org.apache.http.client.CredentialsProvider provider)
Set an instance of
CredentialsProvider used for authentication by the HttpClient instance. |
void |
setSupportedContentTypes(java.util.List<java.lang.String> types)
Set the list of supported MIME types for use in Accept request header and validation of
response Content-Type header.
|
void |
setTLSTrustEngine(TrustEngine<? super X509Credential> engine)
Sets the optional trust engine used in evaluating server TLS credentials.
|
computeExpirationTime, computeRefreshTriggerTime, createNewBackingStore, getBackingStore, getCleanupTaskInterval, getMaxCacheDuration, getMaxIdleEntityData, getMinCacheDuration, getRefreshDelayFactor, isRemoveIdleEntityData, lookupEntityID, preProcessEntityDescriptor, processNewMetadata, resolve, resolveFromOriginSource, setCleanupTaskInterval, setMaxCacheDuration, setMaxIdleEntityData, setMinCacheDuration, setRefreshDelayFactor, setRemoveIdleEntityData, shouldAttemptRefreshdoInitialize, filterMetadata, getMetadataFilter, getParserPool, getUnmarshallerFactory, indexEntityDescriptor, isFailFastInitialization, isRequireValidMetadata, isValid, lookupIndexedEntityID, preProcessEntitiesDescriptor, releaseMetadataDOM, removeByEntityID, resolveSingle, setBackingStore, setFailFastInitialization, setMetadataFilter, setParserPool, setRequireValidMetadata, unmarshallMetadatasetIdgetIddestroy, initialize, isDestroyed, isInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMetadataFilter, isRequireValidMetadata, setMetadataFilter, setRequireValidMetadatapublic static final java.lang.String[] DEFAULT_CONTENT_TYPES
@Nonnull private final org.slf4j.Logger log
@Nonnull private org.apache.http.client.HttpClient httpClient
private java.util.List<java.lang.String> supportedContentTypes
private java.lang.String supportedContentTypesValue
private org.apache.http.client.ResponseHandler<XMLObject> responseHandler
private org.apache.http.client.CredentialsProvider credentialsProvider
private TrustEngine<? super X509Credential> tlsTrustEngine
public AbstractDynamicHTTPMetadataResolver(@Nonnull
org.apache.http.client.HttpClient client)
client - the instance of HttpClient used to fetch remote metadatapublic AbstractDynamicHTTPMetadataResolver(@Nullable
java.util.Timer backgroundTaskTimer,
@Nonnull
org.apache.http.client.HttpClient client)
backgroundTaskTimer - the Timer instance used to run resolver background managment tasksclient - the instance of HttpClient used to fetch remote metadatapublic void setTLSTrustEngine(@Nullable
TrustEngine<? super 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 setCredentialsProvider(@Nullable
org.apache.http.client.CredentialsProvider provider)
CredentialsProvider used for authentication by the HttpClient instance.provider - the credentials providerpublic void setBasicCredentials(@Nullable
org.apache.http.auth.UsernamePasswordCredentials credentials)
An AuthScope will be generated which specifies any host, port, scheme and realm.
To specify multiple usernames and passwords for multiple host, port, scheme, and realm combinations, instead
provide an instance of CredentialsProvider via setCredentialsProvider(CredentialsProvider).
credentials - the username and password credentialspublic void setBasicCredentialsWithScope(@Nullable
org.apache.http.auth.UsernamePasswordCredentials credentials,
@Nullable
org.apache.http.auth.AuthScope scope)
If the authScope is null, an AuthScope will be generated which specifies
any host, port, scheme and realm.
To specify multiple usernames and passwords for multiple host, port, scheme, and realm combinations, instead
provide an instance of CredentialsProvider via setCredentialsProvider(CredentialsProvider).
credentials - the username and password credentialsscope - the HTTP client auth scope with which to scope the credentials, may be null@NonnullAfterInit @NotLive @Unmodifiable public java.util.List<java.lang.String> getSupportedContentTypes()
public void setSupportedContentTypes(@Nullable
java.util.List<java.lang.String> types)
types - the new supported content types to setprotected void initMetadataResolver()
throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
initMetadataResolver in class AbstractDynamicMetadataResolvernet.shibboleth.utilities.java.support.component.ComponentInitializationException - thrown if there is a problem initializing the providerprotected void doDestroy()
doDestroy in class AbstractDynamicMetadataResolver@Nullable protected XMLObject fetchFromOriginSource(@Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria) throws java.io.IOException
fetchFromOriginSource in class AbstractDynamicMetadataResolvercriteria - the input criteria setjava.io.IOException - if there is a fatal error fetching metadata from the origin sourceprotected void checkTLSCredentialTrusted(org.apache.http.client.protocol.HttpClientContext context,
org.apache.http.client.methods.HttpUriRequest request)
throws javax.net.ssl.SSLPeerUnverifiedException
context - the current HTTP context instance in userequest - the HTTP URI requestjavax.net.ssl.SSLPeerUnverifiedException - thrown if the TLS credential was not actually evaluated by the trust engine@Nullable
protected org.apache.http.client.methods.HttpUriRequest buildHttpRequest(@Nonnull
net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
HttpUriRequest based on the input criteria set.criteria - the input criteria set@Nullable
protected abstract java.lang.String buildRequestURL(@Nonnull
net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
criteria - the input criteria setprotected org.apache.http.client.protocol.HttpClientContext buildHttpClientContext()
HttpClientContext instance which will be used to invoke the HttpClient request.HttpClientContext