public boolean authenticate(String attemptedPassword, byte[] encryptedPassword, byte[] salt) {
		if (StringUtils.isBlank(attemptedPassword)) {
			return false;
		}
		// Encrypt the clear-text password using the same salt that was used to
		// encrypt the original password
		byte[] encryptedAttemptedPassword = null;
		try {
			encryptedAttemptedPassword = getEncryptedPassword(attemptedPassword, salt);
		} catch (Exception e) {
			// should never happen
			log.error(e.getMessage(), e);
		}

		if (encryptedAttemptedPassword == null) {
			return false;
		}

		// Authentication succeeds if encrypted password that the user entered
		// is equal to the stored hash
		return MessageDigest.isEqual(encryptedPassword, encryptedAttemptedPassword);
	}
@Test
	void authenticate() {
		String password = "password";
		byte[] salt = "abcdefgh".getBytes();

		PasswordEncryptionService passwordEncryptionService = new PasswordEncryptionService();
		byte[] encryptedPassword = passwordEncryptionService.getEncryptedPassword(password, salt);

		// make sure the encrypted password is always the same for a fixed salt
		Assertions.assertEquals("8b4660158141d9f4f7865718b9a2b940a3e3cea9", HexFormat.of().formatHex(encryptedPassword));
		Assertions.assertTrue(passwordEncryptionService.authenticate(password, encryptedPassword, salt));
	}