@Test public void testVerifyPasswordStrength_NOK_tooSimilarWithOldPassword() throws AuthenticationException { boolean isOK = AuthenticatorHelper.verifyPasswordStrength("test2", "_tesT21_", "theusername"); if (!isOK) { System.out.println("testVerifyPasswordStrength_NOK_tooSimilarWithOldPassword - oldPassword: " + "test2"); System.out.println("testVerifyPasswordStrength_NOK_tooSimilarWithOldPassword - newPassword: " + "12tesT21"); return; } fail(); }
public static boolean verifyPasswordStrength(String oldPassword, String newPassword, String principalName) { if (newPassword == null || newPassword.isEmpty()) { LOG.error("verifyPasswordStrength failed because newPassword or principalName is null or empty"); return false; } else if (newPassword != null && newPassword.trim().length() < 8) { LOG.error("verifyPasswordStrength failed because newPassword is too short, should be at least 8 chars long"); return false; } else if (newPassword != null && !verifyCharSets(newPassword)) { LOG.error("verifyPasswordStrength failed because newPassword doesn't have a char from each char set"); return false; } if (principalName == null) { principalName = ""; } try { FileBasedAuthenticator.getInstance().verifyPasswordStrength(oldPassword, newPassword, getESAPIUser(principalName)); } catch (AuthenticationException e) { LOG.error("verifyPasswordStrength failed because: " + e.getUserMessage() + " " + e.getLogMessage()); return false; } return true; }
AuthenticatorHelper { public static boolean verifyPasswordStrength(String oldPassword, String newPassword, String principalName) { if (newPassword == null || newPassword.isEmpty()) { LOG.error("verifyPasswordStrength failed because newPassword or principalName is null or empty"); return false; } else if (newPassword != null && newPassword.trim().length() < 8) { LOG.error("verifyPasswordStrength failed because newPassword is too short, should be at least 8 chars long"); return false; } else if (newPassword != null && !verifyCharSets(newPassword)) { LOG.error("verifyPasswordStrength failed because newPassword doesn't have a char from each char set"); return false; } if (principalName == null) { principalName = ""; } try { FileBasedAuthenticator.getInstance().verifyPasswordStrength(oldPassword, newPassword, getESAPIUser(principalName)); } catch (AuthenticationException e) { LOG.error("verifyPasswordStrength failed because: " + e.getUserMessage() + " " + e.getLogMessage()); return false; } return true; } }
AuthenticatorHelper { public static boolean verifyPasswordStrength(String oldPassword, String newPassword, String principalName) { if (newPassword == null || newPassword.isEmpty()) { LOG.error("verifyPasswordStrength failed because newPassword or principalName is null or empty"); return false; } else if (newPassword != null && newPassword.trim().length() < 8) { LOG.error("verifyPasswordStrength failed because newPassword is too short, should be at least 8 chars long"); return false; } else if (newPassword != null && !verifyCharSets(newPassword)) { LOG.error("verifyPasswordStrength failed because newPassword doesn't have a char from each char set"); return false; } if (principalName == null) { principalName = ""; } try { FileBasedAuthenticator.getInstance().verifyPasswordStrength(oldPassword, newPassword, getESAPIUser(principalName)); } catch (AuthenticationException e) { LOG.error("verifyPasswordStrength failed because: " + e.getUserMessage() + " " + e.getLogMessage()); return false; } return true; }  }
AuthenticatorHelper { public static boolean verifyPasswordStrength(String oldPassword, String newPassword, String principalName) { if (newPassword == null || newPassword.isEmpty()) { LOG.error("verifyPasswordStrength failed because newPassword or principalName is null or empty"); return false; } else if (newPassword != null && newPassword.trim().length() < 8) { LOG.error("verifyPasswordStrength failed because newPassword is too short, should be at least 8 chars long"); return false; } else if (newPassword != null && !verifyCharSets(newPassword)) { LOG.error("verifyPasswordStrength failed because newPassword doesn't have a char from each char set"); return false; } if (principalName == null) { principalName = ""; } try { FileBasedAuthenticator.getInstance().verifyPasswordStrength(oldPassword, newPassword, getESAPIUser(principalName)); } catch (AuthenticationException e) { LOG.error("verifyPasswordStrength failed because: " + e.getUserMessage() + " " + e.getLogMessage()); return false; } return true; }  static boolean verifyPasswordStrength(String oldPassword, String newPassword, String principalName); }
AuthenticatorHelper { public static boolean verifyPasswordStrength(String oldPassword, String newPassword, String principalName) { if (newPassword == null || newPassword.isEmpty()) { LOG.error("verifyPasswordStrength failed because newPassword or principalName is null or empty"); return false; } else if (newPassword != null && newPassword.trim().length() < 8) { LOG.error("verifyPasswordStrength failed because newPassword is too short, should be at least 8 chars long"); return false; } else if (newPassword != null && !verifyCharSets(newPassword)) { LOG.error("verifyPasswordStrength failed because newPassword doesn't have a char from each char set"); return false; } if (principalName == null) { principalName = ""; } try { FileBasedAuthenticator.getInstance().verifyPasswordStrength(oldPassword, newPassword, getESAPIUser(principalName)); } catch (AuthenticationException e) { LOG.error("verifyPasswordStrength failed because: " + e.getUserMessage() + " " + e.getLogMessage()); return false; } return true; }  static boolean verifyPasswordStrength(String oldPassword, String newPassword, String principalName);  }