public class VaultClients extends Object
RestTemplate configured to the needs of
accessing Vault.VaultEndpoint,
RestTemplate| Modifier and Type | Class and Description |
|---|---|
static class |
VaultClients.PrefixAwareUriBuilderFactory |
static class |
VaultClients.PrefixAwareUriTemplateHandler |
| Constructor and Description |
|---|
VaultClients() |
| Modifier and Type | Method and Description |
|---|---|
static org.springframework.http.client.ClientHttpRequestInterceptor |
createNamespaceInterceptor(String namespace)
Create a
ClientHttpRequestInterceptor that associates each request with a
X-Vault-Namespace header if the header is not present. |
static org.springframework.web.client.RestTemplate |
createRestTemplate()
Create a
RestTemplate for Vault interaction. |
static org.springframework.web.client.RestTemplate |
createRestTemplate(VaultEndpoint endpoint,
org.springframework.http.client.ClientHttpRequestFactory requestFactory)
|
static org.springframework.web.client.RestTemplate |
createRestTemplate(VaultEndpointProvider endpointProvider,
org.springframework.http.client.ClientHttpRequestFactory requestFactory)
|
static org.springframework.web.util.UriBuilderFactory |
createUriBuilderFactory(VaultEndpointProvider endpointProvider) |
public static org.springframework.web.client.RestTemplate createRestTemplate(VaultEndpoint endpoint, org.springframework.http.client.ClientHttpRequestFactory requestFactory)
RestTemplate configured with VaultEndpoint and
ClientHttpRequestFactory. The template accepts relative URIs without a
leading slash that are expanded to use VaultEndpoint. RestTemplate
is configured with a ClientHttpRequestInterceptor to enforce serialization
to a byte array prior continuing the request. Eager serialization leads to a known
request body size that is required to send a
HttpHeaders.CONTENT_LENGTH request header.
Otherwise, Vault will deny body processing.
Requires Jackson 2 for Object-to-JSON mapping.
endpoint - must not be null.requestFactory - must not be null.RestTemplate.Netty4ClientHttpRequestFactory,
MappingJackson2HttpMessageConverterpublic static org.springframework.web.client.RestTemplate createRestTemplate(VaultEndpointProvider endpointProvider, org.springframework.http.client.ClientHttpRequestFactory requestFactory)
RestTemplate configured with VaultEndpointProvider and
ClientHttpRequestFactory. The template accepts relative URIs without a
leading slash that are expanded to use VaultEndpoint. RestTemplate
is configured with a ClientHttpRequestInterceptor to enforce serialization
to a byte array prior continuing the request. Eager serialization leads to a known
request body size that is required to send a
HttpHeaders.CONTENT_LENGTH request header.
Otherwise, Vault will deny body processing.
Requires Jackson 2 for Object-to-JSON mapping.
endpointProvider - must not be null.requestFactory - must not be null.RestTemplate.Netty4ClientHttpRequestFactory,
MappingJackson2HttpMessageConverterpublic static org.springframework.web.client.RestTemplate createRestTemplate()
RestTemplate for Vault interaction. RestTemplate is
configured with a ClientHttpRequestInterceptor to enforce serialization to
a byte array prior continuing the request. Eager serialization leads to a known
request body size that is required to send a
HttpHeaders.CONTENT_LENGTH request header.
Otherwise, Vault will deny body processing.
Requires Jackson 2 for Object-to-JSON mapping.
RestTemplate.Netty4ClientHttpRequestFactory,
MappingJackson2HttpMessageConverterpublic static org.springframework.http.client.ClientHttpRequestInterceptor createNamespaceInterceptor(String namespace)
ClientHttpRequestInterceptor that associates each request with a
X-Vault-Namespace header if the header is not present.namespace - the Vault namespace to use. Must not be null or empty.ClientHttpRequestInterceptor to register with
RestTemplate.VaultHttpHeaders.VAULT_NAMESPACEpublic static org.springframework.web.util.UriBuilderFactory createUriBuilderFactory(VaultEndpointProvider endpointProvider)
Copyright © 2016–2024 Pivotal Software, Inc.. All rights reserved.