在5.9.0中使用scim2 API在wso2中添加用户时如何添加角色/组?

时间:2019-12-09 11:08:02

标签: wso2 wso2esb wso2is wso2carbon

我正在尝试使用此api-https://localhost:9443/scim2/Users

创建用户

如何将此用户添加到创建的组中?您能提供有效载荷吗?

我的有效载荷-

{
    "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
    "name": {
        "familyName": "jackson",
        "givenName": "kim"
    },
    "userName": "test2",
    "password": "abc123",
    "postalcode":"56789",
    "profileUrl":"gmail.com",
    "emails": [
        {
            "type":"default",
            "value":"a@gmail.com"
        },
        {
            "value": "kim.jackson@gmail.com",
            "type": "home"
        },
        {
            "value": "kim_j@wso2.com",
            "type": "work"
        }
    ]
}   

1 个答案:

答案 0 :(得分:2)

下面将使用“修补程序”操作将SCIM id为“ 81cbba1b-c259-485d-8ba4-79afb03e5bd1”的用户“ Kris”添加到组中。

{
   "schemas":[
      "urn:ietf:params:scim:api:messages:2.0:PatchOp"
   ],
   "Operations":[
      {
         "op":"add",
         "value":{
            "members":[
               {
                  "display":"Kris",
                  "$ref":"https://localhost:9443/scim2/Users/81cbba1b-c259-485d-8ba4-79afb03e5bd1",
                  "value":"81cbba1b-c259-485d-8ba4-79afb03e5bd1"
               }
            ]
         }
      }
   ]
}

下面是完整的CURL命令。您可以始终参考[1]以获得API信息。

curl -v -k --user admin:admin -X PATCH -d '{"schemas":["urn:ietf:params:scim:api:messages:2.0:PatchOp"],"Operations":[{"op":"add","value":{"members":[{"display": "Kris","$ref":"https://localhost:9443/scim2/Users/81cbba1b-c259-485d-8ba4-79afb03e5bd1","value": "81cbba1b-c259-485d-8ba4-79afb03e5bd1"}]}}]}' --header "Content-Type:application/json" https://localhost:9443/scim2/Groups/a43fe003-d90d-43ca-ae38-d2332ecc0f36

[1] https://docs.wso2.com/display/IS570/apidocs/SCIM2-endpoints/#!/operations#GroupsEndpoint#patchGroup