Java Code Examples for org.springframework.vault.support.VaultResponse#getWrapInfo()
The following examples show how to use
org.springframework.vault.support.VaultResponse#getWrapInfo() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VaultWrappingTemplate.java From spring-vault with Apache License 2.0 | 4 votes |
@Override public WrappedMetadata wrap(Object body, Duration duration) { Assert.notNull(body, "Body must not be null"); Assert.notNull(duration, "TTL duration must not be null"); VaultResponse response = this.vaultOperations.doWithSession(restOperations -> { HttpHeaders headers = new HttpHeaders(); headers.add("X-Vault-Wrap-TTL", Long.toString(duration.getSeconds())); return restOperations.exchange("sys/wrapping/wrap", HttpMethod.POST, new HttpEntity<>(body, headers), VaultResponse.class).getBody(); }); Map<String, String> wrapInfo = response.getWrapInfo(); return getWrappedMetadata(wrapInfo, VaultToken.of(wrapInfo.get("token"))); }
Example 2
Source File: VaultWrappingTemplate.java From spring-vault with Apache License 2.0 | 3 votes |
@Override public WrappedMetadata rewrap(VaultToken token) { Assert.notNull(token, "token VaultToken not be null"); VaultResponse response = this.vaultOperations.write("sys/wrapping/rewrap", Collections.singletonMap("token", token.getToken())); Map<String, String> wrapInfo = response.getWrapInfo(); return getWrappedMetadata(wrapInfo, VaultToken.of(wrapInfo.get("token"))); }