Skip to content

Commit

Permalink
Merge pull request #256 from mario-moura-silva/master
Browse files Browse the repository at this point in the history
Add missing property last_password_reset
  • Loading branch information
lbalmaceda committed May 18, 2020
2 parents 79da0ac + ca65f15 commit 4022248
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
16 changes: 15 additions & 1 deletion src/main/java/com/auth0/json/mgmt/users/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public class User implements Serializable {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@JsonProperty("last_login")
private Date lastLogin;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@JsonProperty("last_password_reset")
private Date lastPasswordReset;
@JsonProperty("logins_count")
private Integer loginsCount;
@JsonProperty("blocked")
Expand Down Expand Up @@ -443,6 +446,17 @@ public Date getLastLogin() {
return lastLogin;
}

/**
* Getter for the last password reset date. Only available for Database Connection users.
*
* @return the last password reset.
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@JsonProperty("last_password_reset")
public Date getLastPasswordReset() {
return lastPasswordReset;
}

/**
* Getter for the number of logins for this user.
*
Expand Down Expand Up @@ -552,4 +566,4 @@ void setValue(String key, Object value) {
public Map<String, Object> getValues() {
return values;
}
}
}
5 changes: 0 additions & 5 deletions src/test/java/com/auth0/client/mgmt/RolesEntityTest.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
package com.auth0.client.mgmt;

import static com.auth0.client.MockServer.MGMT_EMPTY_LIST;
import static com.auth0.client.MockServer.MGMT_ROLE;
import static com.auth0.client.MockServer.MGMT_ROLES_LIST;
import static com.auth0.client.MockServer.MGMT_ROLES_PAGED_LIST;
import static com.auth0.client.MockServer.MGMT_ROLE_PERMISSIONS_LIST;
import static com.auth0.client.MockServer.MGMT_ROLE_PERMISSIONS_PAGED_LIST;
import static com.auth0.client.MockServer.MGMT_ROLE_USERS_LIST;
import static com.auth0.client.MockServer.MGMT_ROLE_USERS_PAGED_LIST;
import static com.auth0.client.MockServer.bodyFromRequest;
import static com.auth0.client.RecordedRequestMatcher.hasHeader;
import static com.auth0.client.RecordedRequestMatcher.hasMethodAndPath;
import static com.auth0.client.RecordedRequestMatcher.hasQueryParameter;
import static org.hamcrest.Matchers.emptyCollectionOf;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.hasSize;
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/com/auth0/json/mgmt/users/UserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class UserTest extends JsonTest<User> {

private static final String json = "{\"user_id\":\"user|123\",\"connection\":\"auth0\",\"client_id\":\"client123\",\"password\":\"pwd\",\"verify_password\":true,\"username\":\"usr\",\"email\":\"[email protected]\",\"email_verified\":true,\"verify_email\":true,\"phone_number\":\"1234567890\",\"phone_verified\":true,\"verify_phone_number\":true,\"picture\":\"https://pic.ture/12\",\"name\":\"John\",\"nickname\":\"Johny\",\"given_name\":\"John\",\"family_name\":\"Walker\",\"app_metadata\":{},\"user_metadata\":{},\"blocked\":true,\"context\":\"extra information\"}";
private static final String readOnlyJson = "{\"user_id\":\"user|123\",\"last_ip\":\"10.0.0.1\",\"last_login\":\"2016-02-23T19:57:29.532Z\",\"logins_count\":10,\"created_at\":\"2016-02-23T19:57:29.532Z\",\"updated_at\":\"2016-02-23T19:57:29.532Z\",\"identities\":[]}";
private static final String readOnlyJson = "{\"user_id\":\"user|123\",\"last_ip\":\"10.0.0.1\",\"last_login\":\"2016-02-23T19:57:29.532Z\",\"last_password_reset\":\"2016-02-23T19:57:29.532Z\",\"logins_count\":10,\"created_at\":\"2016-02-23T19:57:29.532Z\",\"updated_at\":\"2016-02-23T19:57:29.532Z\",\"identities\":[]}";

@Test
public void shouldHaveEmptyValuesByDefault() throws Exception{
Expand Down Expand Up @@ -113,6 +113,7 @@ public void shouldIncludeReadOnlyValuesOnDeserialize() throws Exception {
assertThat(user.getCreatedAt(), is(parseJSONDate("2016-02-23T19:57:29.532Z")));
assertThat(user.getUpdatedAt(), is(parseJSONDate("2016-02-23T19:57:29.532Z")));
assertThat(user.getLastLogin(), is(parseJSONDate("2016-02-23T19:57:29.532Z")));
assertThat(user.getLastPasswordReset(), is(parseJSONDate("2016-02-23T19:57:29.532Z")));
assertThat(user.getIdentities(), is(notNullValue()));
assertThat(user.getLastIP(), is("10.0.0.1"));
assertThat(user.getLoginsCount(), is(10));
Expand Down Expand Up @@ -142,4 +143,4 @@ public void shouldGetPasswordAsCharArray() {

assertThat(user.getPassword(), is(password.toCharArray()));
}
}
}

0 comments on commit 4022248

Please sign in to comment.