创建IdP配置
更新时间:2026-07-14
创建IdP配置
- 为用户池创建身份提供商(IdP)配置。DINGTALK / FEISHU provider 提供预置默认端点值,CUSTOM 需自行指定或提供 discoveryUrl。
OpenAPI Explorer
去调试
您可以在 OpenAPI Explorer 中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer 可以自动生成 SDK 代码示例。
请求结构
Plain Text
1POST /v{version}/agent-identity/user-pool/idp-config/create HTTP/1.1
2Host: identity.baidubce.com
3Authorization: authorization string
请求头域
除公共头域外,无其他特殊头域
请求参数
| 参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
|---|---|---|---|---|
| version | String | 是 | URL参数 | API版本号 |
| userPoolId | String | 是 | RequestBody参数 | 用户池 ID |
| name | String | 是 | RequestBody参数 | IdP 显示名称(1-64字符,池内唯一) |
| idpType | String | 是 | RequestBody参数 | 协议类型:OAUTH2 / OIDC / CAS |
| idpProvider | String | 否 | RequestBody参数 | (条件必填)OAuth2 提供方:CUSTOM / DINGTALK / FEISHU;仅 idpType=OAUTH2 时必填,OIDC/CAS 时必须为 null |
| clientId | String | 否 | RequestBody参数 | (条件必填)OAuth2 client_id(OAuth2 协议必填) |
| clientSecret | String | 否 | RequestBody参数 | (条件必填)OAuth2 client_secret 明文(OAuth2 协议必填,加密存储) |
| discoveryUrl | String | 否 | RequestBody参数 | OAuth2/OIDC Discovery URL(提供后自动解析端点) |
| authorizationEndpoint | String | 否 | RequestBody参数 | (条件必填)授权端点(idpProvider=CUSTOM 且无 discoveryUrl 时必填) |
| tokenEndpoint | String | 否 | RequestBody参数 | (条件必填)Token 端点(idpProvider=CUSTOM 且无 discoveryUrl 时必填) |
| userinfoEndpoint | String | 否 | RequestBody参数 | (条件必填)UserInfo 端点(idpProvider=CUSTOM 且无 discoveryUrl 时必填) |
| scopes | List |
否 | RequestBody参数 | 请求的 scope 列表 |
| userIdClaim | String | 否 | RequestBody参数 | IdP 用户信息中映射到本地 username 的字段名 |
| displayNameClaim | String | 否 | RequestBody参数 | IdP 用户信息中映射到本地 displayName 的字段名 |
| autoCreateUser | Boolean | 否 | RequestBody参数 | 登录时用户不存在是否自动创建,默认 false |
返回状态码
成功返回200,失败返回见错误码
返回头域
除公共头域外,无其他特殊头域
返回参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| id | String | IdP 配置 ID |
| name | String | 显示名称 |
| idpType | String | 协议类型:OAUTH2 / OIDC / CAS |
| idpProvider | String | OAuth2 提供方:CUSTOM / DINGTALK / FEISHU;非 OAuth2 为 null |
| clientId | String | OAuth2 client_id |
| clientSecret | String | client_secret(get 返回明文,list 不返回) |
| discoveryUrl | String | Discovery URL |
| authorizationEndpoint | String | 授权端点 |
| tokenEndpoint | String | Token 端点 |
| userinfoEndpoint | String | UserInfo 端点 |
| scopes | List |
请求的 scope |
| userIdClaim | String | 用户 ID 映射字段 |
| displayNameClaim | String | 显示名称映射字段 |
| autoCreateUser | Boolean | 是否自动创建用户 |
| enabled | Boolean | 是否启用 |
| callbackUrl | String | 统一 IdP 回调地址(运行时派生) |
| createdAt | DateTime | 创建时间 |
请求示例
Plain Text
1{
2 "userPoolId": "01961a2b3c4d5e6f7890abcdef123456",
3 "name": "企业钉钉",
4 "idpType": "OAUTH2",
5 "idpProvider": "DINGTALK",
6 "clientId": "dingxxxxxxxx",
7 "clientSecret": "xxxxxxxxxxxxxxxx",
8 "autoCreateUser": true
9}
返回示例
Plain Text
1{
2 "id": "01961c3d4e5f6a7b8901cdef23456789",
3 "name": "企业钉钉",
4 "idpType": "OAUTH2",
5 "idpProvider": "DINGTALK",
6 "clientId": "dingxxxxxxxx",
7 "clientSecret": "xxxxxxxxxxxxxxxx",
8 "authorizationEndpoint": "https://login.dingtalk.com/oauth2/auth",
9 "tokenEndpoint": "https://api.dingtalk.com/v1.0/oauth2/userAccessToken",
10 "userinfoEndpoint": "https://api.dingtalk.com/v1.0/contact/users/me",
11 "scopes": ["openid", "corpid"],
12 "userIdClaim": "unionId",
13 "displayNameClaim": "nick",
14 "autoCreateUser": true,
15 "enabled": true,
16 "callbackUrl": "https://identity.bce.baidu.com/v1/agent-identity/inbound/callback/01961a2b3c4d5e6f7890abcdef123456",
17 "createdAt": "2025-06-01T00:00:00Z"
18}
评价此篇文章
