@Test public void resetPassword() throws Exception { User userAdmin = getUserAdmin(); Principal principal = mock(Principal.class); when(principal.getUser()).thenReturn(userAdmin); when(authenticationManager.getCurrentPrincipal()).thenReturn(principal); final String randomPassword = sut.generateRandomPassword(RANDOM, RANDOM, RANDOM, RANDOM, RANDOM); doNothing().when(authManagerLdapTemplate).modifyAttributes(any(DirContext.class), eq(user), any(ModificationItem[].class)); sut.resetPassword(user, RANDOM, RANDOM, RANDOM, RANDOM, RANDOM); verify(authManagerLdapTemplate).changePassword(user, randomPassword, userAdmin); verify(authManagerLdapTemplate, times(2)).getTemplate(userAdmin); verify(authManagerLdapTemplate).getCallback(user, randomPassword); verify(authManagerLdapTemplate).getCallback(user); verify(authManagerLdapTemplate).changeLdapUserPassword(any(DirContext.class), eq(randomPassword), eq(user)); verify(authManagerLdapTemplate).setLdapUserPasswordResetFlag(any(DirContext.class), eq(user)); }
public String resetPassword(User user, String[] rnd0, String[] rnd1, String[] rnd2, String[] rnd3, String[] rnd4) { String changedPassword = generateRandomPassword(rnd0, rnd1, rnd2, rnd3, rnd4); final User userAdmin = AuthenticationManager.getDefault().getCurrentPrincipal().getUser(); changePassword(user, changedPassword, userAdmin); activateLdapUserPasswordResetFlag(user, userAdmin); return changedPassword; }
AuthenticationManagerLdapImpl extends AuthenticationManager { public String resetPassword(User user, String[] rnd0, String[] rnd1, String[] rnd2, String[] rnd3, String[] rnd4) { String changedPassword = generateRandomPassword(rnd0, rnd1, rnd2, rnd3, rnd4); final User userAdmin = AuthenticationManager.getDefault().getCurrentPrincipal().getUser(); changePassword(user, changedPassword, userAdmin); activateLdapUserPasswordResetFlag(user, userAdmin); return changedPassword; } }
AuthenticationManagerLdapImpl extends AuthenticationManager { public String resetPassword(User user, String[] rnd0, String[] rnd1, String[] rnd2, String[] rnd3, String[] rnd4) { String changedPassword = generateRandomPassword(rnd0, rnd1, rnd2, rnd3, rnd4); final User userAdmin = AuthenticationManager.getDefault().getCurrentPrincipal().getUser(); changePassword(user, changedPassword, userAdmin); activateLdapUserPasswordResetFlag(user, userAdmin); return changedPassword; } AuthenticationManagerLdapImpl(ConfigurationUtil cfg, IUserRolesService userRolesService,
            AuthenticationManagerLdapTemplate authenticationManagerLdapTemplate); }
AuthenticationManagerLdapImpl extends AuthenticationManager { public String resetPassword(User user, String[] rnd0, String[] rnd1, String[] rnd2, String[] rnd3, String[] rnd4) { String changedPassword = generateRandomPassword(rnd0, rnd1, rnd2, rnd3, rnd4); final User userAdmin = AuthenticationManager.getDefault().getCurrentPrincipal().getUser(); changePassword(user, changedPassword, userAdmin); activateLdapUserPasswordResetFlag(user, userAdmin); return changedPassword; } AuthenticationManagerLdapImpl(ConfigurationUtil cfg, IUserRolesService userRolesService,
            AuthenticationManagerLdapTemplate authenticationManagerLdapTemplate); static AuthenticationManager getDefault(); boolean checkPassword(User user, String password); String resetPassword(User user, String[] rnd0, String[] rnd1, String[] rnd2, String[] rnd3, String[] rnd4); String resetPasswordExternal(User user, String[] rnd0, String[] rnd1, String[] rnd2, String[] rnd3, String[] rnd4); void changePassword(final User user, final String password); }
AuthenticationManagerLdapImpl extends AuthenticationManager { public String resetPassword(User user, String[] rnd0, String[] rnd1, String[] rnd2, String[] rnd3, String[] rnd4) { String changedPassword = generateRandomPassword(rnd0, rnd1, rnd2, rnd3, rnd4); final User userAdmin = AuthenticationManager.getDefault().getCurrentPrincipal().getUser(); changePassword(user, changedPassword, userAdmin); activateLdapUserPasswordResetFlag(user, userAdmin); return changedPassword; } AuthenticationManagerLdapImpl(ConfigurationUtil cfg, IUserRolesService userRolesService,
            AuthenticationManagerLdapTemplate authenticationManagerLdapTemplate); static AuthenticationManager getDefault(); boolean checkPassword(User user, String password); String resetPassword(User user, String[] rnd0, String[] rnd1, String[] rnd2, String[] rnd3, String[] rnd4); String resetPasswordExternal(User user, String[] rnd0, String[] rnd1, String[] rnd2, String[] rnd3, String[] rnd4); void changePassword(final User user, final String password);  }