Skip to content

Commit 6cd6523

Browse files
authored
Fix typo with the function name with no impact to the code. (#1167)
1 parent 72b8c1d commit 6cd6523

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

iam-login-service/src/main/java/it/infn/mw/iam/api/account/multi_factor_authentication/DefaultIamTotpMfaService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public IamTotpMfa addTotpMfaSecret(IamAccount account) throws IamTotpMfaInvalidA
115115
IamTotpMfa totpMfa = new IamTotpMfa(account);
116116

117117
totpMfa.setSecret(IamTotpMfaEncryptionAndDecryptionUtil.encryptSecret(
118-
secretGenerator.generate(), iamTotpMfaProperties.getPasswordToEncryptOrDecrypt()));
118+
secretGenerator.generate(), iamTotpMfaProperties.getPasswordToEncryptAndDecrypt()));
119119
totpMfa.setAccount(account);
120120

121121
totpMfaRepository.save(totpMfa);
@@ -189,7 +189,7 @@ public boolean verifyTotp(IamAccount account, String totp) throws IamTotpMfaInva
189189

190190
IamTotpMfa totpMfa = totpMfaOptional.get();
191191
String mfaSecret = IamTotpMfaEncryptionAndDecryptionUtil.decryptSecret(
192-
totpMfa.getSecret(), iamTotpMfaProperties.getPasswordToEncryptOrDecrypt());
192+
totpMfa.getSecret(), iamTotpMfaProperties.getPasswordToEncryptAndDecrypt());
193193

