fix(deploy): allow expanded authorization headers
This commit is contained in:
@@ -55,6 +55,7 @@ logging:
|
|||||||
path: ${LOG_PATH:/app/logs}
|
path: ${LOG_PATH:/app/logs}
|
||||||
server:
|
server:
|
||||||
shutdown: graceful
|
shutdown: graceful
|
||||||
|
max-http-request-header-size: ${SERVER_MAX_HTTP_REQUEST_HEADER_SIZE:32KB}
|
||||||
management:
|
management:
|
||||||
endpoints:
|
endpoints:
|
||||||
web:
|
web:
|
||||||
|
|||||||
@@ -50,7 +50,9 @@ spring:
|
|||||||
logging:
|
logging:
|
||||||
file:
|
file:
|
||||||
path: ${LOG_PATH:./logs}
|
path: ${LOG_PATH:./logs}
|
||||||
server.shutdown: graceful
|
server:
|
||||||
|
shutdown: graceful
|
||||||
|
max-http-request-header-size: ${SERVER_MAX_HTTP_REQUEST_HEADER_SIZE:32KB}
|
||||||
management:
|
management:
|
||||||
endpoints.web.exposure.include: health,info,prometheus
|
endpoints.web.exposure.include: health,info,prometheus
|
||||||
endpoint.health:
|
endpoint.health:
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ x-common: &common
|
|||||||
REDIS_DATABASE: ${REDIS_DATABASE:-0}
|
REDIS_DATABASE: ${REDIS_DATABASE:-0}
|
||||||
JWT_SECRET: ${JWT_SECRET}
|
JWT_SECRET: ${JWT_SECRET}
|
||||||
INTERNAL_SERVICE_TOKEN: ${INTERNAL_SERVICE_TOKEN}
|
INTERNAL_SERVICE_TOKEN: ${INTERNAL_SERVICE_TOKEN}
|
||||||
|
SERVER_MAX_HTTP_REQUEST_HEADER_SIZE: ${SERVER_MAX_HTTP_REQUEST_HEADER_SIZE:-32KB}
|
||||||
AUDIT_OUTBOX_ENABLED: ${AUDIT_OUTBOX_ENABLED:-false}
|
AUDIT_OUTBOX_ENABLED: ${AUDIT_OUTBOX_ENABLED:-false}
|
||||||
AUDIT_OUTBOX_PUBLISHER_ENABLED: ${AUDIT_OUTBOX_PUBLISHER_ENABLED:-false}
|
AUDIT_OUTBOX_PUBLISHER_ENABLED: ${AUDIT_OUTBOX_PUBLISHER_ENABLED:-false}
|
||||||
REGION_CODE: ${REGION_CODE:-CN}
|
REGION_CODE: ${REGION_CODE:-CN}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.baiyue.gateway.config;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
class DeploymentHeaderSizeContractTest {
|
||||||
|
private static final String PROPERTY =
|
||||||
|
"max-http-request-header-size: ${SERVER_MAX_HTTP_REQUEST_HEADER_SIZE:32KB}";
|
||||||
|
private static final String ENVIRONMENT =
|
||||||
|
"SERVER_MAX_HTTP_REQUEST_HEADER_SIZE: ${SERVER_MAX_HTTP_REQUEST_HEADER_SIZE:-32KB}";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void allowsAuthorizationTokensAndTrustedIdentityHeadersAcrossAllServices() throws Exception {
|
||||||
|
assertThat(readRepositoryFile("deploy", "docker-compose.yml")).contains(ENVIRONMENT);
|
||||||
|
assertThat(readRepositoryFile("config", "nacos", "cn", "baiyue-common.yml")).contains(PROPERTY);
|
||||||
|
assertThat(readRepositoryFile("config", "nacos", "local", "baiyue-common.yml")).contains(PROPERTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String readRepositoryFile(String first, String... more) throws Exception {
|
||||||
|
Path path = Path.of(first, more);
|
||||||
|
if (!Files.exists(path)) {
|
||||||
|
path = Path.of("..").resolve(path).normalize();
|
||||||
|
}
|
||||||
|
return Files.readString(path, StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user