Skip to content

Commit 42cdfaa

Browse files
committed
Polishing.
Reformat code. Rollback Jackson customizations on request objects in favor of explicit request body creaction. Reduce method visibility to avoid unintended exposure. See gh-620 Original pull request: gh-778
1 parent 0fe33b7 commit 42cdfaa

File tree

10 files changed

+633
-420
lines changed

10 files changed

+633
-420
lines changed

spring-vault-core/src/main/java/org/springframework/vault/core/ReactiveVaultOperations.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* {@link #doWithVault(Function) without a session}.
3939
*
4040
* @author Mark Paluch
41+
* @author James Luke
4142
* @since 2.0
4243
* @see #doWithSession(Function)
4344
* @see #doWithVault(Function)
@@ -48,6 +49,21 @@
4849
*/
4950
public interface ReactiveVaultOperations {
5051

52+
/**
53+
* @return the operations interface to interact with the Vault transit backend.
54+
* @since 3.1
55+
*/
56+
ReactiveVaultTransitOperations opsForTransit();
57+
58+
/**
59+
* Return {@link ReactiveVaultTransitOperations} if the transit backend is mounted on
60+
* a different path than {@code transit}.
61+
* @param path the mount path
62+
* @return the operations interface to interact with the Vault transit backend.
63+
* @since 3.1
64+
*/
65+
ReactiveVaultTransitOperations opsForTransit(String path);
66+
5167
/**
5268
* Read from a Vault path. Reading data using this method is suitable for API
5369
* calls/secret backends that do not require a request body.
@@ -122,17 +138,4 @@ <V, T extends Publisher<V>> T doWithVault(Function<WebClient, ? extends T> clien
122138
<V, T extends Publisher<V>> T doWithSession(Function<WebClient, ? extends T> sessionCallback)
123139
throws VaultException, WebClientException;
124140

125-
/**
126-
* @return the operations interface to interact with the Vault transit backend.
127-
*/
128-
ReactiveVaultTransitOperations opsForTransit();
129-
130-
/**
131-
* Return {@link ReactiveVaultTransitOperations} if the transit backend is mounted on
132-
* a different path than {@code transit}.
133-
* @param path the mount path
134-
* @return the operations interface to interact with the Vault transit backend.
135-
*/
136-
ReactiveVaultTransitOperations opsForTransit(String path);
137-
138141
}

spring-vault-core/src/main/java/org/springframework/vault/core/ReactiveVaultTemplate.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
*
5757
* @author Mark Paluch
5858
* @author Raoof Mohammed
59+
* @author James Luke
5960
* @see SessionManager
6061
* @since 2.0
6162
*/
@@ -226,6 +227,16 @@ private ExchangeFilterFunction getSessionFilter() {
226227
}));
227228
}
228229

230+
@Override
231+
public ReactiveVaultTransitOperations opsForTransit() {
232+
return opsForTransit("transit");
233+
}
234+
235+
@Override
236+
public ReactiveVaultTransitOperations opsForTransit(String path) {
237+
return new ReactiveVaultTransitTemplate(this, path);
238+
}
239+
229240
@Override
230241
public Mono<VaultResponse> read(String path) {
231242

@@ -365,14 +376,4 @@ public Mono<VaultToken> getVaultToken() {
365376

366377
}
367378

368-
@Override
369-
public ReactiveVaultTransitOperations opsForTransit() {
370-
return opsForTransit("transit");
371-
}
372-
373-
@Override
374-
public ReactiveVaultTransitOperations opsForTransit(String path) {
375-
return new ReactiveVaultTransitTemplate(this, path);
376-
}
377-
378379
}

spring-vault-core/src/main/java/org/springframework/vault/core/ReactiveVaultTransitOperations.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,18 @@
3737
import java.util.List;
3838