194194
// Verify provided TOTP
195195
if (codeVerifier.isValidCode(mfaSecret, totp)) {

iam-login-service/src/main/java/it/infn/mw/iam/api/account/multi_factor_authentication/authenticator_app/AuthenticatorAppSettingsController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public SecretAndDataUriDTO addSecret() throws IamTotpMfaInvalidArgumentError {
9292

9393
IamTotpMfa totpMfa = service.addTotpMfaSecret(account);
9494
String mfaSecret = IamTotpMfaEncryptionAndDecryptionUtil.decryptSecret(totpMfa.getSecret(),
95-
iamTotpMfaProperties.getPasswordToEncryptOrDecrypt());
95+
iamTotpMfaProperties.getPasswordToEncryptAndDecrypt());
9696

9797
try {
9898
SecretAndDataUriDTO dto = new SecretAndDataUriDTO(mfaSecret);

iam-login-service/src/main/java/it/infn/mw/iam/config/mfa/IamTotpMfaProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class IamTotpMfaProperties {
2727
private String oldPasswordToDecrypt;
2828
private boolean multiFactorMandatory;
2929

30-
public String getPasswordToEncryptOrDecrypt() {
30+
public String getPasswordToEncryptAndDecrypt() {
3131
return passwordToEncryptAndDecrypt;
3232
}
3333

iam-login-service/src/test/java/it/infn/mw/iam/test/api/account/multi_factor_authentication/authenticator_app/AuthenticationAppSettingsTotpTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static void init() {
8686
void setup() {
8787
when(accountRepository.findByUsername(TEST_USERNAME)).thenReturn(Optional.of(TEST_ACCOUNT));
8888
when(accountRepository.findByUsername(TOTP_USERNAME)).thenReturn(Optional.of(TOTP_MFA_ACCOUNT));
89-
when(iamTotpMfaProperties.getPasswordToEncryptOrDecrypt()).thenReturn(KEY_TO_ENCRYPT_DECRYPT);
89+
when(iamTotpMfaProperties.getPasswordToEncryptAndDecrypt()).thenReturn(KEY_TO_ENCRYPT_DECRYPT);
9090

9191
mvc =
9292
MockMvcBuilders.webAppContextSetup(context).apply(springSecurity()).alwaysDo(log()).build();
@@ -100,7 +100,7 @@ void testAddSecretThrowsQrGenerationException() throws Exception {
100100

101101
IamTotpMfa totpMfa = cloneTotpMfa(TOTP_MFA);
102102
totpMfa.setSecret(IamTotpMfaEncryptionAndDecryptionUtil.encryptSecret(TOTP_MFA_SECRET,
103-
iamTotpMfaProperties.getPasswordToEncryptOrDecrypt()));
103+
iamTotpMfaProperties.getPasswordToEncryptAndDecrypt()));
104104
when(totpMfaService.addTotpMfaSecret(account)).thenReturn(totpMfa);
105105

106106
when(totpMfaService.generateQRCodeFromSecret(TOTP_MFA_SECRET, account.getUsername())).thenThrow(
@@ -124,7 +124,7 @@ void testEnableAuthenticatorAppViaOauthAuthn() throws Exception {
124124
totpMfa.setActive(true);
125125
totpMfa.setAccount(account);
126126
totpMfa.setSecret(IamTotpMfaEncryptionAndDecryptionUtil.encryptSecret(TOTP_MFA_SECRET,
127-
iamTotpMfaProperties.getPasswordToEncryptOrDecrypt()));
127+
iamTotpMfaProperties.getPasswordToEncryptAndDecrypt()));
128128
String totp = "123456";
129129

130130
when(totpMfaService.verifyTotp(account, totp)).thenReturn(true);

iam-login-service/src/test/java/it/infn/mw/iam/test/api/account/multi_factor_authentication/authenticator_app/AuthenticatorAppSettingsControllerTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static void init() {
8989
void setup() {
9090
when(accountRepository.findByUsername(TEST_USERNAME)).thenReturn(Optional.of(TEST_ACCOUNT));
9191
when(accountRepository.findByUsername(TOTP_USERNAME)).thenReturn(Optional.of(TOTP_MFA_ACCOUNT));
92-
when(iamTotpMfaProperties.getPasswordToEncryptOrDecrypt()).thenReturn(KEY_TO_ENCRYPT_DECRYPT);
92+
when(iamTotpMfaProperties.getPasswordToEncryptAndDecrypt()).thenReturn(KEY_TO_ENCRYPT_DECRYPT);
9393

9494
mvc =
9595
MockMvcBuilders.webAppContextSetup(context).apply(springSecurity()).alwaysDo(log()).build();
@@ -103,7 +103,7 @@ void testAddSecret() throws Exception {
103103
totpMfa.setActive(false);
104104
totpMfa.setAccount(null);
105105
totpMfa.setSecret(IamTotpMfaEncryptionAndDecryptionUtil.encryptSecret(TOTP_MFA_SECRET,
106-
iamTotpMfaProperties.getPasswordToEncryptOrDecrypt()));
106+
iamTotpMfaProperties.getPasswordToEncryptAndDecrypt()));
107107
when(totpMfaService.addTotpMfaSecret(account)).thenReturn(totpMfa);
108108

109109
mvc.perform(put(ADD_SECRET_URL)).andExpect(status().isOk());
@@ -120,7 +120,7 @@ void testAddSecretThrowsMfaSecretAlreadyBoundException() throws Exception {
120120
totpMfa.setActive(false);
121121
totpMfa.setAccount(null);
122122
totpMfa.setSecret(IamTotpMfaEncryptionAndDecryptionUtil.encryptSecret(TOTP_MFA_SECRET,
123-
iamTotpMfaProperties.getPasswordToEncryptOrDecrypt()));
123+
iamTotpMfaProperties.getPasswordToEncryptAndDecrypt()));
124124
when(totpMfaService.addTotpMfaSecret(account)).thenThrow(new MfaSecretAlreadyBoundException(
125125
"A multi-factor secret is already assigned to this account"));
126126

@@ -138,10 +138,10 @@ void testAddSecret_withEmptyPassword() throws Exception {
138138
totpMfa.setActive(false);
139139
totpMfa.setAccount(null);
140140
totpMfa.setSecret(IamTotpMfaEncryptionAndDecryptionUtil.encryptSecret(TOTP_MFA_SECRET,
141-
iamTotpMfaProperties.getPasswordToEncryptOrDecrypt()));
141+
iamTotpMfaProperties.getPasswordToEncryptAndDecrypt()));
142142

143143
when(totpMfaService.addTotpMfaSecret(account)).thenReturn(totpMfa);
144-
when(iamTotpMfaProperties.getPasswordToEncryptOrDecrypt()).thenReturn("");
144+
when(iamTotpMfaProperties.getPasswordToEncryptAndDecrypt()).thenReturn("");
145145

146146
NestedServletException thrownException = assertThrows(NestedServletException.class, () -> {
147147
mvc.perform(put(ADD_SECRET_URL));
@@ -172,7 +172,7 @@ void testEnableAuthenticatorApp() throws Exception {
172172
totpMfa.setActive(true);
173173
totpMfa.setAccount(account);
174174
totpMfa.setSecret(IamTotpMfaEncryptionAndDecryptionUtil.encryptSecret(TOTP_MFA_SECRET,
175-
iamTotpMfaProperties.getPasswordToEncryptOrDecrypt()));
175+
iamTotpMfaProperties.getPasswordToEncryptAndDecrypt()));
176176
String totp = "123456";
177177

178178
when(totpMfaService.verifyTotp(account, totp)).thenReturn(true);

iam-login-service/src/test/java/it/infn/mw/iam/test/multi_factor_authentication/IamTotpMfaServiceTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class IamTotpMfaServiceTests extends IamTotpMfaServiceTestSupport {
103103

104104
@BeforeEach
105105
void setup() {
106-
lenient().when(iamTotpMfaProperties.getPasswordToEncryptOrDecrypt())
106+
lenient().when(iamTotpMfaProperties.getPasswordToEncryptAndDecrypt())
107107
.thenReturn(KEY_TO_ENCRYPT_DECRYPT);
108108

109109
lenient().when(secretGenerator.generate()).thenReturn("test_secret");
@@ -157,7 +157,7 @@ void testAddMfaSecretWhenTotpIsNotActive() {
157157
@Test
158158
void testAddTotpMfaSecretWhenPasswordIsEmpty() {
159159
lenient().when(repository.findByAccount(TOTP_MFA_ACCOUNT)).thenReturn(Optional.empty());
160-
lenient().when(iamTotpMfaProperties.getPasswordToEncryptOrDecrypt()).thenReturn("");
160+
lenient().when(iamTotpMfaProperties.getPasswordToEncryptAndDecrypt()).thenReturn("");
161161

162162
IamAccount account = cloneAccount(TOTP_MFA_ACCOUNT);
163163

@@ -173,7 +173,7 @@ void testEnablesTotpMfa() throws Exception {
173173
IamAccount account = cloneAccount(TOTP_MFA_ACCOUNT);
174174
IamTotpMfa totpMfa = cloneTotpMfa(TOTP_MFA);
175175
totpMfa.setSecret(IamTotpMfaEncryptionAndDecryptionUtil.encryptSecret("secret",
176-
iamTotpMfaProperties.getPasswordToEncryptOrDecrypt()));
176+
iamTotpMfaProperties.getPasswordToEncryptAndDecrypt()));
177177
totpMfa.setActive(false);
178178
totpMfa.setAccount(account);
179179

@@ -269,7 +269,7 @@ void testVerifyTotpWithEmptyPasswordForDecryption() {
269269
IamTotpMfa totpMfa = cloneTotpMfa(TOTP_MFA);
270270

271271
lenient().when(repository.findByAccount(TOTP_MFA_ACCOUNT)).thenReturn(Optional.of(totpMfa));
272-
lenient().when(iamTotpMfaProperties.getPasswordToEncryptOrDecrypt()).thenReturn("");
272+
lenient().when(iamTotpMfaProperties.getPasswordToEncryptAndDecrypt()).thenReturn("");
273273

274274
IamAccount account = cloneAccount(TOTP_MFA_ACCOUNT);
275275

0 commit comments

Comments
 (0)