Class AbstractDynamicHTTPMetadataResolver
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
org.opensaml.saml.metadata.resolver.impl.AbstractMetadataResolver
org.opensaml.saml.metadata.resolver.impl.AbstractDynamicMetadataResolver
org.opensaml.saml.metadata.resolver.impl.AbstractDynamicHTTPMetadataResolver
- All Implemented Interfaces:
Component
,DestructableComponent
,IdentifiableComponent
,IdentifiedComponent
,InitializableComponent
,Resolver<EntityDescriptor,
,CriteriaSet> ClearableMetadataResolver
,DynamicMetadataResolver
,MetadataResolver
- Direct Known Subclasses:
FunctionDrivenDynamicHTTPMetadataResolver
Abstract subclass for dynamic metadata resolvers that implement metadata resolution based on HTTP requests.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Basic HttpClient response handler for processing metadata fetch requests.Nested classes/interfaces inherited from class org.opensaml.saml.metadata.resolver.impl.AbstractDynamicMetadataResolver
AbstractDynamicMetadataResolver.BackingStoreCleanupSweeper, AbstractDynamicMetadataResolver.DefaultCacheKeyGenerator, AbstractDynamicMetadataResolver.DynamicEntityBackingStore, AbstractDynamicMetadataResolver.EntityManagementData, AbstractDynamicMetadataResolver.PersistentCacheInitializationMetrics
Nested classes/interfaces inherited from class org.opensaml.saml.metadata.resolver.impl.AbstractMetadataResolver
AbstractMetadataResolver.EntityBackingStore
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]
Default list of supported content MIME types.private org.apache.http.client.HttpClient
HTTP Client used to pull the metadata.private HttpClientSecurityParameters
Optional HttpClient security parameters.private final org.slf4j.Logger
Class logger.static final String
MDC attribute representing the current request URI.private org.apache.http.client.ResponseHandler<XMLObject>
HttpClient ResponseHandler instance to use.List of supported MIME types for use in Accept request header and validation of response Content-Type header.private String
Generated Accept request header value.SupportedMediaType
instances, constructed from thesupportedContentTypes
list.Fields inherited from class org.opensaml.saml.metadata.resolver.impl.AbstractDynamicMetadataResolver
METRIC_GAUGE_NUM_LIVE_ENTITYIDS, METRIC_GAUGE_PERSISTENT_CACHE_INIT, METRIC_RATIOGAUGE_FETCH_TO_RESOLVE, METRIC_TIMER_FETCH_FROM_ORIGIN_SOURCE, METRIC_TIMER_RESOLVE
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractDynamicHTTPMetadataResolver
(Timer backgroundTaskTimer, org.apache.http.client.HttpClient client) Constructor.AbstractDynamicHTTPMetadataResolver
(org.apache.http.client.HttpClient client) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.http.client.protocol.HttpClientContext
buildHttpClientContext
(org.apache.http.client.methods.HttpUriRequest request) Build theHttpClientContext
instance which will be used to invoke theHttpClient
request.protected org.apache.http.client.methods.HttpUriRequest
buildHttpRequest
(CriteriaSet criteria) Build an appropriate instance ofHttpUriRequest
based on the input criteria set.protected abstract String
buildRequestURL
(CriteriaSet criteria) Build the request URL based on the input criteria set.protected void
protected XMLObject
fetchFromOriginSource
(CriteriaSet criteria) Fetch the metadata from the origin source.protected HttpClientSecurityParameters
Get the instance ofHttpClientSecurityParameters
which provides various parameters to influence the security behavior of the HttpClient instance.Get the list of supported MIME types for use in Accept request header and validation of response Content-Type header.Get the list of supported MIMEMediaType
instances used in validation of the response Content-Type header.protected void
Subclasses should override this method to perform any initialization logic necessary.void
Set an instance ofHttpClientSecurityParameters
which provides various parameters to influence the security behavior of the HttpClient instance.void
setSupportedContentTypes
(List<String> types) Set the list of supported MIME types for use in Accept request header and validation of response Content-Type header.Methods inherited from class org.opensaml.saml.metadata.resolver.impl.AbstractDynamicMetadataResolver
clear, clear, computeExpirationTime, computeRefreshTriggerTime, createNewBackingStore, getBackgroundInitializationFromCacheDelay, getBackingStore, getCleanupTaskInterval, getExpirationWarningThreshold, getIndexes, getInitializationFromCachePredicate, getMaxCacheDuration, getMaxIdleEntityData, getMetricsBaseName, getMinCacheDuration, getNegativeLookupCacheDuration, getPersistentCacheKeyGenerator, getPersistentCacheManager, getRefreshDelayFactor, indexEntityDescriptor, indexesEnabled, initializeFromPersistentCache, isInitializeFromPersistentCacheInBackground, isPersistentCachingEnabled, isRemoveIdleEntityData, lookupCriteria, lookupEntityID, prepareForFiltering, preProcessEntityDescriptor, processNewMetadata, processNewMetadata, processNonEntityIDFetchedEntittiesDescriptor, processNonEntityIDFetchedEntityDescriptor, processPersistentCacheEntry, removeByEntityID, resolve, resolveEntityID, resolveEntityIDs, resolveFromOriginSource, resolveFromOriginSourceWithEntityID, resolveFromOriginSourceWithoutEntityID, setBackgroundInitializationFromCacheDelay, setCleanupTaskInterval, setExpirationWarningThreshold, setIndexes, setInitializationFromCachePredicate, setInitializeFromPersistentCacheInBackground, setMaxCacheDuration, setMaxIdleEntityData, setMetricsBaseName, setMinCacheDuration, setNegativeLookupCacheDuration, setPersistentCacheKeyGenerator, setPersistentCacheManager, setRefreshDelayFactor, setRemoveIdleEntityData, shouldAttemptRefresh
Methods inherited from class org.opensaml.saml.metadata.resolver.impl.AbstractMetadataResolver
doInitialize, filterMetadata, getCriterionPredicateRegistry, getLogPrefix, getMetadataFilter, getParserPool, getUnmarshallerFactory, isFailFastInitialization, isRequireValidMetadata, isSatisfyAnyPredicates, isUseDefaultPredicateRegistry, isValid, lookupIndexedEntityID, newFilterContext, predicateFilterCandidates, preProcessEntitiesDescriptor, releaseMetadataDOM, resolveSingle, setBackingStore, setCriterionPredicateRegistry, setFailFastInitialization, setMetadataFilter, setParserPool, setRequireValidMetadata, setSatisfyAnyPredicates, setUseDefaultPredicateRegistry, unmarshallMetadata
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
setId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
getId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiedComponent
getId
Methods inherited from interface org.opensaml.saml.metadata.resolver.MetadataResolver
getMetadataFilter, isRequireValidMetadata, setMetadataFilter, setRequireValidMetadata
Methods inherited from interface net.shibboleth.utilities.java.support.resolver.Resolver
resolveSingle
-
Field Details
-
DEFAULT_CONTENT_TYPES
Default list of supported content MIME types. -
MDC_ATTRIB_CURRENT_REQUEST_URI
MDC attribute representing the current request URI. Will be available during the execution of the configuredResponseHandler
. -
log
@Nonnull private final org.slf4j.Logger logClass logger. -
httpClient
@Nonnull private org.apache.http.client.HttpClient httpClientHTTP Client used to pull the metadata. -
supportedContentTypes
List of supported MIME types for use in Accept request header and validation of response Content-Type header. -
supportedContentTypesValue
Generated Accept request header value. -
supportedMediaTypes
SupportedMediaType
instances, constructed from thesupportedContentTypes
list. -
responseHandler
HttpClient ResponseHandler instance to use. -
httpClientSecurityParameters
Optional HttpClient security parameters.
-
-
Constructor Details
-
AbstractDynamicHTTPMetadataResolver
public AbstractDynamicHTTPMetadataResolver(@Nonnull org.apache.http.client.HttpClient client) Constructor.- Parameters:
client
- the instance ofHttpClient
used to fetch remote metadata
-
AbstractDynamicHTTPMetadataResolver
public AbstractDynamicHTTPMetadataResolver(@Nullable Timer backgroundTaskTimer, @Nonnull org.apache.http.client.HttpClient client) Constructor.- Parameters:
backgroundTaskTimer
- theTimer
instance used to run resolver background managment tasksclient
- the instance ofHttpClient
used to fetch remote metadata
-
-
Method Details
-
getHttpClientSecurityParameters
Get the instance ofHttpClientSecurityParameters
which provides various parameters to influence the security behavior of the HttpClient instance.- Returns:
- the parameters instance, or null
-
setHttpClientSecurityParameters
Set an instance ofHttpClientSecurityParameters
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
-
a
SecurityEnhancedTLSSocketFactory
which wraps an instance ofTLSSocketFactory
, 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.
For convenience methods for building a
TLSSocketFactory
, seeHttpClientSupport
.If the appropriate TLS socket factory is not configured and a trust engine is specified, then this will result in no TLS trust evaluation being performed and a
ResolverException
will ultimately be thrown.- Parameters:
params
- the security parameters
-
a
-
getSupportedMediaTypes
Get the list of supported MIMEMediaType
instances used in validation of the response Content-Type header.Is generated at init time from
getSupportedContentTypes()
.- Returns:
- the supported content types
-
getSupportedContentTypes
Get the list of supported MIME types for use in Accept request header and validation of response Content-Type header.- Returns:
- the supported content types
-
setSupportedContentTypes
Set the list of supported MIME types for use in Accept request header and validation of response Content-Type header. Values will be effectively lower-cased at runtime.- Parameters:
types
- the new supported content types to set
-
initMetadataResolver
Subclasses should override this method to perform any initialization logic necessary. Default implementation is a no-op.- Overrides:
initMetadataResolver
in classAbstractDynamicMetadataResolver
- Throws:
ComponentInitializationException
- thrown if there is a problem initializing the provider
-
doDestroy
protected void doDestroy()- Overrides:
doDestroy
in classAbstractDynamicMetadataResolver
-
fetchFromOriginSource
@Nullable protected XMLObject fetchFromOriginSource(@Nonnull CriteriaSet criteria) throws IOException Fetch the metadata from the origin source.- Specified by:
fetchFromOriginSource
in classAbstractDynamicMetadataResolver
- Parameters:
criteria
- the input criteria set- Returns:
- the resolved metadata root XMLObject, or null if metadata could not be fetched
- Throws:
IOException
- if there is a fatal error fetching metadata from the origin source
-
buildHttpRequest
@Nullable protected org.apache.http.client.methods.HttpUriRequest buildHttpRequest(@Nonnull CriteriaSet criteria) Build an appropriate instance ofHttpUriRequest
based on the input criteria set.- Parameters:
criteria
- the input criteria set- Returns:
- the newly constructed request, or null if it can not be built from the supplied criteria
-
buildRequestURL
Build the request URL based on the input criteria set.- Parameters:
criteria
- the input criteria set- Returns:
- the request URL, or null if it can not be built based on the supplied criteria
-
buildHttpClientContext
protected org.apache.http.client.protocol.HttpClientContext buildHttpClientContext(@Nonnull org.apache.http.client.methods.HttpUriRequest request) Build theHttpClientContext
instance which will be used to invoke theHttpClient
request.- Parameters:
request
- the current HTTP request- Returns:
- a new instance of
HttpClientContext
-