Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions docs/dict.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,10 @@
```yaml
opensabre:
governance:
dictionary:
registration-token: ${DICTIONARY_REGISTRATION_TOKEN:${GOVERNANCE_REGISTRATION_TOKEN:${ERROR_CATALOG_REGISTRATION_TOKEN:}}}
registration-token: ENC(...)
```

字典与错误码注册默认共享 `GOVERNANCE_REGISTRATION_TOKEN`。如需能力级隔离,可用
`DICTIONARY_REGISTRATION_TOKEN` 单独覆盖;`ERROR_CATALOG_REGISTRATION_TOKEN` 保留为旧部署兼容回退。
字典与错误码注册统一读取 Nacos 公共配置 `opensabre.governance.registration-token`,推荐使用 Jasypt `ENC(...)` 密文。
服务端使用常量时间比较,且不会在日志、响应或审计中输出凭据。未配置凭据时注册接口默认拒绝请求。

`dictCode` 的首次定义归注册应用所有。管理员维护的存量字典不会被应用自动接管,
Expand Down
7 changes: 3 additions & 4 deletions docs/modules/error-catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@

```yaml
opensabre:
error-catalog:
registration-token: ${ERROR_CATALOG_REGISTRATION_TOKEN:${GOVERNANCE_REGISTRATION_TOKEN:}}
governance:
registration-token: ENC(...)
```

生产环境必须配置非空的公共 `GOVERNANCE_REGISTRATION_TOKEN`,并与所有注册应用保持一致。
如需能力级隔离,可用 `ERROR_CATALOG_REGISTRATION_TOKEN` 覆盖公共凭据。
生产环境必须在 Nacos 公共配置中设置非空的 `opensabre.governance.registration-token`,并由所有注册应用共享。推荐使用 Jasypt `ENC(...)` 密文。

## API

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<parent>
<artifactId>opensabre-base-dependencies</artifactId>
<groupId>io.github.opensabre</groupId>
<version>1.1.1</version>
<version>1.1.2</version>
</parent>

<artifactId>base-sysadmin</artifactId>
<version>1.1.1</version>
<version>1.1.2</version>
<packaging>jar</packaging>

<name>base-sysadmin</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class DictController {
@Resource
private IDictionaryRegistrationService dictionaryRegistrationService;

@Value("${opensabre.governance.dictionary.registration-token:}")
@Value("${opensabre.governance.registration-token:}")
private String dictionaryRegistrationToken;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@RequestMapping("/error-catalog")
public class ErrorCatalogController {
@Resource private IErrorCatalogService errorCatalogService;
@Value("${opensabre.error-catalog.registration-token:}") private String registrationToken;
@Value("${opensabre.governance.registration-token:}") private String registrationToken;
@PostMapping("/snapshots")
public Result<Boolean> register(@RequestBody ErrorCatalogRegistrationRequest snapshot,
@RequestHeader("X-Opensabre-Error-Catalog-Token") String token,
Expand Down
7 changes: 2 additions & 5 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ spring:
maximum-pool-size: 20
# opensabre framework配置
opensabre:
governance:
dictionary:
registration-token: ${DICTIONARY_REGISTRATION_TOKEN:${GOVERNANCE_REGISTRATION_TOKEN:${ERROR_CATALOG_REGISTRATION_TOKEN:}}}
sysadmin:
internal-token:
write-enabled: ${INTERNAL_TOKEN_KEY_WRITE_ENABLED:false}
Expand All @@ -51,8 +48,6 @@ opensabre:
namespace: ${REGISTER_NAMESPACE:}
rotation-grace-period: ${INTERNAL_TOKEN_KEY_ROTATION_GRACE_PERIOD:5m}
required-applications: ${INTERNAL_TOKEN_REQUIRED_APPLICATIONS:base-authorization,base-organization,base-sysadmin,base-gateway-admin}
error-catalog:
registration-token: ${ERROR_CATALOG_REGISTRATION_TOKEN:${GOVERNANCE_REGISTRATION_TOKEN:}}
sensitive:
log:
enabled: false # 日志脱敏开关,默认关闭
Expand Down Expand Up @@ -80,6 +75,8 @@ logging:
level:
io.github.opensabre: debug
java.sql.PreparedStatement: debug
pattern:
level: '%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-},%X{parentSpanId:-}]'

mybatis-plus:
global-config:
Expand Down