chore: copy kept Tastefully modules and portals into Co-Lite
Backend modules from tastefully 8bd93d15: core-libs, core-session, api-gateway, mobile-api, services-auth, services-system, services-counter, services-member, services-log, services-email. solvway-admin-portal from babyboo f64d096ea, solvway-customer-portal from tastefully 8bd93d15. Copied as tracked files only. Literal secrets replaced with environment placeholders: - services-email: SMTP_PASSWORD, MAILGUN_API_KEY, SENDGRID_API_KEY, MAILJET_API_KEY, MAILJET_SECRET_KEY (optional, empty default) - services-system: JUMIO_TOKEN, JUMIO_SECRET (optional) - services-auth: USER_AUTH_API_SECRET (required); commented JWT secret removed - core-libs: JWT_TOKEN default removed (required), XXL_JOB_TOKEN default removed, ipgeolocation key read from IPGEOLOCATION_API_KEY - services-system EkycAppConfig: commented Jumio credentials removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
e396568cc3
commit
5ee51d1913
2918 files changed
+302373
-3
No files matched your search
+55
@@ -0,0 +1,55 @@
|
||||
package com.solvway.mobile.api.util;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class HeaderRedactionUtilTest {
|
||||
|
||||
@Test
|
||||
void redactsAuthorizationHeaderValue() {
|
||||
String headers = "{\"Authorization\":\"Bearer secret-token\",\"User-Agent\":\"junit\"}";
|
||||
|
||||
String redacted = HeaderRedactionUtil.redact(headers);
|
||||
|
||||
assertThat(redacted).doesNotContain("secret-token");
|
||||
assertThat(redacted).contains("[REDACTED]");
|
||||
}
|
||||
|
||||
@Test
|
||||
void preservesNonSensitiveHeaders() {
|
||||
String headers = "{\"Authorization\":\"Bearer secret-token\",\"User-Agent\":\"junit\"}";
|
||||
|
||||
String redacted = HeaderRedactionUtil.redact(headers);
|
||||
|
||||
assertThat(redacted).contains("junit");
|
||||
}
|
||||
|
||||
@Test
|
||||
void redactsRegardlessOfHeaderNameCasing() {
|
||||
String headers = "{\"authorization\":\"Bearer secret-token\"}";
|
||||
|
||||
assertThat(HeaderRedactionUtil.redact(headers)).doesNotContain("secret-token");
|
||||
}
|
||||
|
||||
@Test
|
||||
void redactsApiKeyAndCookieHeaders() {
|
||||
String headers = "{\"api-key\":\"k123\",\"Cookie\":\"session=abc\"}";
|
||||
|
||||
String redacted = HeaderRedactionUtil.redact(headers);
|
||||
|
||||
assertThat(redacted).doesNotContain("k123");
|
||||
assertThat(redacted).doesNotContain("session=abc");
|
||||
}
|
||||
|
||||
@Test
|
||||
void returnsEmptyObjectForUnparseableInput() {
|
||||
assertThat(HeaderRedactionUtil.redact("not-json")).isEqualTo("{}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void handlesNullAndEmptyInput() {
|
||||
assertThat(HeaderRedactionUtil.redact(null)).isNull();
|
||||
assertThat(HeaderRedactionUtil.redact("")).isEmpty();
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.solvway.mobile.api.util.redis;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class TokenCacheKeyUtilTest {
|
||||
|
||||
@Test
|
||||
void hashesTokenToLowercaseHexSha256() {
|
||||
assertThat(TokenCacheKeyUtil.hashToken("abc"))
|
||||
.isEqualTo("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad");
|
||||
}
|
||||
|
||||
@Test
|
||||
void producesStableHashForSameToken() {
|
||||
assertThat(TokenCacheKeyUtil.hashToken("token-1"))
|
||||
.isEqualTo(TokenCacheKeyUtil.hashToken("token-1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void producesDifferentHashesForDifferentTokens() {
|
||||
assertThat(TokenCacheKeyUtil.hashToken("token-1"))
|
||||
.isNotEqualTo(TokenCacheKeyUtil.hashToken("token-2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void neverReturnsTheRawToken() {
|
||||
String token = "eyJhbGciOiJIUzUxMiJ9.payload.signature";
|
||||
assertThat(TokenCacheKeyUtil.hashToken(token)).doesNotContain(token);
|
||||
}
|
||||
|
||||
@Test
|
||||
void returnsEmptyStringForNullOrEmptyToken() {
|
||||
assertThat(TokenCacheKeyUtil.hashToken(null)).isEmpty();
|
||||
assertThat(TokenCacheKeyUtil.hashToken("")).isEmpty();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user