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.EntityManagementData
AbstractMetadataResolver.EntityBackingStore
Modifier and Type | Field and Description |
---|---|
static String[] |
DEFAULT_CONTENT_TYPES
Default list of supported content MIME types.
|
Constructor and Description |
---|
AbstractDynamicHTTPMetadataResolver(org.apache.http.client.HttpClient client)
Constructor.
|
AbstractDynamicHTTPMetadataResolver(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 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.
|
List<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(List<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, shouldAttemptRefresh
doInitialize, filterMetadata, getMetadataFilter, getParserPool, getUnmarshallerFactory, indexEntityDescriptor, isFailFastInitialization, isRequireValidMetadata, isValid, lookupIndexedEntityID, preProcessEntitiesDescriptor, releaseMetadataDOM, removeByEntityID, resolveSingle, setBackingStore, setFailFastInitialization, setMetadataFilter, setParserPool, setRequireValidMetadata, unmarshallMetadata
setId
getId
destroy, initialize, isDestroyed, isInitialized
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMetadataFilter, isRequireValidMetadata, setMetadataFilter, setRequireValidMetadata
public static final String[] DEFAULT_CONTENT_TYPES
public AbstractDynamicHTTPMetadataResolver(@Nonnull org.apache.http.client.HttpClient client)
client
- the instance of HttpClient
used to fetch remote metadatapublic AbstractDynamicHTTPMetadataResolver(@Nullable 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 List<String> getSupportedContentTypes()
public void setSupportedContentTypes(@Nullable List<String> types)
types
- the new supported content types to setprotected void initMetadataResolver() throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
initMetadataResolver
in class AbstractDynamicMetadataResolver
net.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 IOException
fetchFromOriginSource
in class AbstractDynamicMetadataResolver
criteria
- the input criteria setIOException
- 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 SSLPeerUnverifiedException
context
- the current HTTP context instance in userequest
- the HTTP URI requestSSLPeerUnverifiedException
- 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 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
Copyright © 2017. All rights reserved.