From a12f2fc1baa7e704b53dbb7f7394c1dca5e2bf1d Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Thu, 3 Aug 2023 13:54:43 -0400 Subject: [PATCH] Confirm passwords are diff Signed-off-by: Stephen Crawford --- .../org/opensearch/security/dlic/rest/api/UserApiTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/opensearch/security/dlic/rest/api/UserApiTest.java b/src/test/java/org/opensearch/security/dlic/rest/api/UserApiTest.java index 7a275e6087..659074f216 100644 --- a/src/test/java/org/opensearch/security/dlic/rest/api/UserApiTest.java +++ b/src/test/java/org/opensearch/security/dlic/rest/api/UserApiTest.java @@ -39,6 +39,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertNotEquals; import static org.opensearch.security.OpenSearchSecurityPlugin.PLUGINS_PREFIX; import static org.opensearch.security.dlic.rest.api.InternalUsersApiAction.RESTRICTED_FROM_USERNAME; import static org.opensearch.security.support.ConfigConstants.SECURITY_RESTAPI_ADMIN_ENABLED; @@ -1030,6 +1031,10 @@ public void testGeneratedPasswordContents() { org.passay.PasswordValidator validator = new org.passay.PasswordValidator(lengthRule, characteristicsRule); validator.validate(data); - } + String password2 = UserService.generatePassword(); + PasswordData data2 = new PasswordData(password2); + assertNotEquals(password, password2); + assertNotEquals(data, data2); + } }