Package net.shibboleth.spring.http

# Class HTTPResourceFactoryBean

java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<HTTPResource>
net.shibboleth.spring.http.HTTPResourceFactoryBean

All Implemented Interfaces:
  `Aware`, `BeanClassLoaderAware`, `BeanFactoryAware`, `DisposableBean`, `FactoryBean<HTTPResource>`, `InitializingBean`

public class HTTPResourceFactoryBean extends AbstractFactoryBean<HTTPResource>
Factory bean for simple use cases that auto-configure PKIX or key pinning for an `HTTPResource`.

Since:
  3.4.0

## Field Summary

Fields
Modifier and Type
Field
Description
`private String`
`backingResource`
Backing file path.
`private List<Resource>`
`certificateResources`
The resources to be turned into certificates.
`private org.apache.hc.client5.http.classic.HttpClient`
`httpClient`
HTTP Client used to pull the resource.
`private HttpClientContextHandler`
`httpClientContextHandler`
Optional handler to pre- and post-process context.
`private List<Resource>`
`keyResources`
The resources to be turned into keys.
`private org.slf4j.Logger`
`log`
Class logger.
`private URL`
`resourceURL`
URL to the Resource.
`private boolean`
`usePKIX`
Use a PKIX trust engine.
`private Integer`
`verifyDepth`
PKIX verify depth.

### Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

`logger`

### Fields inherited from interface org.springframework.beans.factory.FactoryBean

`OBJECT_TYPE_ATTRIBUTE`

## Constructor Summary

Constructors
Constructor
Description
`HTTPResourceFactoryBean()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected HTTPResource`
`createInstance()`
`protected List<X509Certificate>`
`getCertificates()`
Get the configured certificates in their native form.
`protected List<Credential>`
`getCredentials()`
Get the configured keys and certificates lumped together as credentials.
`Class<?>`
`getObjectType()`
`void`
`setBackingResource(String resource)`
Set the backing resource.
`void`
`setCertificates(List<Resource> certs)`
Set the resources which we will convert into certificates.
`void`
`setHttpClient(org.apache.hc.client5.http.classic.HttpClient client)`
Set the `HttpClient` instance.
`void`
`setHttpClientContextHandler(HttpClientContextHandler handler)`
Set a handler to manipulate the `HttpClientContext`.
`void`
`setPublicKeys(List<Resource> keys)`
Set the resources which we will convert into certificates.
`void`
`setURL(URL url)`
Set the URL.
`void`
`setUsePKIX(boolean flag)`
Set whether to use a PKIX trust engine.
`void`
`setVerifyDepth(Integer depth)`
Set the verify depth.

### Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

`afterPropertiesSet, destroy, destroyInstance, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### log

@Nonnull private org.slf4j.Logger log
Class logger.

### backingResource

@Nullable private String backingResource
Backing file path.

### httpClient

@Nullable private org.apache.hc.client5.http.classic.HttpClient httpClient
HTTP Client used to pull the resource.

### resourceURL

@Nullable private URL resourceURL
URL to the Resource.

### httpClientContextHandler

@Nullable private HttpClientContextHandler httpClientContextHandler
Optional handler to pre- and post-process context.

### keyResources

@Nonnull private List<Resource> keyResources
The resources to be turned into keys.

### certificateResources

@Nonnull private List<Resource> certificateResources
The resources to be turned into certificates.

### usePKIX

private boolean usePKIX
Use a PKIX trust engine.

### verifyDepth

@Nullable private Integer verifyDepth
PKIX verify depth.

## Constructor Details

### HTTPResourceFactoryBean

public HTTPResourceFactoryBean()
Constructor.

## Method Details

### setURL

public void setURL(@Nullable URL url)
Set the URL.

Parameters:
  `url` - the URL

### setBackingResource

public void setBackingResource(@Nullable @NotEmpty String resource)
Set the backing resource.

Parameters:
  `resource` - the backing resource

### setHttpClient

public void setHttpClient(@Nullable org.apache.hc.client5.http.classic.HttpClient client)
Set the `HttpClient` instance.

Parameters:
  `client` - client instance

### setHttpClientContextHandler

public void setHttpClientContextHandler(@Nullable HttpClientContextHandler handler)
Set a handler to manipulate the `HttpClientContext`.

Parameters:
  `handler` - the handler to install

### setPublicKeys

public void setPublicKeys(@Nullable List<Resource> keys)
Set the resources which we will convert into certificates.

Parameters:
  `keys` - the resources

### setCertificates

public void setCertificates(@Nullable List<Resource> certs)
Set the resources which we will convert into certificates.

Parameters:
  `certs` - the resources

### setUsePKIX

public void setUsePKIX(boolean flag)
Set whether to use a PKIX trust engine.

Parameters:
  `flag` - flag to set

### setVerifyDepth

public void setVerifyDepth(@Nullable Integer depth)
Set the verify depth.

Parameters:
  `depth` - value to set

### getCredentials

@Nonnull @Unmodifiable @NotLive protected List<Credential> getCredentials()
Get the configured keys and certificates lumped together as credentials.

Returns:
  the certificates null

### getCertificates

@Nonnull @Unmodifiable @NotLive protected List<X509Certificate> getCertificates()
Get the configured certificates in their native form.

Returns:
  the certificates

### getObjectType

public Class<?> getObjectType()

Specified by:
  `getObjectType` in interface `FactoryBean<HTTPResource>`
Specified by:
  `getObjectType` in class `AbstractFactoryBean<HTTPResource>`

### createInstance

@Nonnull protected HTTPResource createInstance() throws Exception

Specified by:
  `createInstance` in class `AbstractFactoryBean<HTTPResource>`
Throws:
  `Exception`