SCIM 的 REST API 端点
使用 REST API 通过 SCIM 自动创建用户和团队成员身份。
注意:
- 这些终结点允许你使用 SCIM 在GitHub Enterprise Cloud上预配企业的用户帐户。 此操作仅适用于Enterprise Managed Users。 如果不使用Enterprise Managed Users并且想要使用 SCIM 预配对组织的访问权限,请参阅“SCIM 的 REST API 端点”。
- GitHub 建议在与 IdP 和 GitHub 上的生产数据隔离的环境中测试预配。
关于 SCIM
若要在 GitHub 上为企业成员创建、管理和停用用户帐户,IdP 必须实施 SCIM,以便与 GitHub 通信。 SCIM 是一种管理不同系统间用户标识的开放规范。 不同的 IdP 提供不同的 SCIM 预配配置体验。如果没有将合作伙伴 IdP 与现有集成配合使用,则可以使用以下 API 端点进行集成。 有关详细信息,请参阅“使用 REST API 通过 SCIM 预配用户和组”。
基 URL
要使用 SCIM 管理企业的用户和组,请使用以下基 URL 与此类别中的端点通信。
https://api.github.com/scim/v2/enterprises/{enterprise}/
身份验证
若要对 API 请求进行身份验证,在 IdP 上配置 SCIM 的用户必须使用具有 scim:enterprise
作用域的 personal access token (classic),IdP 必须在请求的 Authorization
标头中提供该信息。 有关 personal access tokens (classic) 的详细信息,请参阅“管理个人访问令牌”。
GitHub 建议作为企业设置用户进行身份验证。 其他用户帐户是通过 SCIM 创建的,因此如果以其他用户身份进行身份验证,可能会导致意外后果,例如被锁定在企业之外。 可以通过我们发布的 IdP 应用程序发出对这些 API 的写入请求,也可通过对 SCIM 端点的直接 API 访问来完成此操作。 如果其他企业所有者需要通过 API 读取信息,请使用具有 admin:enterprise
作用域的 personal access token (classic),对当前 SCIM 实现发出 GET
请求。 有关详细信息,请参阅“为企业托管用户配置 SCIM 预配”。
SAML 和 SCIM 数据的映射
托管用户帐户 成功通过身份验证以使用 SAML SSO 访问企业后,GitHub Enterprise Cloud 会将用户链接到 SCIM 预配的标识。 要成功链接标识,SAML 标识提供者和 SCIM 集成必须使用匹配的唯一标识符。
GitHub 需要有以下 SAML 声明和 SCIM 属性才能成功地将用户与 SCIM 预配的身份匹配。 标识提供者在用于唯一标识用户的字段中可能有所不同。
将 Microsoft Entra ID 用于 SAML
要将 Entra ID(以前称为 Azure AD)用于 SAML,以下 SAML 声明和 SCIM 属性必须匹配。
SAML 声明 | 匹配的 SCIM 属性 |
---|---|
http://schemas.microsoft.com/identity/claims/objectidentifier | externalId |
用于 SAML 的其他 IDP
要将其他 IdP 用于 SAML,以下 SAML 声明和 SCIM 属性必须匹配。
SAML 声明 | 匹配的 SCIM 属性 |
---|---|
NameID | userName |
支持的 SCIM 用户属性
此类别中的 Users
终结点支持在请求参数中使用以下属性。
名称 | Type | 说明 |
---|---|---|
displayName | String | 用户的人类可读名称。 |
name.formatted | String | 用户的全名,包括所有中间名、称谓和后缀,经过格式化以便显示。 |
name.givenName | String | 用户的名字。 |
name.familyName | String | 用户的姓氏。 |
userName | 字符串 | 由 SCIM 提供程序为用户生成的用户名。 使用前经过规范化处理。 每个用户必须唯一。 |
emails | 数组 | 用户的电子邮件列表。 |
roles | Array | 用户角色的列表。 |
externalId | 字符串 | 此标识符由 SCIM 提供程序生成。 每个用户必须唯一。 |
id | 字符串 | GitHub 的 SCIM 端点生成的标识符。 |
active | 布尔 | 指示标识处于活动状态 (true ) 还是应暂停 (false )。 |
支持的 SCIM 组属性
此类别中的 Groups
终结点支持在请求参数中使用以下属性。
名称 | Type | 说明 |
---|---|---|
displayName | 字符串 | 人类可读的组名。 |
members | 字符串 | 在 SCIM 提供程序中分配给组的成员列表 |
externalId | 字符串 | 此标识符由 SCIM 提供程序生成。 每个用户必须唯一。 |
List provisioned SCIM groups for an enterprise
Note
SCIM provisioning for users and groups using the REST API is in public preview and subject to change.
Lists provisioned SCIM groups in an enterprise.
You can improve query search time by using the excludedAttributes
query parameter with a value of members
to exclude members from the response.
“List provisioned SCIM groups for an enterprise”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Enterprise administration" business permissions (write)
“List provisioned SCIM groups for an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
名称, 类型, 说明 |
---|
filter string If specified, only results that match the specified filter will be returned. Multiple filters are not supported. Possible filters are |
excludedAttributes string Excludes the specified attribute from being returned in the results. Using this parameter can speed up response time. |
startIndex integer Used for pagination: the starting index of the first result to return when paginating through values. 默认: |
count integer Used for pagination: the number of results to return per page. 默认: |
“List provisioned SCIM groups for an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | Success, either groups were found or not found |
400 | Bad request |
401 | Authorization failure |
403 | Permission denied |
429 | Too many requests |
500 | Internal server error |
“List provisioned SCIM groups for an enterprise”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
请求示例
curl -L \
-H "Accept: application/scim+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/scim/v2/enterprises/ENTERPRISE/Groups
Success, either groups were found or not found
Status: 200
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:ListResponse"
],
"totalResults": 1,
"Resources": [
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"externalId": "8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159",
"id": "927fa2c08dcb4a7fae9e",
"displayName": "Engineering",
"members": [
{
"value": "879db59-3bdf-4490-ad68-ab880a2694745",
"$+ref": "https://api.github.localhost/scim/v2/Users/879db59-3bdf-4490-ad68-ab880a2694745",
"displayName": "User 1"
},
{
"value": "0db508eb-91e2-46e4-809c-30dcbda0c685",
"$+ref": "https://api.github.localhost/scim/v2/Users/0db508eb-91e2-46e4-809c-30dcbda0c685",
"displayName": "User 2"
}
],
"meta": {
"resourceType": "Group",
"created": "2012-03-27T19:59:26.000Z",
"lastModified": "2018-03-27T19:59:26.000Z",
"location": "https://api.github.localhost/scim/v2/Groups/927fa2c08dcb4a7fae9e"
}
}
],
"startIndex": 1,
"itemsPerPage": 20
}
Provision a SCIM enterprise group
Note
SCIM provisioning for users and groups using the REST API is in public preview and subject to change.
Creates a SCIM group for an enterprise.
When members are part of the group provisioning payload, they're designated as external group members. Providers are responsible for maintaining a mapping between the externalId
and id
for each user.
“Provision a SCIM enterprise group”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Enterprise administration" business permissions (write)
“Provision a SCIM enterprise group”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
名称, 类型, 说明 | |||
---|---|---|---|
schemas array of strings 必须The URIs that are used to indicate the namespaces of the SCIM schemas.
Supported values are: | |||
externalId string 必须A unique identifier for the resource as defined by the provisioning client. | |||
displayName string 必须A human-readable name for a security group. | |||
members array of objects 必须The group members. | |||
Properties of |
名称, 类型, 说明 |
---|
value string 必须The local unique identifier for the member |
displayName string 必须The display name associated with the member |
“Provision a SCIM enterprise group”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
201 | Group has been created |
400 | Bad request |
401 | Authorization failure |
403 | Permission denied |
409 | Duplicate record detected |
429 | Too many requests |
500 | Internal server error |
“Provision a SCIM enterprise group”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
请求示例
curl -L \
-X POST \
-H "Accept: application/scim+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/scim/v2/enterprises/ENTERPRISE/Groups \
-d '{"schemas":["urn:ietf:params:scim:schemas:core:2.0:Group"],"externalId":"8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159","displayName":"Engineering"}'
Group has been created
Status: 201
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "abcd27f8-a9aa-11ea-8221-f59b2be9cccc",
"externalId": "8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159",
"displayName": "Engineering",
"members": [
{
"value": "879db59-3bdf-4490-ad68-ab880a2694745",
"$+ref": "https://api.github.localhost/scim/v2/Users/879db59-3bdf-4490-ad68-ab880a2694745",
"displayName": "User 1"
},
{
"value": "0db508eb-91e2-46e4-809c-30dcbda0c685",
"$+ref": "https://api.github.localhost/scim/v2/Users/0db508eb-91e2-46e4-809c-30dcbda0c685",
"displayName": "User 2"
}
],
"meta": {
"resourceType": "Group",
"created": "2012-03-27T19:59:26.000Z",
"lastModified": "2018-03-27T19:59:26.000Z",
"location": "https://api.github.localhost/scim/v2/Groups/927fa2c08dcb4a7fae9e"
}
}
Get SCIM provisioning information for an enterprise group
Note
SCIM provisioning for users and groups using the REST API is in public preview and subject to change.
Gets information about a SCIM group.
“Get SCIM provisioning information for an enterprise group”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Enterprise administration" business permissions (write)
“Get SCIM provisioning information for an enterprise group”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
scim_group_id string 必须A unique identifier of the SCIM group. |
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
名称, 类型, 说明 |
---|
excludedAttributes string Excludes the specified attribute from being returned in the results. Using this parameter can speed up response time. |
“Get SCIM provisioning information for an enterprise group”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | Success, a group was found |
400 | Bad request |
401 | Authorization failure |
403 | Permission denied |
404 | Resource not found |
429 | Too many requests |
500 | Internal server error |
“Get SCIM provisioning information for an enterprise group”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
请求示例
curl -L \
-H "Accept: application/scim+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/scim/v2/enterprises/ENTERPRISE/Groups/SCIM_GROUP_ID
Success, a group was found
Status: 200
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "abcd27f8-a9aa-11ea-8221-f59b2be9cccc",
"externalId": "8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159",
"displayName": "Engineering",
"members": [
{
"value": "879db59-3bdf-4490-ad68-ab880a2694745",
"$+ref": "https://api.github.localhost/scim/v2/Users/879db59-3bdf-4490-ad68-ab880a2694745",
"displayName": "User 1"
},
{
"value": "0db508eb-91e2-46e4-809c-30dcbda0c685",
"$+ref": "https://api.github.localhost/scim/v2/Users/0db508eb-91e2-46e4-809c-30dcbda0c685",
"displayName": "User 2"
}
],
"meta": {
"resourceType": "Group",
"created": "2012-03-27T19:59:26.000Z",
"lastModified": "2018-03-27T19:59:26.000Z",
"location": "https://api.github.localhost/scim/v2/Groups/927fa2c08dcb4a7fae9e"
}
}
Set SCIM information for a provisioned enterprise group
Note
SCIM provisioning for users and groups using the REST API is in public preview and subject to change.
Replaces an existing provisioned group’s information.
You must provide all the information required for the group as if you were provisioning it for the first time. Any existing group information that you don't provide will be removed, including group membership. If you want to only update a specific attribute, use the Update an attribute for a SCIM enterprise group endpoint instead.
“Set SCIM information for a provisioned enterprise group”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Enterprise administration" business permissions (write)
“Set SCIM information for a provisioned enterprise group”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
scim_group_id string 必须A unique identifier of the SCIM group. |
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
名称, 类型, 说明 | |||
---|---|---|---|
schemas array of strings 必须The URIs that are used to indicate the namespaces of the SCIM schemas.
Supported values are: | |||
externalId string 必须A unique identifier for the resource as defined by the provisioning client. | |||
displayName string 必须A human-readable name for a security group. | |||
members array of objects 必须The group members. | |||
Properties of |
名称, 类型, 说明 |
---|
value string 必须The local unique identifier for the member |
displayName string 必须The display name associated with the member |
“Set SCIM information for a provisioned enterprise group”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | Group was updated |
400 | Bad request |
401 | Authorization failure |
403 | Permission denied |
404 | Resource not found |
409 | Duplicate record detected |
429 | Too many requests |
500 | Internal server error |
“Set SCIM information for a provisioned enterprise group”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
请求示例
curl -L \
-X PUT \
-H "Accept: application/scim+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/scim/v2/enterprises/ENTERPRISE/Groups/SCIM_GROUP_ID \
-d '{"schemas":["urn:ietf:params:scim:schemas:core:2.0:Group"],"externalId":"8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159","displayName":"Engineering"}'
Group was updated
Status: 200
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "abcd27f8-a9aa-11ea-8221-f59b2be9cccc",
"externalId": "8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159",
"displayName": "Engineering",
"members": [
{
"value": "879db59-3bdf-4490-ad68-ab880a2694745",
"$+ref": "https://api.github.localhost/scim/v2/Users/879db59-3bdf-4490-ad68-ab880a2694745",
"displayName": "User 1"
},
{
"value": "0db508eb-91e2-46e4-809c-30dcbda0c685",
"$+ref": "https://api.github.localhost/scim/v2/Users/0db508eb-91e2-46e4-809c-30dcbda0c685",
"displayName": "User 2"
}
],
"meta": {
"resourceType": "Group",
"created": "2012-03-27T19:59:26.000Z",
"lastModified": "2018-03-27T19:59:26.000Z",
"location": "https://api.github.localhost/scim/v2/Groups/927fa2c08dcb4a7fae9e"
}
}
Update an attribute for a SCIM enterprise group
Note
SCIM provisioning for users and groups using the REST API is in public preview and subject to change.
Update a provisioned group’s individual attributes.
To modify a group's values, you'll need to use a specific Operations JSON format which must include at least one of the following operations: add, remove, or replace. For examples and more information on this SCIM format, consult the SCIM specification. The update function can also be used to add group memberships.
You can submit group memberships individually or in batches for improved efficiency.
Note
Memberships are referenced via a local user id. Ensure users are created before referencing them here.
“Update an attribute for a SCIM enterprise group”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Enterprise administration" business permissions (write)
“Update an attribute for a SCIM enterprise group”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
scim_group_id string 必须A unique identifier of the SCIM group. |
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
名称, 类型, 说明 | ||||
---|---|---|---|---|
Operations array of objects 必须patch operations list | ||||
Properties of |
名称, 类型, 说明 |
---|
op string 必须可以是以下选项之一: |
path string |
value string Corresponding 'value' of that field specified by 'path' |
schemas
array of strings 必须undefinedSupported values are: urn:ietf:params:scim:api:messages:2.0:PatchOp
“Update an attribute for a SCIM enterprise group”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | Success, group was updated |
204 | No Content |
400 | Bad request |
401 | Authorization failure |
403 | Permission denied |
404 | Resource not found |
409 | Duplicate record detected |
429 | Too many requests |
500 | Internal server error |
“Update an attribute for a SCIM enterprise group”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
请求示例
curl -L \
-X PATCH \
-H "Accept: application/scim+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/scim/v2/enterprises/ENTERPRISE/Groups/SCIM_GROUP_ID \
-d '{"schemas":["urn:ietf:params:scim:api:messages:2.0:PatchOp"],"Operations":[{"op":"replace","path":"displayName","value":"Employees"}]}'
Success, group was updated
Status: 200
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "abcd27f8-a9aa-11ea-8221-f59b2be9cccc",
"externalId": "8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159",
"displayName": "Engineering",
"members": [
{
"value": "879db59-3bdf-4490-ad68-ab880a2694745",
"$+ref": "https://api.github.localhost/scim/v2/Users/879db59-3bdf-4490-ad68-ab880a2694745",
"displayName": "User 1"
},
{
"value": "0db508eb-91e2-46e4-809c-30dcbda0c685",
"$+ref": "https://api.github.localhost/scim/v2/Users/0db508eb-91e2-46e4-809c-30dcbda0c685",
"displayName": "User 2"
}
],
"meta": {
"resourceType": "Group",
"created": "2012-03-27T19:59:26.000Z",
"lastModified": "2018-03-27T19:59:26.000Z",
"location": "https://api.github.localhost/scim/v2/Groups/927fa2c08dcb4a7fae9e"
}
}
Delete a SCIM group from an enterprise
Note
SCIM provisioning using the REST API is in public preview and subject to change.
Deletes a SCIM group from an enterprise.
“Delete a SCIM group from an enterprise”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Enterprise administration" business permissions (write)
“Delete a SCIM group from an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
scim_group_id string 必须A unique identifier of the SCIM group. |
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
“Delete a SCIM group from an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
204 | Group was deleted, no content |
400 | Bad request |
401 | Authorization failure |
403 | Permission denied |
404 | Resource not found |
429 | Too many requests |
500 | Internal server error |
“Delete a SCIM group from an enterprise”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
请求示例
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/scim/v2/enterprises/ENTERPRISE/Groups/SCIM_GROUP_ID
Group was deleted, no content
Status: 204
List SCIM provisioned identities for an enterprise
Note
SCIM provisioning for users and groups using the REST API is in public preview and subject to change.
Lists provisioned SCIM enterprise members.
When you remove a user with a SCIM-provisioned external identity from an enterprise using a patch
with active
flag to false
, the user's metadata remains intact. This means they can potentially re-join the enterprise later. Although, while suspended, the user can't sign in. If you want to ensure the user can't re-join in the future, use the delete request. Only users who weren't permanently deleted will appear in the result list.
“List SCIM provisioned identities for an enterprise”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Enterprise administration" business permissions (write)
“List SCIM provisioned identities for an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
名称, 类型, 说明 |
---|
filter string If specified, only results that match the specified filter will be returned. Multiple filters are not supported. Possible filters are |
startIndex integer Used for pagination: the starting index of the first result to return when paginating through values. 默认: |
count integer Used for pagination: the number of results to return per page. 默认: |
“List SCIM provisioned identities for an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | Success, either users were found or not found |
400 | Bad request |
401 | Authorization failure |
403 | Permission denied |
429 | Too many requests |
500 | Internal server error |
“List SCIM provisioned identities for an enterprise”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
请求示例
curl -L \
-H "Accept: application/scim+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/scim/v2/enterprises/ENTERPRISE/Users
Success, either users were found or not found
Status: 200
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:ListResponse"
],
"totalResults": 1,
"Resources": [
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"externalId": "E012345",
"id": "7fce0092-d52e-4f76-b727-3955bd72c939",
"active": true,
"userName": "E012345",
"name": {
"formatted": "Ms. Mona Lisa Octocat",
"familyName": "Octocat",
"givenName": "Mona",
"middleName": "Lisa"
},
"displayName": "Mona Lisa",
"emails": [
{
"value": "mlisa@example.com",
"type": "work",
"primary": true
}
],
"roles": [
{
"value": "User",
"primary": false
}
]
}
],
"startIndex": 1,
"itemsPerPage": 20
}
Provision a SCIM enterprise user
Note
SCIM provisioning for users and groups using the REST API is in public preview and subject to change.
Creates an external identity for a new SCIM enterprise user.
SCIM is responsible for user provisioning, not authentication. The actual user authentication is handled by SAML. However, with SCIM enabled, users must first be provisioned via SCIM before they can sign in through SAML.
“Provision a SCIM enterprise user”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Enterprise administration" business permissions (write)
“Provision a SCIM enterprise user”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
名称, 类型, 说明 | |||||
---|---|---|---|---|---|
schemas array of strings 必须The URIs that are used to indicate the namespaces of the SCIM schemas.
Supported values are: | |||||
externalId string 必须A unique identifier for the resource as defined by the provisioning client. | |||||
active boolean 必须Whether the user active in the IdP. | |||||
userName string 必须The username for the user. | |||||
name object | |||||
Properties of |
名称, 类型, 说明 |
---|
formatted string The full name, including all middle names, titles, and suffixes as appropriate, formatted for display. |
familyName string 必须The family name of the user. |
givenName string 必须The given name of the user. |
middleName string The middle name(s) of the user. |
displayName
string 必须A human-readable name for the user.
emails
array of objects 必须The emails for the user.
Properties of emails
名称, 类型, 说明 |
---|
value string 必须The email address. |
type string 必须The type of email address. |
primary boolean 必须Whether this email address is the primary address. |
roles
array of objects The roles assigned to the user.
Properties of roles
名称, 类型, 说明 |
---|
display string |
type string |
value string 必须The role value representing a user role in GitHub. 可以是以下选项之一: |
primary boolean Is the role a primary role for the user. |
“Provision a SCIM enterprise user”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
201 | User has been created |
400 | Bad request |
401 | Authorization failure |
403 | Permission denied |
409 | Duplicate record detected |
429 | Too many requests |
500 | Internal server error |
“Provision a SCIM enterprise user”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
请求示例
curl -L \
-X POST \
-H "Accept: application/scim+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/scim/v2/enterprises/ENTERPRISE/Users \
-d '{"schemas":["urn:ietf:params:scim:schemas:core:2.0:User"],"externalId":"E012345","active":true,"userName":"E012345","name":{"formatted":"Ms. Mona Lisa Octocat","familyName":"Octocat","givenName":"Mona","middleName":"Lisa"},"displayName":"Mona Lisa","emails":[{"value":"mlisa@example.com","type":"work","primary":true}],"roles":[{"value":"User","primary":false}]}'
User has been created
Status: 201
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"id": "7fce0092-d52e-4f76-b727-3955bd72c939",
"externalId": "E012345",
"active": true,
"userName": "E012345",
"name": {
"formatted": "Ms. Mona Lisa Octocat",
"familyName": "Octocat",
"givenName": "Mona",
"middleName": "Lisa"
},
"displayName": "Mona Lisa",
"emails": [
{
"value": "mlisa@example.com",
"type": "work",
"primary": true
}
],
"roles": [
{
"value": "User",
"primary": false
}
],
"meta": {
"resourceType": "User",
"created": "2012-03-27T19:59:26.000Z",
"lastModified": "2018-03-27T19:59:26.000Z",
"location": "https://api.github.localhost/scim/v2/Users/7fce0092-d52e-4f76-b727-3955bd72c939"
}
}
Get SCIM provisioning information for an enterprise user
Note
SCIM provisioning for users and groups using the REST API is in public preview and subject to change.
Gets information about a SCIM user.
“Get SCIM provisioning information for an enterprise user”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Enterprise administration" business permissions (write)
“Get SCIM provisioning information for an enterprise user”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
scim_user_id string 必须The unique identifier of the SCIM user. |
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
“Get SCIM provisioning information for an enterprise user”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | Success, a user was found |
400 | Bad request |
401 | Authorization failure |
403 | Permission denied |
404 | Resource not found |
429 | Too many requests |
500 | Internal server error |
“Get SCIM provisioning information for an enterprise user”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
请求示例
curl -L \
-H "Accept: application/scim+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/scim/v2/enterprises/ENTERPRISE/Users/SCIM_USER_ID
Success, a user was found
Status: 200
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"id": "7fce0092-d52e-4f76-b727-3955bd72c939",
"externalId": "E012345",
"active": true,
"userName": "E012345",
"name": {
"formatted": "Ms. Mona Lisa Octocat",
"familyName": "Octocat",
"givenName": "Mona",
"middleName": "Lisa"
},
"displayName": "Mona Lisa",
"emails": [
{
"value": "mlisa@example.com",
"type": "work",
"primary": true
}
],
"roles": [
{
"value": "User",
"primary": false
}
],
"meta": {
"resourceType": "User",
"created": "2012-03-27T19:59:26.000Z",
"lastModified": "2018-03-27T19:59:26.000Z",
"location": "https://api.github.localhost/scim/v2/Users/7fce0092-d52e-4f76-b727-3955bd72c939"
}
}
Set SCIM information for a provisioned enterprise user
Note
SCIM provisioning for users and groups using the REST API is in public preview and subject to change.
Replaces an existing provisioned user's information.
You must supply complete user information, just as you would when provisioning them initially. Any previously existing data not provided will be deleted. To update only a specific attribute, refer to the Update an attribute for a SCIM user endpoint.
Warning
Setting active: false
will suspend a user, and their handle and email will be obfuscated.
“Set SCIM information for a provisioned enterprise user”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Enterprise administration" business permissions (write)
“Set SCIM information for a provisioned enterprise user”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
scim_user_id string 必须The unique identifier of the SCIM user. |
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
名称, 类型, 说明 | |||||
---|---|---|---|---|---|
schemas array of strings 必须The URIs that are used to indicate the namespaces of the SCIM schemas.
Supported values are: | |||||
externalId string 必须A unique identifier for the resource as defined by the provisioning client. | |||||
active boolean 必须Whether the user active in the IdP. | |||||
userName string 必须The username for the user. | |||||
name object | |||||
Properties of |
名称, 类型, 说明 |
---|
formatted string The full name, including all middle names, titles, and suffixes as appropriate, formatted for display. |
familyName string 必须The family name of the user. |
givenName string 必须The given name of the user. |
middleName string The middle name(s) of the user. |
displayName
string 必须A human-readable name for the user.
emails
array of objects 必须The emails for the user.
Properties of emails
名称, 类型, 说明 |
---|
value string 必须The email address. |
type string 必须The type of email address. |
primary boolean 必须Whether this email address is the primary address. |
roles
array of objects The roles assigned to the user.
Properties of roles
名称, 类型, 说明 |
---|
display string |
type string |
value string 必须The role value representing a user role in GitHub. 可以是以下选项之一: |
primary boolean Is the role a primary role for the user. |
“Set SCIM information for a provisioned enterprise user”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | User was updated |
400 | Bad request |
401 | Authorization failure |
403 | Permission denied |
404 | Resource not found |
409 | Duplicate record detected |
429 | Too many requests |
500 | Internal server error |
“Set SCIM information for a provisioned enterprise user”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
请求示例
curl -L \
-X PUT \
-H "Accept: application/scim+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/scim/v2/enterprises/ENTERPRISE/Users/SCIM_USER_ID \
-d '{"schemas":["urn:ietf:params:scim:schemas:core:2.0:User"],"externalId":"E012345","active":true,"userName":"E012345","name":{"formatted":"Ms. Mona Lisa Octocat","familyName":"Octocat","givenName":"Mona","middleName":"Lisa"},"displayName":"Mona Lisa","emails":[{"value":"mlisa@example.com","type":"work","primary":true}],"roles":[{"value":"User","primary":false}]}'
User was updated
Status: 200
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"id": "7fce0092-d52e-4f76-b727-3955bd72c939",
"externalId": "E012345",
"active": true,
"userName": "E012345",
"name": {
"formatted": "Ms. Mona Lisa Octocat",
"familyName": "Octocat",
"givenName": "Mona",
"middleName": "Lisa"
},
"displayName": "Mona Lisa",
"emails": [
{
"value": "mlisa@example.com",
"type": "work",
"primary": true
}
],
"roles": [
{
"value": "User",
"primary": false
}
],
"meta": {
"resourceType": "User",
"created": "2012-03-27T19:59:26.000Z",
"lastModified": "2018-03-27T19:59:26.000Z",
"location": "https://api.github.localhost/scim/v2/Users/7fce0092-d52e-4f76-b727-3955bd72c939"
}
}
Update an attribute for a SCIM enterprise user
Note
SCIM provisioning for users and groups using the REST API is in public preview and subject to change.
Update a provisioned user's individual attributes.
To modify a user's attributes, you'll need to provide a Operations
JSON formatted request that includes at least one of the following actions: add, remove, or replace. For specific examples and more information on the SCIM operations format, please refer to the SCIM specification.
Note
Complex SCIM path
selectors that include filters are not supported. For example, a path
selector defined as "path": "emails[type eq \"work\"]"
will be ineffective.
Warning
Setting active: false
will suspend a user, and their handle and email will be obfuscated.
{
"Operations":[{
"op":"replace",
"value":{
"active":false
}
}]
}
“Update an attribute for a SCIM enterprise user”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Enterprise administration" business permissions (write)
“Update an attribute for a SCIM enterprise user”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
scim_user_id string 必须The unique identifier of the SCIM user. |
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
名称, 类型, 说明 | ||||
---|---|---|---|---|
Operations array of objects 必须patch operations list | ||||
Properties of |
名称, 类型, 说明 |
---|
op string 必须可以是以下选项之一: |
path string |
value string Corresponding 'value' of that field specified by 'path' |
schemas
array of strings 必须undefinedSupported values are: urn:ietf:params:scim:api:messages:2.0:PatchOp
“Update an attribute for a SCIM enterprise user”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | Success, user was updated |
400 | Bad request |
401 | Authorization failure |
403 | Permission denied |
404 | Resource not found |
409 | Duplicate record detected |
429 | Too many requests |
500 | Internal server error |
“Update an attribute for a SCIM enterprise user”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
请求示例
curl -L \
-X PATCH \
-H "Accept: application/scim+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/scim/v2/enterprises/ENTERPRISE/Users/SCIM_USER_ID \
-d '{"schemas":["urn:ietf:params:scim:api:messages:2.0:PatchOp"],"Operations":[{"op":"replace","path":"emails[type eq '\''work'\''].value","value":"updatedEmail@microsoft.com"},{"op":"replace","path":"name.familyName","value":"updatedFamilyName"}]}'
Success, user was updated
Status: 200
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"id": "7fce0092-d52e-4f76-b727-3955bd72c939",
"externalId": "E012345",
"active": true,
"userName": "E012345",
"name": {
"formatted": "Ms. Mona Lisa Octocat",
"familyName": "Octocat",
"givenName": "Mona",
"middleName": "Lisa"
},
"displayName": "Mona Lisa",
"emails": [
{
"value": "mlisa@example.com",
"type": "work",
"primary": true
}
],
"roles": [
{
"value": "User",
"primary": false
}
],
"meta": {
"resourceType": "User",
"created": "2012-03-27T19:59:26.000Z",
"lastModified": "2018-03-27T19:59:26.000Z",
"location": "https://api.github.localhost/scim/v2/Users/7fce0092-d52e-4f76-b727-3955bd72c939"
}
}
Delete a SCIM user from an enterprise
Note
SCIM provisioning using the REST API is in public preview and subject to change.
Suspends a SCIM user permanently from an enterprise. This action will: remove all the user's data, anonymize their login, email, and display name, erase all external identity SCIM attributes, delete the user's emails, avatar, PATs, SSH keys, OAuth authorizations, GPG keys, and SAML mappings. This action is irreversible.
“Delete a SCIM user from an enterprise”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Enterprise administration" business permissions (write)
“Delete a SCIM user from an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
scim_user_id string 必须The unique identifier of the SCIM user. |
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
“Delete a SCIM user from an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
204 | User was deleted, no content |
400 | Bad request |
401 | Authorization failure |
403 | Permission denied |
404 | Resource not found |
429 | Too many requests |
500 | Internal server error |
“Delete a SCIM user from an enterprise”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
请求示例
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/scim/v2/enterprises/ENTERPRISE/Users/SCIM_USER_ID
User was deleted, no content
Status: 204