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
|
||||
* List secrets
|
||||
* Connector Factory with builder pattern
|
||||
* Tested against Vault 0.5.2
|
||||
* Tested against Vault 0.6.0
|
||||
|
||||
**Usage Example**
|
||||
|
||||
@ -38,7 +38,7 @@ String secret = vault.readSecret("some/secret/key").getValue();
|
||||
<dependency>
|
||||
<groupId>de.stklcode.jvault</groupId>
|
||||
<artifactId>connector</artifactId>
|
||||
<version>0.1</version>
|
||||
<version>0.1.1</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>de.stklcode.jvault</groupId>
|
||||
<artifactId>connector</artifactId>
|
||||
<version>0.1</version>
|
||||
<version>0.1.1</version>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
@ -381,7 +381,14 @@ public class HTTPVaultConnector implements VaultConnector {
|
||||
InvalidResponseException ex = new InvalidResponseException("Invalid response code")
|
||||
.withStatusCode(response.getStatusLine().getStatusCode());
|
||||
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) {
|
||||
throw ex;
|
||||
|
Reference in New Issue
Block a user