feat: 配置导出/导入支持 LDAP 和 OAuth Provider

- 新增配置格式 v2.1,支持导出/导入 LDAP 配置和 OAuth Providers
- 导出时解密敏感字段(bind_password, client_secret, provider_ops credentials)
- 导入时加密敏感字段后存储
- 前端支持预览和显示 LDAP/OAuth 导入结果
This commit is contained in:
fawney19
2026-01-28 12:56:37 +08:00
parent 4cd196f665
commit 95fc848e59
3 changed files with 365 additions and 8 deletions

View File

@@ -538,6 +538,10 @@
<li>
API Keys: {{ importPreview.providers?.reduce((sum: number, p: any) => sum + (p.api_keys?.length || 0), 0) }}
</li>
<li v-if="importPreview.ldap_config">LDAP 配置: 1 </li>
<li v-if="importPreview.oauth_providers?.length">
OAuth Providers: {{ importPreview.oauth_providers.length }}
</li>
</ul>
</div>
@@ -655,6 +659,26 @@
跳过: {{ importResult.stats.models.skipped }}
</p>
</div>
<div v-if="importResult.stats.ldap">
<p class="font-medium">
LDAP 配置
</p>
<p class="text-muted-foreground">
创建: {{ importResult.stats.ldap.created }},
更新: {{ importResult.stats.ldap.updated }},
跳过: {{ importResult.stats.ldap.skipped }}
</p>
</div>
<div v-if="importResult.stats.oauth">
<p class="font-medium">
OAuth Providers
</p>
<p class="text-muted-foreground">
创建: {{ importResult.stats.oauth.created }},
更新: {{ importResult.stats.oauth.updated }},
跳过: {{ importResult.stats.oauth.skipped }}
</p>
</div>
</div>
<div
@@ -1293,8 +1317,8 @@ function handleConfigFileSelect(event: Event) {
const content = e.target?.result as string
const data = JSON.parse(content) as ConfigExportData
// 验证版本
if (data.version !== '2.0') {
// 验证版本(支持 2.0 和 2.1
if (!['2.0', '2.1'].includes(data.version)) {
error(`不支持的配置版本: ${data.version}`)
return
}