@Configuration(proxyBeanMethods=false) public abstract class AbstractVaultConfiguration extends Object implements ApplicationContextAware
Modifier and Type | Class and Description |
---|---|
static class |
AbstractVaultConfiguration.ClientFactoryWrapper
Wrapper for
ClientHttpRequestFactory to not expose the bean globally. |
static class |
AbstractVaultConfiguration.TaskSchedulerWrapper
Wrapper to keep
ThreadPoolTaskScheduler local to Spring Vault and to not
expose the bean globally. |
Constructor and Description |
---|
AbstractVaultConfiguration() |
public abstract VaultEndpoint vaultEndpoint()
public VaultEndpointProvider vaultEndpointProvider()
VaultEndpointProvider
returning the value of
vaultEndpoint()
.public abstract ClientAuthentication clientAuthentication()
Bean
in case you want to expose a
ClientAuthentication
instance to the
ApplicationContext
.ClientAuthentication
to use. Must not be null.protected RestTemplateBuilder restTemplateBuilder(VaultEndpointProvider endpointProvider, ClientHttpRequestFactory requestFactory)
RestTemplateBuilder
initialized with VaultEndpointProvider
and ClientHttpRequestFactory
. May be overridden by subclasses.RestTemplateBuilder
.vaultEndpointProvider()
,
clientHttpRequestFactoryWrapper()
@Bean public RestTemplateFactory restTemplateFactory(AbstractVaultConfiguration.ClientFactoryWrapper requestFactoryWrapper)
RestTemplateFactory
bean that is used to produce
RestTemplate
.RestTemplateFactory
.vaultEndpointProvider()
,
clientHttpRequestFactoryWrapper()
@Bean public VaultTemplate vaultTemplate()
VaultTemplate
.VaultTemplate
.vaultEndpointProvider()
,
clientHttpRequestFactoryWrapper()
,
sessionManager()
@Bean public SessionManager sessionManager()
LifecycleAwareSessionManager
using
clientAuthentication()
. This SessionManager
uses
threadPoolTaskScheduler()
.SessionManager
for Vault session management.SessionManager
,
LifecycleAwareSessionManager
,
restOperations()
,
clientAuthentication()
,
()
@Bean public SecretLeaseContainer secretLeaseContainer() throws Exception
SecretLeaseContainer
to allocate, renew and rotate secrets and
their leases.Exception
vaultTemplate()
,
threadPoolTaskScheduler()
@Bean(value="vaultThreadPoolTaskScheduler") public AbstractVaultConfiguration.TaskSchedulerWrapper threadPoolTaskScheduler()
AbstractVaultConfiguration.TaskSchedulerWrapper
used by LifecycleAwareSessionManager
and SecretLeaseContainer
wrapping
ThreadPoolTaskScheduler
. Subclasses may override this method to reuse a
different/existing scheduler.AbstractVaultConfiguration.TaskSchedulerWrapper
to use. Must not be null.AbstractVaultConfiguration.TaskSchedulerWrapper.fromInstance(ThreadPoolTaskScheduler)
public RestOperations restOperations()
RestOperations
object configured for Vault session management
and authentication usage. Can be customized by providing a
RestTemplateFactory
bean.RestOperations
to be used for Vault access.restTemplateFactory(ClientFactoryWrapper)
@Bean public AbstractVaultConfiguration.ClientFactoryWrapper clientHttpRequestFactoryWrapper()
AbstractVaultConfiguration.ClientFactoryWrapper
containing a ClientHttpRequestFactory
. ClientHttpRequestFactory
is not exposed as root bean because
ClientHttpRequestFactory
is configured with ClientOptions
and
SslConfiguration
which are not necessarily applicable for the whole
application.AbstractVaultConfiguration.ClientFactoryWrapper
to wrap a ClientHttpRequestFactory
instance.clientOptions()
,
sslConfiguration()
public ClientOptions clientOptions()
ClientOptions
to configure communication parameters.ClientOptions
public SslConfiguration sslConfiguration()
SslConfiguration.unconfigured()
.SslConfiguration
,
SslConfiguration.unconfigured()
protected Environment getEnvironment()
Environment
to access property sources during Spring Vault
bootstrapping. Requires ApplicationContext
to be set.Environment
to access property sources during Spring Vault
bootstrapping.public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
protected RestTemplateFactory getRestTemplateFactory()
RestTemplateFactory
.RestTemplateFactory
bean.protected ThreadPoolTaskScheduler getVaultThreadPoolTaskScheduler()
protected BeanFactory getBeanFactory()
Copyright © 2016–2022 Pivotal Software, Inc.. All rights reserved.