Commit Graph

162 Commits

Author SHA1 Message Date
Mark Paluch
48c8fdec61 Polishing.
See gh-202.
2018-02-28 14:37:22 +01:00
Mark Paluch
458f47eb30 Return null on absent Policy via VaultSysTemplate.getPolicy(…).
We now return null if a policy was not found. Previously, a VaultException was thrown.

Closes gh-202.
2018-02-28 14:36:11 +01:00
Mark Paluch
1dfd83f5be [maven-release-plugin] prepare for next development iteration
See gh-198.
2018-02-20 09:44:00 +01:00
Mark Paluch
4b1061d153 [maven-release-plugin] prepare release 2.0.0.RELEASE
See gh-198.
2018-02-20 09:43:14 +01:00
Mark Paluch
c3b2aee11d Add unit test for VaultPropertySource with profiles.
See gh-193.
2018-02-09 11:56:41 +01:00
Mark Paluch
78197da7ad Rename AwsIamAuthenticationOptions#serverName to serverId.
Align naming with Vault's serverId that sets Vault-AWS-IAM-Server-ID headers on AWS requests for consistency. serverName builder/getter is deprecated now.

Closes gh-191.
2018-02-06 11:10:35 +01:00
Mark Paluch
8f19127584 [maven-release-plugin] prepare for next development iteration 2018-01-25 09:48:54 +01:00
Mark Paluch
a94cbc15ae [maven-release-plugin] prepare release 2.0.0.RC2 2018-01-25 09:48:53 +01:00
Mark Paluch
11a346ef2b Polishing.
Adjust generics and wording in reactive Template API.
2018-01-25 09:44:34 +01:00
Mark Paluch
35b5797c63 Polishing.
See gh-187
2018-01-23 10:49:11 +01:00
Mark Paluch
9ed2196068 Polishing.
See gh-187
2018-01-22 19:29:09 +01:00
Mark Paluch
28ff17d4f8 Add VaultBytesEncryptor and VaultBytesKeyGenerator.
We now provide a Spring Security integration for Vault transit-based BytesEncryptor and BytesKeyGenerator.

VaultOperations operations = …;
VaultBytesKeyGenerator generator = new VaultBytesKeyGenerator(operations);

byte[] key = generator.generateKey();

VaultTransitOperations transit = …;
VaultBytesEncryptor encryptor = new VaultBytesEncryptor(transit, "my-key-name");

byte[] ciphertext = encryptor.encrypt(plaintext);
byte[] decrypted = encryptor.decrypt(ciphertext);

Closes gh-187.
2018-01-22 12:11:05 +01:00
Mark Paluch
3e6fbe7581 Polishing.
Remove PropertyTransformerSupport in favor of default method in PropertyTransformer and refactor PropertyTransformer to functional interface.

See gh-169.
2018-01-17 15:36:30 +01:00
Mark Paluch
f4d05a4fb6 Retain JSON data type in PropertySource.
We now retain the JSON data type in the property source. This change requires property transformers to accept/produce a Map of String to Object whereas it was String to String before.

See gh-169.
2018-01-17 13:06:08 +01:00
Mark Paluch
747a270604 Introduce reactive SessionManager.
We now provide a reactive, lifecycle-aware SessionManager using WebClient. ReactiveSessionManager is mirroring imperative SessionManager functionality. Using AbstractReactiveVaultConfiguration will register an adapter between ReactiveSessionManager and SessionManager to reuse the same token for reactive and imperative API use.

Closes gh-159.
2018-01-17 12:44:09 +01:00
Mark Paluch
b757ff04dc Polishing.
Introduce convenience factory method to convert a VaultToken into LoginToken.

See gh-159.
2018-01-17 12:44:09 +01:00
Mark Paluch
0710ae838a Extract common base class for LifecycleAwareSessionManager.
See gh-159.
2018-01-17 12:44:09 +01:00
Mark Paluch
ca874a6a31 Polishing.
Update license copyright years to 2018.
2018-01-16 14:35:51 +01:00
Mark Paluch
eacfcbfd5b Support Vault HA with redirects.
Fixes gh-184.
2018-01-16 14:34:49 +01:00
Mark Paluch
7244973bef Make RoleId and SecretId public.
AppRoleAuthenticationOptions.RoleId and AppRoleAuthenticationOptions.SecretId interfaces are now public.

