correclty map token meta in lookup response (fix #34)
This commit is contained in:
parent
4788fa7272
commit
071eeda423
@ -1,3 +1,9 @@
|
||||
## 0.9.0 (unreleased)
|
||||
|
||||
### Fixes
|
||||
* Correctly parse Map field for token metadata (#34)
|
||||
|
||||
|
||||
## 0.8.2 (2019-10-20)
|
||||
|
||||
### Fixes
|
||||
|
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>de.stklcode.jvault</groupId>
|
||||
<artifactId>jvault-connector</artifactId>
|
||||
<version>0.8.2</version>
|
||||
<version>0.9.0-SNAPSHOT</version>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
@ -19,6 +19,8 @@ package de.stklcode.jvault.connector.model.response.embedded;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Embedded token information inside Vault response.
|
||||
*
|
||||
@ -43,7 +45,7 @@ public final class TokenData {
|
||||
private String id;
|
||||
|
||||
@JsonProperty("meta")
|
||||
private String meta;
|
||||
private Map<String, Object> meta;
|
||||
|
||||
@JsonProperty("num_uses")
|
||||
private Integer numUses;
|
||||
@ -133,7 +135,7 @@ public final class TokenData {
|
||||
/**
|
||||
* @return Metadata
|
||||
*/
|
||||
public String getMeta() {
|
||||
public Map<String, Object> getMeta() {
|
||||
return meta;
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ public class TokenResponseTest {
|
||||
private static final Integer TOKEN_CREATION_TIME = 1457533232;
|
||||
private static final Integer TOKEN_TTL = 2764800;
|
||||
private static final String TOKEN_DISPLAY_NAME = "token";
|
||||
private static final String TOKEN_META_KEY = "foo";
|
||||
private static final String TOKEN_META_VALUE = "bar";
|
||||
private static final Integer TOKEN_NUM_USES = 0;
|
||||
private static final Boolean TOKEN_ORPHAN = false;
|
||||
private static final String TOKEN_PATH = "auth/token/create";
|
||||
@ -56,7 +58,9 @@ public class TokenResponseTest {
|
||||
" \"creation_time\": " + TOKEN_CREATION_TIME + ",\n" +
|
||||
" \"creation_ttl\": " + TOKEN_TTL + ",\n" +
|
||||
" \"display_name\": \"" + TOKEN_DISPLAY_NAME + "\",\n" +
|
||||
" \"meta\": null,\n" +
|
||||
" \"meta\": {\n" +
|
||||
" \"" + TOKEN_META_KEY + "\": \"" + TOKEN_META_VALUE + "\"\n" +
|
||||
" },\n" +
|
||||
" \"num_uses\": " + TOKEN_NUM_USES + ",\n" +
|
||||
" \"orphan\": " + TOKEN_ORPHAN + ",\n" +
|
||||
" \"path\": \"" + TOKEN_PATH + "\",\n" +
|
||||
@ -113,6 +117,8 @@ public class TokenResponseTest {
|
||||
assertThat("Incorrect token number of uses", data.getNumUses(), is(TOKEN_NUM_USES));
|
||||
assertThat("Incorrect token orphan flag", data.isOrphan(), is(TOKEN_ORPHAN));
|
||||
assertThat("Incorrect token path", data.getPath(), is(TOKEN_PATH));
|
||||
assertThat("Incorrect auth metadata size", data.getMeta().entrySet(), hasSize(1));
|
||||
assertThat("Incorrect auth metadata", data.getMeta().get(TOKEN_META_KEY), is(TOKEN_META_VALUE));
|
||||
assertThat("Incorrect response renewable flag", res.isRenewable(), is(RES_RENEWABLE));
|
||||
assertThat("Incorrect response TTL", data.getTtl(), is(RES_TTL));
|
||||
assertThat("Incorrect response lease duration", res.getLeaseDuration(), is(RES_LEASE_DURATION));
|
||||
|
Loading…
x
Reference in New Issue
Block a user