VaultCredentialResolver
@Component public class VaultCredentialResolver
源码Source
io/agentscope/builder/web/managed/VaultCredentialResolver.java:39–363Vault 凭证解析器,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.managed 包。核心成员包括 resolveToolsConfig、resolveSessionToolsConfig、resolveEnvSecrets、VaultCredentialResolver。
Resolves vault credentials into MCP ToolsConfig env substitutions so session vault
mounts actually reach MCP server processes.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public VaultCredentialResolver(VaultService vaultService, VaultCredentialEntityRepository credentialRepository) | 初始化 `VaultCredentialResolver` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public ToolsConfig resolveToolsConfig(String ownerId, ToolsConfig base, List<String> vaultIds) | 解析工具配置。 Patches an in-memory `ToolsConfig` (typically derived from the agent version
snapshot) with vault secrets: substitutes `${ENV}` placeholders and merges
targeted credentials into MCP server env maps. |
public ToolsConfig resolveSessionToolsConfig(ToolsConfig base, List<Map<String, Object>> credentials) | 解析会话工具配置。 Resolves only session-authorized CP credentials. |
public Map<String, String> resolveEnvSecrets(String ownerId, List<String> vaultIds) | 解析 `resolveEnvSecrets`。 Flattens vault credentials into env-var → plaintext secret. |
构造器详情Constructor Detail
VaultCredentialResolver
public VaultCredentialResolver(VaultService vaultService, VaultCredentialEntityRepository credentialRepository)
初始化 VaultCredentialResolver 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
vaultService | VaultService | vault 服务(类型 `VaultService`)。The vault service. |
credentialRepository | VaultCredentialEntityRepository | 凭证仓库(类型 `VaultCredentialEntityRepository`)。The credential repository. |
源码Source
io/agentscope/builder/web/managed/VaultCredentialResolver.java:51–55方法详情Method Detail
resolveToolsConfig
public ToolsConfig resolveToolsConfig(String ownerId, ToolsConfig base, List<String> vaultIds)
解析工具配置。
Patches an in-memory ToolsConfig (typically derived from the agent version snapshot) with vault secrets: substitutes ${ENV} placeholders and merges targeted credentials into MCP server env maps.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ownerId | String | 所有者标识(类型 `String`)。The owner id. |
base | ToolsConfig | 基类(类型 `ToolsConfig`)。config to patch; when `null`, returns `null` |
vaultIds | List<String> | vault Ids(类型 `List`)。The vault ids. |
ToolsConfig返回ToolsConfig。a new patched config, or `base` unchanged when no vault secrets apply
源码Source
io/agentscope/builder/web/managed/VaultCredentialResolver.java:65–87resolveSessionToolsConfig
public ToolsConfig resolveSessionToolsConfig(ToolsConfig base, List<Map<String, Object>> credentials)
解析会话工具配置。
Resolves only session-authorized CP credentials.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
base | ToolsConfig | 基类(类型 `ToolsConfig`)。The base. |
credentials | List<Map<String, Object>> | 凭证(类型 `List >`)。The credentials. |
ToolsConfig返回ToolsConfig。Returns tools config.
源码Source
io/agentscope/builder/web/managed/VaultCredentialResolver.java:90–149resolveEnvSecrets
public Map<String, String> resolveEnvSecrets(String ownerId, List<String> vaultIds)
解析 resolveEnvSecrets。
Flattens vault credentials into env-var → plaintext secret.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ownerId | String | 所有者标识(类型 `String`)。The owner id. |
vaultIds | List<String> | vault Ids(类型 `List`)。The vault ids. |
Map<String, String>返回映射。Returns map.
源码Source
io/agentscope/builder/web/managed/VaultCredentialResolver.java:221–274