Closes gh-179.
2017-11-23 12:07:44 +01:00
Mark Paluch
db195be8d8 Polishing.
Improve Javadoc.

See gh-177.
2017-11-16 12:19:55 +01:00
Mark Paluch
08063cc940 Return VaultResponse in ReactiveVaultOperations.write(…).
We now return the actual response when writing to a Vault path.

Closes gh-177.
2017-11-16 12:14:52 +01:00
Mark Paluch
29c4827d41 Polishing.
Guard tests to run with the appropriate Vault version.

See gh-158.
2017-11-15 20:16:34 +01:00
Mark Paluch
b74059038b Consider login token TTL after renewal.
We now consider the token TTL after renewal to calculate the next renewal time to prevent stale token use. Previously, we assumed the TTL to be the same as the initial TTL. This caused the token to render invalid for a period of time.

We now also check the TTL after renewal whether a subsequent renewal run makes sense for the token. If the remaining TTL exceeds the minimum valid TTL we drop the token and re-login upon the next session token request. We do not revoke the token explicitly to not interrupt processes that obtained the token during the renewal period. Since the remaining TTL is rather short the token will silently expire.

Closes gh-176.
2017-11-15 16:06:42 +01:00
Mark Paluch
b122d7510c [maven-release-plugin] prepare for next development iteration
See gh-173.
2017-11-15 08:22:50 +01:00
Mark Paluch
829e6ffc88 [maven-release-plugin] prepare release 2.0.0.RC1
See gh-173.
2017-11-15 08:22:50 +01:00
Mark Paluch
bba0a7f096 Polishing.
See gh-158.
2017-11-14 15:25:03 +01:00
Mark Paluch
a1cc3a7cb2 Provide AuthenticationSteps for token authentication with self-lookup.
Closes gh-158.
2017-11-14 15:23:28 +01:00
Mark Paluch
00b6a55689 Enhance VaultToken with self-lookup using LifecycleAwareSessionManager.
We now enhance VaultTokens obtained from a ClientAuthentication with a self-lookup to determine renewability and the remaining TTL. Self-lookup creates a LoginToken: We need to make sure to only revoke tokens that were initially a LoginToken supplied by the authentication and not LoginToken created by augmentation.

Closes gh-161.
2017-11-14 12:33:28 +01:00
Pedro Castineiras
96581a1ece Fix assert to verify the correct variable.
Original pull request: gh-170.
Closes: gh-170.
2017-11-14 11:28:39 +01:00
Mark Paluch
e5f96dd352 Polishing.
Rename Kube* authentication classes to Kubernetes*. Refactor KubernetesJwtSupplier to extend Supplier<String>. Load token file content eagerly. Extend Javadoc. Reformat code. Remove superfluous exception declarations in tests. Remove commented code from local_run_k8s.sh. Copy CA file from pod.

Reinstantiate AuthenticationStepsFactory for KubernetesAuthentication.

Add Kubernetes authentication to the reference documentation.

Original pull request: gh-166.
Related ticket: gh-143.
Closes gh-166.
2017-11-01 19:25:32 +01:00
Michal Budzyn
696d047760 Add authentication for Kubernetes Service Account Token
We now support authentication via Kubernetes using Service Account Tokens.

KubernetesAuthenticationOptions options = KubernetesAuthenticationOptions.builder().role("dev-role").build();
KubernetesAuthentication authentication = new KubernetesAuthentication(options, restTemplate);

Original pull request: gh-166.
Closes gh-143.
2017-11-01 19:25:22 +01:00
Mark Paluch
cfb84fe2b5 Encapsulate RoleId and SecretId modes for AppRole authentication.
Encapsulate RoleId and SecretId modes (pull, provided, wrapped, absent) with value objects. Adapt AppRoleAuthentication for imperative and AuthenticationSteps authentication. Split imperative and AuthenticationSteps tests.

Use the deprecated cubbyhole response unwrapping endpoint to unwrap responses.

Original pull request: gh-165.
Closes: gh-165.
2017-10-25 15:15:35 +02:00
Mark Paluch
e256add757 Polishing.
Add author tags. Reformat code.

