This commit is contained in:
2026-09-01 11:09:14 +08:00
191 changed files with 6486 additions and 403 deletions
@@ -9,6 +9,36 @@ import java.nio.file.Path;
import static org.assertj.core.api.Assertions.assertThat;
class OverseasSecurityValidationDeploymentContractTest {
@Test
void gatewayLocalJwtDefaultsMatchAuthAndLastleg() throws Exception {
String gatewayApplication = read("gateway-overseas/src/main/resources/application.yml");
String lastlegApplication = read("lastleg-service/src/main/resources/application.yml");
String localGateway = read("config/nacos/local/gateway-overseas.yml");
String localLastleg = read("config/nacos/local/lastleg-service.yml");
String localWarehouse = read("config/nacos/local/warehouse-overseas-service.yml");
String remoteGateway = read("config/nacos/overseas/gateway-overseas.yml");
String remoteLastleg = read("config/nacos/overseas/lastleg-service.yml");
String remoteWarehouse = read("config/nacos/overseas/warehouse-overseas-service.yml");
for (String source : new String[]{gatewayApplication, lastlegApplication, localGateway, localLastleg, localWarehouse}) {
assertThat(source)
.contains("${JWT_ISSUER:auth-service}")
.contains("${JWT_AUDIENCE:lastleg-api}")
.contains("${JWT_JWK_SET_URI:http://127.0.0.1:9100/api/auth/.well-known/jwks.json}");
}
assertThat(gatewayApplication).doesNotContain("auth.example.com");
assertThat(localGateway)
.contains("${AUTH_SESSION_VALIDATION_URL:http://127.0.0.1:9100}")
.contains("${LASTLEG_SECURITY_SERVICE_URL:http://127.0.0.1:9303}");
assertThat(localLastleg).contains("${WAREHOUSE_OVERSEAS_SERVICE_URL:http://127.0.0.1:9305}");
assertThat(localWarehouse).contains("${DOMESTIC_WAREHOUSE_URL:http://127.0.0.1:9205}");
assertThat(remoteGateway + remoteLastleg + remoteWarehouse)
.doesNotContain("127.0.0.1", "root", "123456");
assertThat(remoteGateway).contains("${LASTLEG_SECURITY_SERVICE_URL:http://lastleg-service:9303}");
assertThat(remoteLastleg).contains("${LASTLEG_DB_URL}", "${LASTLEG_DB_USERNAME}", "${LASTLEG_DB_PASSWORD}");
assertThat(remoteWarehouse).contains("${WAREHOUSE_DB_URL}", "${WAREHOUSE_DB_USERNAME}", "${WAREHOUSE_DB_PASSWORD}");
}
@Test
void gatewayAndEventBridgeUseLastlegSecurityEndpointsWithoutTheRetiredService() throws Exception {
String client = read("gateway-overseas/src/main/java/com/baiyue/gateway/filter/HttpOverseasSecurityValidationClient.java");