Skip to content

Commit

Permalink
Merge pull request #375 from auth0/log-user-name
Browse files Browse the repository at this point in the history
Add user_name field to LogEvent
  • Loading branch information
jimmyjames authored Sep 21, 2021
2 parents dbfe4f1 + 39114f4 commit bf35b7a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class LogEvent {
private String ip;
@JsonProperty("user_id")
private String userId;
@JsonProperty("user_name")
private String userName;
@JsonProperty("location_info")
private Map<String, Object> locationInfo;
@JsonProperty("details")
Expand Down Expand Up @@ -119,6 +121,16 @@ public String getUserId() {
return userId;
}

/**
* Getter for the user name related to this event.
*
* @return the user id.
*/
@JsonProperty("user_name")
public String getUserName() {
return userName;
}

/**
* Getter for the location info object.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class LogEventTest extends JsonTest<LogEvent> {

private static final String json = "{\"_id\":\"123\", \"log_id\":\"123\", \"date\":\"2016-02-23T19:57:29.532Z\",\"type\":\"thetype\",\"location_info\":{},\"details\":{},\"client_id\":\"clientId\",\"client_name\":\"clientName\",\"ip\":\"233.233.233.11\",\"user_id\":\"userId\"}";
private static final String json = "{\"_id\":\"123\", \"log_id\":\"123\", \"date\":\"2016-02-23T19:57:29.532Z\",\"type\":\"thetype\",\"location_info\":{},\"details\":{},\"client_id\":\"clientId\",\"client_name\":\"clientName\",\"ip\":\"233.233.233.11\",\"user_id\":\"userId\",\"user_name\":\"userName\"}";

@Test
public void shouldDeserialize() throws Exception {
Expand All @@ -24,6 +24,7 @@ public void shouldDeserialize() throws Exception {
assertThat(logEvent.getClientName(), is("clientName"));
assertThat(logEvent.getIP(), is("233.233.233.11"));
assertThat(logEvent.getUserId(), is("userId"));
assertThat(logEvent.getUserName(), is("userName"));
assertThat(logEvent.getLocationInfo(), is(notNullValue()));
assertThat(logEvent.getDetails(), is(notNullValue()));
}
Expand Down

0 comments on commit bf35b7a

Please sign in to comment.