Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
a5e31a0b7b | |||
30ac23203d |
@ -14,7 +14,7 @@ Java Vault Connector is a connector library for [Vault](https://www.vaultproject
|
|||||||
* Write secrets
|
* Write secrets
|
||||||
* List secrets
|
* List secrets
|
||||||
* Connector Factory with builder pattern
|
* Connector Factory with builder pattern
|
||||||
* Tested against Vault 0.5.2
|
* Tested against Vault 0.6.0
|
||||||
|
|
||||||
**Usage Example**
|
**Usage Example**
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ String secret = vault.readSecret("some/secret/key").getValue();
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.stklcode.jvault</groupId>
|
<groupId>de.stklcode.jvault</groupId>
|
||||||
<artifactId>connector</artifactId>
|
<artifactId>connector</artifactId>
|
||||||
<version>0.1</version>
|
<version>0.1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>de.stklcode.jvault</groupId>
|
<groupId>de.stklcode.jvault</groupId>
|
||||||
<artifactId>connector</artifactId>
|
<artifactId>connector</artifactId>
|
||||||
<version>0.1</version>
|
<version>0.1.1</version>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
@ -381,7 +381,14 @@ public class HTTPVaultConnector implements VaultConnector {
|
|||||||
InvalidResponseException ex = new InvalidResponseException("Invalid response code")
|
InvalidResponseException ex = new InvalidResponseException("Invalid response code")
|
||||||
.withStatusCode(response.getStatusLine().getStatusCode());
|
.withStatusCode(response.getStatusLine().getStatusCode());
|
||||||
try {
|
try {
|
||||||
throw ex.withResponse(IOUtils.toString(response.getEntity().getContent()));
|
/* Try to parse error response */
|
||||||
|
ErrorResponse er = jsonMapper.readValue(IOUtils.toString(response.getEntity().getContent()),
|
||||||
|
ErrorResponse.class);
|
||||||
|
/* Check for "permission denied" response */
|
||||||
|
if (er.getErrors().size() > 0 && er.getErrors().get(0).equals("permission denied"))
|
||||||
|
throw new PermissionDeniedException();
|
||||||
|
|
||||||
|
throw ex.withResponse(er.toString());
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
throw ex;
|
throw ex;
|
||||||
|
Reference in New Issue
Block a user