添加自定义属性的正确SCIM语法是什么

时间:2019-11-13 19:37:48

标签: scim

我正在尝试扩展用户模型并添加新的字符串属性。据我了解,我可以简单地添加它并返回值。

我的问题是如何在资源类型端点中对此进行记录。目前,我们只有基本的scim实现,因此我们返回

"Resources": [
{
    "name": "User",
    "description": "User Accounts",
    "endpoint": "/Users",
    "schema": "urn:ietf:params:scim:schemas:core:2.0:User",
    "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0:ResourceType"
    ],
    "id": "User",
   "meta": {
        "resourceType": "ResourceType",
        "location": "https://apidsw017086.docusignhq.com/v201411/scim/resourcetypes/user"
   }
}

我应该只添加属性部分并添加新属性,还是需要列出所有默认属性?

1 个答案:

答案 0 :(得分:1)

RFC 7643 Section 3.3中所述,您需要定义一个新架构并在ResourceType“ schemaExtensions”中指定该架构。您可以在整个规范中查看enterprise user schema extension,以获取有关操作方法的示例。

示例资源类型表示形式:

[
    {
         "schemas": ["urn:ietf:params:scim:schemas:core:2.0:ResourceType"],
         "id": "User",
         "name": "User",
         "endpoint": "/Users",
         "description": "User Account",
         "schema": "urn:ietf:params:scim:schemas:core:2.0:User",
         "schemaExtensions": [
           {
             "schema": "urn:your:user:extension:schema",
             "required": false
           }
         ],
         "meta": {
           "location": "https://example.com/v2/ResourceTypes/User",
           "resourceType": "ResourceType"
         }
    }
]

示例资源架构表示形式:

[
    {
        "id": "urn:ietf:params:scim:schemas:core:2.0:User",
        "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:Schema" ],
        "name": "User",
        "description": "User Account",
        "attributes": [ {...} ]
    },
    {
        "id": "urn:your:user:extension:schema",
        "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:Schema" ],
        "name": "Your Custom User Extension Name",
        "description": "Your Custom User Extension Description",
        "attributes": [ {...} ]
    }
]