优化
This commit is contained in:
@@ -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,3 +4,7 @@ spring:
|
|||||||
username: ${AUTH_DB_USERNAME}
|
username: ${AUTH_DB_USERNAME}
|
||||||
password: ${AUTH_DB_PASSWORD}
|
password: ${AUTH_DB_PASSWORD}
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
baiyue:
|
||||||
|
security:
|
||||||
|
access-token-ttl: ${ACCESS_TOKEN_TTL:2h}
|
||||||
|
refresh-token-ttl: ${REFRESH_TOKEN_TTL:7d}
|
||||||
|
|||||||
Reference in New Issue
Block a user