You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vault's tokens can be associated with a time to live. Tokens obtained by an authentication method
981
981
are intended to be used as long as the session is active and should not expire while the application is active.
982
982
983
-
Spring Vault provides with {self-docs-root}api/org/springframework/vault/authentication/LifecycleAwareSessionManager.html[`LifecycleAwareSessionManager`] a session manager that can renew the token until it reaches its terminal TTL to then perform another login to obtain the next token which is associated with the session.
983
+
Spring Vault provides with javadoc:org.springframework.vault.authentication.LifecycleAwareSessionManager[] a session manager that can renew the token until it reaches its terminal TTL to then perform another login to obtain the next token which is associated with the session.
984
984
985
985
Depending on the authentication method, a login can create two kinds of tokens:
986
986
987
-
* {self-docs-root}api/org/springframework/vault/support/VaultToken.html[`VaultToken`]: Generic token encapsulating the actual token.
988
-
* {self-docs-root}api/org/springframework/vault/authentication/LoginToken.html[`LoginToken`]: Token associated with renewability/TTL.
987
+
* javadoc:org.springframework.vault.support.VaultToken[]: Generic token encapsulating the actual token.
988
+
* javadoc:org.springframework.vault.authentication.LoginToken[]: Token associated with renewability/TTL.
989
989
990
-
Authentication methods such as {self-docs-root}api/org/springframework/vault/authentication/TokenAuthentication.html[`TokenAuthentication`] just create a `VaultToken` which does not carry any renewability/TTL details. `LifecycleAwareSessionManager` will run a self-lookup on the token to retrieve renewability and TTL from Vault.
990
+
Authentication methods such as javadoc:org.springframework.vault.authentication.TokenAuthentication[] just create a `VaultToken` which does not carry any renewability/TTL details. javadoc:org.springframework.vault.authentication.LifecycleAwareSessionManager[] will run a self-lookup on the token to retrieve renewability and TTL from Vault.
991
991
`VaultToken` are renewed periodically if self-lookup is enabled. Note that `VaultToken` are never revoked, only `LoginToken` are revoked.
992
992
993
993
Authentication methods creating `LoginToken` directly (all login-based authentication methods) already provide all necessary details to setup token renewal. Tokens obtained from a login are revoked by `LifecycleAwareSessionManager` if the session manager is shut down.
<4> Configuring only key store settings with providing a key-configuration.
129
129
====
130
130
131
-
Please note that providing `SslConfiguration` can be only applied when either Apache Http Components or the OkHttp client is on your class-path.
131
+
Please note that providing javadoc:org.springframework.vault.support.SslConfiguration[] can be only applied when either Apache Http Components or the OkHttp client is on your class-path.
132
132
133
133
The SSL configuration supports also PEM-encoded certificates as alternative to a Java Key Store.
In as much as possible, the methods on javadoc:org.springframework.vault.core.VaultOperations[] are named after methods
17
18
available on the Vault API to make the API familiar to existing Vault developers
18
19
who are used to the API and CLI. For example, you will find methods such as
19
20
"write", "delete", "read", and "revoke".
@@ -22,8 +23,8 @@ the use of the Vault API and `VaultOperations`. A major difference in between
22
23
the two APIs is that `VaultOperations` can be passed domain objects instead of
23
24
JSON Key-Value pairs.
24
25
25
-
NOTE: The preferred way to reference the operations on `VaultTemplate` instance
26
-
is via its interface `VaultOperations`.
26
+
NOTE: The preferred way to reference the operations on javadoc:org.springframework.vault.core.VaultTemplate[] instance
27
+
is via its interface javadoc:org.springframework.vault.core.VaultOperations[].
27
28
28
29
While there are many convenience methods on `VaultTemplate` to help you easily
29
30
perform common tasks if you should need to access the Vault API directly to access
@@ -37,19 +38,20 @@ Now let's look at a examples of how to work with Vault in the context of the Spr
37
38
[[vault.core.template.beans]]
38
39
== Registering and configuring Spring Vault beans
39
40
40
-
Using Spring Vault does not require a Spring Context. However, instances of `VaultTemplate` and `SessionManager` registered inside a managed context will participate
41
+
Using Spring Vault does not require a Spring Context. However, instances of `VaultTemplate` and
42
+
javadoc:org.springframework.vault.authentication.SessionManager[] registered inside a managed context will participate
41
43
in {spring-framework-docs}core.html#beans-factory-nature[lifecycle events]
42
44
provided by the Spring IoC container. This is useful to dispose active Vault sessions upon
43
45
application shutdown. You also benefit from reusing the same `VaultTemplate`
44
46
instance across your application.
45
47
46
48
Spring Vault comes with a supporting configuration class that provides bean definitions
47
49
for use inside a Spring context. Application configuration
48
-
classes typically extend from `AbstractVaultConfiguration` and are required to
50
+
classes typically extend from javadoc:org.springframework.vault.config.AbstractVaultConfiguration[] and are required to
49
51
provide additional details that are environment specific.
50
52
51
-
Extending from `AbstractVaultConfiguration` requires to implement
52
-
`VaultEndpoint vaultEndpoint()` and `ClientAuthentication clientAuthentication()`
53
+
Extending from javadoc:org.springframework.vault.config.AbstractVaultConfiguration[] requires to implement
54
+
`VaultEndpoint vaultEndpoint()` and `ClientAuthentication clientAuthentication()`
53
55
methods.
54
56
55
57
.Registering Spring Vault objects using Java based bean metadata
@@ -78,8 +80,8 @@ public class AppConfig extends AbstractVaultConfiguration {
78
80
}
79
81
}
80
82
----
81
-
<1> Create a new `VaultEndpoint` that points by default to `\https://localhost:8200`.
82
-
<2> This sample uses `TokenAuthentication` to get started quickly.
83
+
<1> Create a new javadoc:org.springframework.vault.client.VaultEndpoint[] that points by default to `\https://localhost:8200`.
84
+
<2> This sample uses javadoc:org.springframework.vault.authentication.TokenAuthentication[] to get started quickly.
83
85
See <<vault.core.authentication>> for details on supported authentication methods.
84
86
====
85
87
@@ -111,14 +113,14 @@ public class AppConfig extends AbstractVaultConfiguration {
111
113
}
112
114
}
113
115
----
114
-
<1> `VaultEndpoint` can be constructed using various factory methods such as
116
+
<1> javadoc:org.springframework.vault.client.VaultEndpoint[] can be constructed using various factory methods such as
115
117
`from(URI uri)` or `VaultEndpoint.create(String host, int port)`.
116
118
<2> Dependencies for `ClientAuthentication` methods can be obtained either from
117
119
`AbstractVaultConfiguration` or provided by your configuration.
118
120
====
119
121
120
122
NOTE: Creating a custom configuration class might be cumbersome in some cases.
121
-
Take a look at `EnvironmentVaultConfiguration` that allows configuration by using
123
+
Take a look at javadoc:org.springframework.vault.config.EnvironmentVaultConfiguration[] that allows configuration by using
122
124
properties from existing property sources and Spring's `Environment`. Read more
123
125
in <<vault.core.environment-vault-configuration>>.
124
126
@@ -132,18 +134,20 @@ must be reused throughout a session. This aspect is handled by a
132
134
`SessionManager` implementation. A `SessionManager` decides how often it
133
135
obtains a token, about revocation and renewal. Spring Vault comes with two implementations:
134
136
135
-
* `SimpleSessionManager`: Just obtains tokens from the supplied
137
+
* javadoc:org.springframework.vault.authentication.SimpleSessionManager[]: Just obtains tokens from the supplied
136
138
`ClientAuthentication` without refresh and revocation
137
-
* `LifecycleAwareSessionManager`: This `SessionManager` schedules token
139
+
* javadoc:org.springframework.vault.authentication.LifecycleAwareSessionManager[]: This `SessionManager` schedules token
138
140
renewal if a token is renewable and revoke a login token on disposal.
139
141
Renewal is scheduled with an `AsyncTaskExecutor`. `LifecycleAwareSessionManager`
140
142
is configured by default if using `AbstractVaultConfiguration`.
141
143
142
144
[[vault.core.environment-vault-configuration]]
143
145
== Using `EnvironmentVaultConfiguration`
144
146
145
-
Spring Vault includes `EnvironmentVaultConfiguration` configure the Vault client from Spring's `Environment` and a set of predefined
146
-
property keys. `EnvironmentVaultConfiguration` supports frequently applied configurations. Other configurations are supported by deriving from the most appropriate configuration class. Include `EnvironmentVaultConfiguration` with `@Import(EnvironmentVaultConfiguration.class)` to existing
147
+
Spring Vault includes javadoc:org.springframework.vault.config.EnvironmentVaultConfiguration[] configure the Vault client from Spring's `Environment` and a set of predefined
148
+
property keys.
149
+
javadoc:org.springframework.vault.config.EnvironmentVaultConfiguration[] supports frequently applied configurations. Other configurations are supported by deriving from the most appropriate configuration class.
150
+
Include javadoc:org.springframework.vault.config.EnvironmentVaultConfiguration[] with `@Import(EnvironmentVaultConfiguration.class)` to existing
147
151
Java-based configuration classes and supply configuration properties through any of Spring's ``PropertySource``s.
148
152
149
153
.Using EnvironmentVaultConfiguration with a property file
@@ -238,7 +242,7 @@ One common design feature of all Spring template classes is that all functionali
238
242
This helps ensure that exceptions and any resource management that maybe required are performed consistency.
239
243
While this was of much greater need in the case of JDBC and JMS than with Vault, it still offers a single spot for access and logging to occur.
240
244
As such, using the execute callback is the preferred way to access the Vault API
241
-
to perform uncommon operations that we've not exposed as methods on `VaultTemplate`.
245
+
to perform uncommon operations that we've not exposed as methods on javadoc:org.springframework.vault.core.VaultTemplate[].
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/vault/propertysource.adoc
+3-3
Original file line number
Diff line number
Diff line change
@@ -5,14 +5,14 @@ Vault can be used in many different ways. One specific use-case is using
5
5
Vault to store encrypted properties. Spring Vault supports Vault as property
6
6
source to obtain configuration properties using Spring's {spring-framework-docs}core.html#beans-property-source-abstraction[PropertySource abstraction].
7
7
8
-
NOTE: You can reference properties stored inside Vault in other property sources or use value injection with `@Value(…)`. Special attention is required when bootstrapping beans that require data stored inside of Vault. A `VaultPropertySource` must be initialized at that time to retrieve properties from Vault.
8
+
NOTE: You can reference properties stored inside Vault in other property sources or use value injection with `@Value(…)`. Special attention is required when bootstrapping beans that require data stored inside of Vault. A javadoc:org.springframework.vault.core.env.VaultPropertySource[] must be initialized at that time to retrieve properties from Vault.
9
9
10
10
NOTE: Spring Boot/Spring Cloud users can benefit from https://github.com/spring-cloud/spring-cloud-vault-config[Spring Cloud Vault]'s
11
11
configuration integration that initializes various property sources during application startup.
12
12
13
13
== Registering `VaultPropertySource`
14
14
15
-
Spring Vault provides a `VaultPropertySource` to be used with Vault to obtain
15
+
Spring Vault provides a javadoc:org.springframework.vault.core.env.VaultPropertySource[] to be used with Vault to obtain
16
16
properties. It uses the nested `data` element to expose properties stored and
0 commit comments