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 |
---|---|
private CredentialsProvider |
credentialsProvider
HttpClient credentials provider.
|
static String[] |
DEFAULT_CONTENT_TYPES
Default list of supported content MIME types.
|
private HttpClient |
httpClient
HTTP Client used to pull the metadata.
|
private Logger |
log
Class logger.
|
private ResponseHandler<org.opensaml.core.xml.XMLObject> |
responseHandler
HttpClient ResponseHandler instance to use.
|
private List<String> |
supportedContentTypes
List of supported MIME types for use in Accept request header and validation of
response Content-Type header.
|
private String |
supportedContentTypesValue
Generated Accept request header value.
|
private org.opensaml.security.trust.TrustEngine<? super org.opensaml.security.x509.X509Credential> |
tlsTrustEngine
Optional trust engine used in evaluating server TLS credentials.
|
Constructor and Description |
---|
AbstractDynamicHTTPMetadataResolver(HttpClient client)
Constructor.
|
AbstractDynamicHTTPMetadataResolver(Timer backgroundTaskTimer,
HttpClient client)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected HttpClientContext |
buildHttpClientContext()
Build the
HttpClientContext instance which will be used to invoke the HttpClient request. |
protected 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(HttpClientContext context,
HttpUriRequest request)
Check that trust engine evaluation of the server TLS credential was actually performed.
|
protected void |
doDestroy() |
protected org.opensaml.core.xml.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(UsernamePasswordCredentials credentials)
A convenience method to set a (single) username and password used to access metadata.
|
void |
setBasicCredentialsWithScope(UsernamePasswordCredentials credentials,
AuthScope scope)
A convenience method to set a (single) username and password used to access metadata.
|
void |
setCredentialsProvider(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(org.opensaml.security.trust.TrustEngine<? super org.opensaml.security.x509.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
@Nonnull private HttpClient httpClient
private List<String> supportedContentTypes
private String supportedContentTypesValue
private ResponseHandler<org.opensaml.core.xml.XMLObject> responseHandler
private CredentialsProvider credentialsProvider
private org.opensaml.security.trust.TrustEngine<? super org.opensaml.security.x509.X509Credential> tlsTrustEngine
public AbstractDynamicHTTPMetadataResolver(@Nonnull HttpClient client)
client
- the instance of HttpClient
used to fetch remote metadatapublic AbstractDynamicHTTPMetadataResolver(@Nullable Timer backgroundTaskTimer, @Nonnull 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 org.opensaml.security.trust.TrustEngine<? super org.opensaml.security.x509.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 CredentialsProvider provider)
CredentialsProvider
used for authentication by the HttpClient instance.provider
- the credentials providerpublic void setBasicCredentials(@Nullable 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 UsernamePasswordCredentials credentials, @Nullable 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 org.opensaml.core.xml.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(HttpClientContext context, 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 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 HttpClientContext buildHttpClientContext()
HttpClientContext
instance which will be used to invoke the HttpClient
request.HttpClientContext
Copyright © 1999–2015 JBoss by Red Hat. All rights reserved.