Class AbstractDynamicHTTPMetadataResolver
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.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 TypeClassDescriptionclassBasic 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.PersistentCacheInitializationMetricsNested 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.hc.client5.http.classic.HttpClientHTTP Client used to pull the metadata.private HttpClientSecurityParametersOptional HttpClient security parameters.private final org.slf4j.LoggerClass logger.static final StringMDC attribute representing the current request URI.private org.apache.hc.core5.http.io.HttpClientResponseHandler<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 StringGenerated Accept request header value.SupportedMediaTypeinstances, constructed from thesupportedContentTypeslist.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.hc.client5.http.classic.HttpClient client) Constructor.AbstractDynamicHTTPMetadataResolver(org.apache.hc.client5.http.classic.HttpClient client) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.hc.client5.http.protocol.HttpClientContextbuildHttpClientContext(org.apache.hc.core5.http.ClassicHttpRequest request) Build theHttpClientContextinstance which will be used to invoke theHttpClientrequest.protected org.apache.hc.core5.http.ClassicHttpRequestbuildHttpRequest(CriteriaSet criteria) Build an appropriate instance ofClassicHttpRequestbased on the input criteria set.protected abstract StringbuildRequestURL(CriteriaSet criteria) Build the request URL based on the input criteria set.protected voidprotected XMLObjectfetchFromOriginSource(CriteriaSet criteria) Fetch the metadata from the origin source.protected HttpClientSecurityParametersGet the instance ofHttpClientSecurityParameterswhich 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 MIMEMediaTypeinstances used in validation of the response Content-Type header.protected voidSubclasses should override this method to perform any initialization logic necessary.voidSet an instance ofHttpClientSecurityParameterswhich provides various parameters to influence the security behavior of the HttpClient instance.voidsetSupportedContentTypes(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, doResolve, ensureBackingStore, ensurePersistentCacheManager, getBackgroundInitializationFromCacheDelay, getBackingStore, getCleanupTaskInterval, getExpirationWarningThreshold, getIndexes, getInitializationFromCachePredicate, getMaxCacheDuration, getMaxIdleEntityData, getMinCacheDuration, getNegativeLookupCacheDuration, getPersistentCacheKeyGenerator, getPersistentCacheManager, getRefreshDelayFactor, indexEntityDescriptor, indexesEnabled, initializeFromPersistentCache, isInitializeFromPersistentCacheInBackground, isPersistentCachingEnabled, isRemoveIdleEntityData, lookupCriteria, lookupEntityID, prepareForFiltering, preProcessEntityDescriptor, processNewMetadata, processNewMetadata, processNonEntityIDFetchedEntittiesDescriptor, processNonEntityIDFetchedEntityDescriptor, processPersistentCacheEntry, removeByEntityID, resolveEntityID, resolveEntityIDs, resolveFromOriginSource, resolveFromOriginSourceWithEntityID, resolveFromOriginSourceWithoutEntityID, setBackgroundInitializationFromCacheDelay, setCleanupTaskInterval, setExpirationWarningThreshold, setIndexes, setInitializationFromCachePredicate, setInitializeFromPersistentCacheInBackground, setMaxCacheDuration, setMaxIdleEntityData, setMinCacheDuration, setNegativeLookupCacheDuration, setPersistentCacheKeyGenerator, setPersistentCacheManager, setRefreshDelayFactor, setRemoveIdleEntityData, shouldAttemptRefreshMethods inherited from class org.opensaml.saml.metadata.resolver.impl.AbstractMetadataResolver
doInitialize, filterMetadata, getActivationCondition, getCriterionPredicateRegistry, getLogPrefix, getMetadataFilter, getMetricsBaseName, getParserPool, getType, getUnmarshallerFactory, isFailFastInitialization, isRequireValidMetadata, isSatisfyAnyPredicates, isUseDefaultPredicateRegistry, isValid, lookupIndexedEntityID, newFilterContext, predicateFilterCandidates, preProcessEntitiesDescriptor, releaseMetadataDOM, resolve, resolveSingle, setActivationCondition, setBackingStore, setCriterionPredicateRegistry, setFailFastInitialization, setMetadataFilter, setMetricsBaseName, setParserPool, setRequireValidMetadata, setSatisfyAnyPredicates, setType, setUseDefaultPredicateRegistry, unmarshallMetadataMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getIdMethods inherited from interface org.opensaml.saml.metadata.resolver.MetadataResolver
getMetadataFilter, getType, isRequireValidMetadata, setMetadataFilter, setRequireValidMetadataMethods inherited from interface net.shibboleth.shared.resolver.Resolver
resolve, 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 configuredHttpClientResponseHandler. -
log
@Nonnull private final org.slf4j.Logger logClass logger. -
httpClient
HTTP 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
SupportedMediaTypeinstances, constructed from thesupportedContentTypeslist. -
responseHandler
HttpClient ResponseHandler instance to use. -
httpClientSecurityParameters
Optional HttpClient security parameters.
-
-
Constructor Details
-
AbstractDynamicHTTPMetadataResolver
public AbstractDynamicHTTPMetadataResolver(@Nonnull org.apache.hc.client5.http.classic.HttpClient client) Constructor.- Parameters:
client- the instance ofHttpClientused to fetch remote metadata
-
AbstractDynamicHTTPMetadataResolver
public AbstractDynamicHTTPMetadataResolver(@Nullable Timer backgroundTaskTimer, @Nonnull org.apache.hc.client5.http.classic.HttpClient client) Constructor.- Parameters:
backgroundTaskTimer- theTimerinstance used to run resolver background managment tasksclient- the instance ofHttpClientused to fetch remote metadata
-
-
Method Details
-
getHttpClientSecurityParameters
Get the instance ofHttpClientSecurityParameterswhich provides various parameters to influence the security behavior of the HttpClient instance.- Returns:
- the parameters instance, or null
-
setHttpClientSecurityParameters
Set an instance ofHttpClientSecurityParameterswhich 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
SecurityEnhancedTLSSocketFactorywhich 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
ResolverExceptionwill ultimately be thrown.- Parameters:
params- the security parameters
-
a
-
getSupportedMediaTypes
Get the list of supported MIMEMediaTypeinstances 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:
initMetadataResolverin classAbstractDynamicMetadataResolver- Throws:
ComponentInitializationException- thrown if there is a problem initializing the provider
-
doDestroy
protected void doDestroy()- Overrides:
doDestroyin classAbstractDynamicMetadataResolver
-
buildHttpClientContext
@Nonnull protected org.apache.hc.client5.http.protocol.HttpClientContext buildHttpClientContext(@Nonnull org.apache.hc.core5.http.ClassicHttpRequest request) Build theHttpClientContextinstance which will be used to invoke theHttpClientrequest.- Parameters:
request- the current HTTP request- Returns:
- a new instance of
HttpClientContext
-