This commit is contained in:
2026-08-11 20:02:33 +08:00
parent 1f4b09f0c9
commit d7d33c4e9b
2 changed files with 26 additions and 0 deletions
@@ -0,0 +1,22 @@
package com.baiyue.auth.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 AuthTokenTtlConfigurationContractTest {
@Test
void cnNacosConfigurationKeepsShortAccessAndSevenDayRefreshTokens() throws Exception {
String configuration = Files.readString(
Path.of("..", "config", "nacos", "cn", "auth-service.yml"), StandardCharsets.UTF_8);
assertThat(configuration)
.contains("access-token-ttl: ${ACCESS_TOKEN_TTL:2h}")
.contains("refresh-token-ttl: ${REFRESH_TOKEN_TTL:7d}")
.doesNotContain("access-token-ttl: ${ACCESS_TOKEN_TTL:7d}");
}
}
+4
View File
@@ -4,3 +4,7 @@ spring:
username: ${AUTH_DB_USERNAME}
password: ${AUTH_DB_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver
baiyue:
security:
access-token-ttl: ${ACCESS_TOKEN_TTL:2h}
refresh-token-ttl: ${REFRESH_TOKEN_TTL:7d}