Class AbstractDynamicHTTPFetchingStrategy<MetadataType>
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.oidc.metadata.impl.AbstractDynamicHTTPFetchingStrategy<MetadataType>
- Type Parameters:
MetadataType- the metadata type.
- All Implemented Interfaces:
Function<CriteriaSet,,MetadataType> Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent
- Direct Known Subclasses:
HTTPProviderConfigurationFetchingStrategy,MetadataPolicyViaLocationFetchingStrategy
public abstract class AbstractDynamicHTTPFetchingStrategy<MetadataType>
extends AbstractIdentifiableInitializableComponent
implements Function<CriteriaSet,MetadataType>
Abstract strategy for fetching metadata dynamically over HTTP.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String[]Default list of supported content MIME types.private final org.apache.hc.client5.http.classic.HttpClientHTTP Client used to pull the configuration information.private HttpClientSecurityParametersHTTP client security parameters.private final org.slf4j.LoggerClass logger.static final StringMDC attribute representing the current request URI.private final org.apache.hc.core5.http.io.HttpClientResponseHandler<MetadataType>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. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractDynamicHTTPFetchingStrategy(org.apache.hc.client5.http.classic.HttpClient client, org.apache.hc.core5.http.io.HttpClientResponseHandler<MetadataType> handler) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionapply(CriteriaSet criteria) private org.apache.hc.client5.http.protocol.HttpClientContextbuildHttpClientContext(org.apache.hc.core5.http.ClassicHttpRequest request) Build theHttpClientContextinstance which will be used to invoke theHttpClientrequest.private 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 voidGet the list of supported MIME types for use in Accept request header and validation of response Content-Type header.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 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, doDestroy, 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
getId
-
Field Details
-
MDC_ATTRIB_CURRENT_REQUEST_URI
MDC attribute representing the current request URI. Will be available during the execution of the configuredHttpClientResponseHandler. -
DEFAULT_CONTENT_TYPES
Default list of supported content MIME types. -
log
@Nonnull private final org.slf4j.Logger logClass logger. -
httpClient
@Nonnull private final org.apache.hc.client5.http.classic.HttpClient httpClientHTTP Client used to pull the configuration information. -
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. -
httpClientSecurityParameters
HTTP client security parameters. -
responseHandler
@Nonnull private final org.apache.hc.core5.http.io.HttpClientResponseHandler<MetadataType> responseHandlerHttpClient ResponseHandler instance to use.
-
-
Constructor Details
-
AbstractDynamicHTTPFetchingStrategy
protected AbstractDynamicHTTPFetchingStrategy(@Nonnull org.apache.hc.client5.http.classic.HttpClient client, @Nonnull org.apache.hc.core5.http.io.HttpClientResponseHandler<MetadataType> handler) Constructor.- Parameters:
client- the instance ofHttpClientused to fetch remote OIDC metadatahandler- the response handler used to convert the HTTP response to the metadata type.
-
-
Method Details
-
doInitialize
- Overrides:
doInitializein classAbstractIdentifiedInitializableComponent- Throws:
ComponentInitializationException
-
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
-
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
-
buildHttpClientContext
@Nonnull private 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
-