FINERACT-2081: External service credential values masked

This commit is contained in:
Jose Alberto Hernandez
2025-04-14 16:05:21 +02:00
committed by Adam Saghy
parent 07ea81e399
commit b4b2ef3701
7 changed files with 116 additions and 8 deletions
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.integrationtests;
import static org.junit.jupiter.api.Assertions.assertTrue;
import io.restassured.builder.RequestSpecBuilder;
import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.ContentType;
@@ -83,7 +85,6 @@ public class ExternalServicesConfigurationTest {
}
// Checking for SMTP:
configName = "username";
externalServicesConfig = ExternalServicesConfigurationHelper.getExternalServicesConfigurationByServiceName(requestSpec,
responseSpec, "SMTP");
@@ -111,6 +112,28 @@ public class ExternalServicesConfigurationTest {
}
// Checking for Notifications:
configName = "server_key";
externalServicesConfig = ExternalServicesConfigurationHelper.getExternalServicesConfigurationByServiceName(requestSpec,
responseSpec, "NOTIFICATION");
Assertions.assertNotNull(externalServicesConfig);
for (Integer configIndex = 0; configIndex < externalServicesConfig.size(); configIndex++) {
String name = (String) externalServicesConfig.get(configIndex).get("name");
String value = null;
if (name.equals(configName)) {
value = (String) externalServicesConfig.get(configIndex).get("value");
if (value == null) {
value = "testnull";
}
LOG.info("{} : {}", name, value);
assertTrue(hasMoreThanThreeStars(value));
}
}
}
private boolean hasMoreThanThreeStars(String input) {
return input != null && input.matches("(.*\\*.*){4,}");
}
}