3939
/**
40-
* Interface that specifies a set of {@code transit} operations executed on a reactive
41-
* infrastructure, implemented by
42-
* {@link org.springframework.vault.core.ReactiveVaultTransitTemplate}.
40+
* * Interface that specifies operations using the {@code transit} backend.
4341
*
4442
* @author James Luke
43+
* @since 3.1
44+
* @see <a href="https://www.vaultproject.io/docs/secrets/transit/index.html">Transit
45+
* Secret Backend</a>
4546
*/
4647
public interface ReactiveVaultTransitOperations {
4748

4849
/**
49-
* Create a new named encryption key given a {@code name}
50-
* @param keyName must not be empty or {@literal null}
50+
* Create a new named encryption key given a {@code name}.
51+
* @param keyName must not be empty or {@literal null}.
5152
*/
5253
Mono<Void> createKey(String keyName);
5354

@@ -61,7 +62,8 @@ public interface ReactiveVaultTransitOperations {
6162
Mono<Void> createKey(String keyName, VaultTransitKeyCreationRequest createKeyRequest);
6263

6364
/**
64-
* @return stream of transit key names.
65+
* Get a {@link Flux} of transit key names.
66+
* @return {@link Flux} of transit key names.
6567
*/
6668
Flux<String> getKeys();
6769

@@ -78,14 +80,14 @@ public interface ReactiveVaultTransitOperations {
7880
* operation.
7981
* @param keyName must not be empty or {@literal null}.
8082
* @param type must not be {@literal null}.
81-
* @return the {@link RawTransitKey}. May be empty if key does not exist
83+
* @return the {@link RawTransitKey}. Empty if key does not exist
8284
*/
8385
Mono<RawTransitKey> exportKey(String keyName, TransitKeyType type);
8486

8587
/**
8688
* Return information about a named encryption key.
8789
* @param keyName must not be empty or {@literal null}.
88-
* @return the {@link VaultTransitKey}. May be empty if key does not exist
90+
* @return the {@link VaultTransitKey}. Empty if key does not exist.
8991
*/
9092
Mono<VaultTransitKey> getKey(String keyName);
9193

@@ -230,10 +232,10 @@ public interface ReactiveVaultTransitOperations {
230232
* a type that supports rotation, configured {@link VaultHmacRequest#getKeyVersion()}
231233
* will be used.
232234
* @param keyName must not be empty or {@literal null}.
233-
* @param hmacRequest the {@link VaultHmacRequest}, must not be {@literal null}.
235+
* @param request the {@link VaultHmacRequest}, must not be {@literal null}.
234236
* @return the digest of given data the default hash algorithm and the named key.
235237
*/
236-
Mono<Hmac> getHmac(String keyName, VaultHmacRequest hmacRequest);
238+
Mono<Hmac> getHmac(String keyName, VaultHmacRequest request);
237239

238240
/**
239241
* Create a cryptographic signature using {@code keyName} of the given
@@ -250,10 +252,10 @@ public interface ReactiveVaultTransitOperations {
250252
* {@link VaultSignRequest} and the specified hash algorithm. The key must be of a
251253
* type that supports signing.
252254
* @param keyName must not be empty or {@literal null}.
253-
* @param signRequest {@link VaultSignRequest} must not be empty or {@literal null}.
255+
* @param request {@link VaultSignRequest} must not be empty or {@literal null}.
254256
* @return Signature for {@link VaultSignRequest}.
255257
*/
256-
Mono<Signature> sign(String keyName, VaultSignRequest signRequest);
258+
Mono<Signature> sign(String keyName, VaultSignRequest request);
257259

258260
/**
259261
* Verify the cryptographic signature using {@code keyName} of the given
@@ -269,10 +271,10 @@ public interface ReactiveVaultTransitOperations {
269271
* Verify the cryptographic signature using {@code keyName} of the given
270272
* {@link VaultSignRequest}.
271273
* @param keyName must not be empty or {@literal null}.
272-
* @param verificationRequest {@link VaultSignatureVerificationRequest} must not be
274+
* @param request {@link VaultSignatureVerificationRequest} must not be
273275
* {@literal null}.
274276
* @return the resulting {@link SignatureValidation}.
275277
*/
276-
Mono<SignatureValidation> verify(String keyName, VaultSignatureVerificationRequest verificationRequest);
278+
Mono<SignatureValidation> verify(String keyName, VaultSignatureVerificationRequest request);
277279

278280
}

0 commit comments

Comments
 (0)