Original pull request: gh-165.
2017-10-25 15:13:39 +02:00
christophetd
a69719d573 Add the ability to use response wrapping for AppRole secretId responses.
Original pull request: gh-165.
Closes: gh-164.
2017-10-25 15:13:12 +02:00
Mark Paluch
cec3d28faf Polishing.
Remove VaultTransitContext from Hmac and Signature types and requests. Introduce SignatureValidation to encapsulate validation outcome. Refactor request objects to pure value objects. Build request body inside of VaultTransitTemplate from request objects. Refactor request types to use Plaintext/Signature/Hmac types instead of String primitives.

Remove Hmac/Signature factory methods from bytes to keep Vault responses encapsulated.

Reorder field order/parameters in signatures/methods according their parameter significance. Extend Javadoc, add tests, add author tags. Guard tests to run against the appropriate Vault version.

Original pull request: gh-162.
Closes: gh-162.
2017-10-25 11:47:45 +02:00
Luander Ribeiro
10488de17a Extend Transit API to support Hashing and Signing Operations.
Transit API now has support to generate HMAC digests, signatures and verify signatures.

Plaintext plaintext = Plaintext.of("hello-world");

Signature signature = transitOperations.sign(keyName, plaintext);
boolean valid = transitOperations.verify(keyName, plaintext, signature);

Hmac hmac = transitOperations.getHmac(keyName, plaintext);
SignatureValidation validation = transitOperations.verify(keyName,
		VaultSignatureVerificationRequest.create(plaintext, hmac));

Original pull request: gh-162.
Closes: gh-148.
2017-10-25 11:46:32 +02:00
Mark Paluch
bee76beff1 Polishing.
Fix javadoc links.

See gh-125.
2017-10-19 08:24:48 +02:00
Mark Paluch
b30d81fa43 Support CSR signing, certificate revocation and CRL retrieval.
We now support CSR signing, certificate revocation and CRL retrieval via VaultPkiTemplate.

Closes gh-125.
2017-10-19 08:18:20 +02:00
Mark Paluch
f46066382b Introduce VaultTokenLookupException.
Throw dedicated exception if token self-lookup fails to improve error handling.

Enhance javadoc.

See gh-161.
2017-10-18 21:12:29 +02:00
Mark Paluch
5622a468c5 Polishing.
Replace PropertySources annotation with repeated annotations in test.

See gh-161.
2017-10-18 20:04:43 +02:00
Mark Paluch
d1a778e6a7 [maven-release-plugin] prepare for next development iteration
See gh-155.
2017-10-06 08:05:55 +02:00
Mark Paluch
e7986350bd [maven-release-plugin] prepare release 2.0.0.M3
See gh-155.
2017-10-06 08:04:45 +02:00
Mark Paluch
4ba7566d6b Merge repository support into Spring Vault Core.
Closes gh-157.
2017-10-05 17:45:21 +02:00
Mark Paluch
4d9abfc4a3 Polishing.
Adapt version assumptions for ed25519-typed keys.
2017-10-05 14:34:48 +02:00
Mark Paluch
c0970da4e6 Adapt Vault API changes in transit key value/configuration objects.
We now support min encryption/decryption versions via key configuration and expose these along with key capabilities through VaultTransitKey and VaultTransitKeyConfiguration.

Closes gh-124.
2017-10-05 14:34:43 +02:00
Mark Paluch
a38414d3c5 Support ecdsa and ed25519 transit key metadata.
We now support key metadata retrieval via VaultTransitKey. Vault reports a different metadata structure depending on the key type.

Fixes gh-149.
2017-10-02 15:40:32 +02:00
Mark Paluch
209e0b2d37 Add support for policies.
We now support policy management via Vault's policy endpoint to enumerate policy names, read, write and delete policies. Policy parsing support is limited to JSON as there is no Java HCL parser.

Closes gh-10.
2017-09-27 15:54:00 +02:00
Mark Paluch
3fd53ba938 Adapt NonNullFields annotation.
Closes gh-145.
2017-09-22 17:11:09 +02:00
Mark Paluch
4efbc8f380 Upgrade to Vault 0.8.3.
Accept generic and key/value for the key/value secret backend.

Closes gh-142.
2017-09-21 17:50:00 +02:00