Skip to content

Commit 65b95b8

Browse files
authored
Merge pull request #45 from auth0/add-identity-values
Parse extra Auth0 Identity values
2 parents 91297ee + 6d49ab7 commit 65b95b8

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

src/main/java/com/auth0/json/mgmt/users/Identity.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package com.auth0.json.mgmt.users;
22

3-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4-
import com.fasterxml.jackson.annotation.JsonInclude;
5-
import com.fasterxml.jackson.annotation.JsonProperty;
3+
import com.fasterxml.jackson.annotation.*;
4+
5+
import java.util.HashMap;
6+
import java.util.Map;
67

78
@SuppressWarnings({"unused", "WeakerAccess"})
89
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -21,6 +22,21 @@ public class Identity {
2122
private String accessToken;
2223
@JsonProperty("profileData")
2324
private ProfileData profileData;
25+
private Map<String, Object> values;
26+
27+
public Identity() {
28+
values = new HashMap<>();
29+
}
30+
31+
@JsonAnySetter
32+
void setValue(String key, Object value) {
33+
values.put(key, value);
34+
}
35+
36+
@JsonAnyGetter
37+
public Map<String, Object> getValues() {
38+
return values;
39+
}
2440

2541
@JsonProperty("connection")
2642
public String getConnection() {

src/test/java/com/auth0/json/mgmt/users/IdentityTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
import org.junit.Test;
55

66
import static org.hamcrest.MatcherAssert.assertThat;
7-
import static org.hamcrest.Matchers.is;
8-
import static org.hamcrest.Matchers.notNullValue;
7+
import static org.hamcrest.Matchers.*;
98

109
public class IdentityTest extends JsonTest<Identity> {
1110

12-
private static final String json = "{\"connection\":\"auth0\",\"user_id\":\"user|123\",\"isSocial\":true,\"provider\":\"oauth\",\"access_token\":\"aTokEn\",\"profileData\":{}}";
11+
private static final String json = "{\"connection\":\"auth0\",\"user_id\":\"user|123\",\"isSocial\":true,\"provider\":\"oauth\",\"access_token\":\"aTokEn\",\"profileData\":{},\"access_token_secret\":\"s3cr3t\"}";
1312

1413
@Test
1514
public void shouldDeserialize() throws Exception {
@@ -22,5 +21,7 @@ public void shouldDeserialize() throws Exception {
2221
assertThat(identity.getProvider(), is("oauth"));
2322
assertThat(identity.getAccessToken(), is("aTokEn"));
2423
assertThat(identity.getProfileData(), is(notNullValue()));
24+
assertThat(identity.getValues(), is(notNullValue()));
25+
assertThat(identity.getValues(), hasEntry("access_token_secret", (Object) "s3cr3t"));
2526
}
2627
}

0 commit comments

Comments
 (0)