Skip to content

Commit 862ca74

Browse files
rafapraxbrianchandotcom
authored andcommitted
LPD-43475 SF, inline
1 parent 38c0a06 commit 862ca74

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

modules/apps/portal-security/portal-security-password-encryptor-impl/src/main/java/com/liferay/portal/security/password/encryptor/internal/BCryptPasswordEncryptor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ public String getEncryptionAlgorithmConfiguration(
6969
rounds = matcher.group(1);
7070
}
7171

72-
String algorithm = encryptedPassword.substring(
73-
1, encryptedPassword.indexOf(CharPool.CLOSE_CURLY_BRACE));
74-
75-
return StringBundler.concat(algorithm, CharPool.FORWARD_SLASH, rounds);
72+
return StringBundler.concat(
73+
encryptedPassword.substring(
74+
1, encryptedPassword.indexOf(CharPool.CLOSE_CURLY_BRACE)),
75+
CharPool.FORWARD_SLASH, rounds);
7676
}
7777

7878
private static final int _ROUNDS = 10;

modules/apps/portal-security/portal-security-password-encryptor-impl/src/main/java/com/liferay/portal/security/password/encryptor/internal/PBKDF2PasswordEncryptor.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,8 @@ public String getEncryptionAlgorithmConfiguration(
105105
pbkdf2EncryptionConfiguration.configure(
106106
StringPool.BLANK, encryptedPassword.substring(index + 1));
107107

108-
String algorithm = encryptedPassword.substring(1, index);
109-
110108
return StringBundler.concat(
111-
algorithm, StringPool.FORWARD_SLASH,
109+
encryptedPassword.substring(1, index), StringPool.FORWARD_SLASH,
112110
pbkdf2EncryptionConfiguration.getKeySize(),
113111
StringPool.FORWARD_SLASH,
114112
pbkdf2EncryptionConfiguration.getRounds());

modules/apps/user/user-test/src/testIntegration/java/com/liferay/user/service/test/UserLocalServiceTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,16 +1515,14 @@ private void _assertUserHasPasswordPolicy(boolean ldapUser, User user)
15151515

15161516
User user = UserTestUtil.addUser();
15171517

1518-
String password = "password";
1519-
15201518
try (AutoCloseable autoCloseable =
15211519
ReflectionTestUtil.setFieldValueWithAutoCloseable(
15221520
PasswordEncryptorUtil.class,
15231521
"_PASSWORDS_ENCRYPTION_ALGORITHM",
15241522
oldPasswordsEncryptionAlgorithm)) {
15251523

15261524
user = _userLocalService.updatePassword(
1527-
user.getUserId(), password, password, false, true);
1525+
user.getUserId(), "password", "password", false, true);
15281526

15291527
Assert.assertEquals(
15301528
oldPasswordsEncryptionAlgorithm,
@@ -1547,7 +1545,7 @@ private void _assertUserHasPasswordPolicy(boolean ldapUser, User user)
15471545
Authenticator.SUCCESS,
15481546
_userLocalService.authenticateByEmailAddress(
15491547
user.getCompanyId(), user.getDisplayEmailAddress(),
1550-
password, null, null, null));
1548+
"password", null, null, null));
15511549

15521550
user = _userLocalService.getUser(user.getUserId());
15531551

portal-kernel/src/com/liferay/portal/kernel/security/pwd/PasswordEncryptorUtil.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,8 @@ public static String encrypt(
8383
public static String getEncryptionAlgorithmConfiguration(
8484
String encryptedPassword) {
8585

86-
String algorithm = _getEncryptedPasswordAlgorithm(encryptedPassword);
87-
88-
PasswordEncryptor passwordEncryptor = _select(algorithm);
86+
PasswordEncryptor passwordEncryptor = _select(
87+
_getEncryptedPasswordAlgorithm(encryptedPassword));
8988

9089
return passwordEncryptor.getEncryptionAlgorithmConfiguration(
9190
encryptedPassword);

0 commit comments

Comments
 (0)