Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user_name field to LogEvent #375

Merged
merged 1 commit into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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