예제 #1
0
  @Test
  public void testResetPasswordSuccess() throws Exception {
    ScimUser user = new ScimUser("user-id", "*****@*****.**", "firstName", "lastName");
    user.setMeta(
        new ScimMeta(
            new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24)),
            new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24)),
            0));
    user.setPrimaryEmail("*****@*****.**");
    when(resetPasswordService.resetPassword("secret_code", "password")).thenReturn(user);

    MockHttpServletRequestBuilder post =
        post("/reset_password.do")
            .contentType(APPLICATION_FORM_URLENCODED)
            .param("code", "secret_code")
            .param("email", "*****@*****.**")
            .param("password", "password")
            .param("password_confirmation", "password");
    mockMvc
        .perform(post)
        .andExpect(status().isFound())
        .andExpect(redirectedUrl("home"))
        .andExpect(model().attributeDoesNotExist("code"))
        .andExpect(model().attributeDoesNotExist("password"))
        .andExpect(model().attributeDoesNotExist("password_confirmation"));
  }
예제 #2
0
 @Override
 public ScimUser mapRow(ResultSet rs, int rowNum) throws SQLException {
   String id = rs.getString(1);
   int version = rs.getInt(2);
   Date created = rs.getTimestamp(3);
   Date lastModified = rs.getTimestamp(4);
   String userName = rs.getString(5);
   String email = rs.getString(6);
   String givenName = rs.getString(7);
   String familyName = rs.getString(8);
   boolean active = rs.getBoolean(9);
   String phoneNumber = rs.getString(10);
   boolean verified = rs.getBoolean(11);
   String origin = rs.getString(12);
   String externalId = rs.getString(13);
   String zoneId = rs.getString(14);
   String salt = rs.getString(15);
   Date passwordLastModified = rs.getTimestamp(16);
   ScimUser user = new ScimUser();
   user.setId(id);
   ScimMeta meta = new ScimMeta();
   meta.setVersion(version);
   meta.setCreated(created);
   meta.setLastModified(lastModified);
   user.setMeta(meta);
   user.setUserName(userName);
   user.addEmail(email);
   if (phoneNumber != null) {
     user.addPhoneNumber(phoneNumber);
   }
   Name name = new Name();
   name.setGivenName(givenName);
   name.setFamilyName(familyName);
   user.setName(name);
   user.setActive(active);
   user.setVerified(verified);
   user.setOrigin(origin);
   user.setExternalId(externalId);
   user.setZoneId(zoneId);
   user.setSalt(salt);
   user.setPasswordLastModified(passwordLastModified);
   return user;
 }