-->

how to add users to roles using SCIM in WSO2

2019-07-31 09:40发布

问题:

I want to add roles to users programatically in WSO2 Identity server. I am able to create users by SCIM API's.But cant find an API to add a user to a role. I tried giving the user name as "userName":"role/myusername" in the wso2/scim/Users POST API. But its not working ; not sure if its the correct approach. Can someone tell me how to add a role to an existing user and also add a role to a new user?

Thanks

回答1:

The answer here shows how to do that with SCIM PUT command.

Also From IS 5.1.0 onwards you can also use the PATCH operation as mentioned in the docs

Add user AMRSNGHE/groupUSR001 to group AMRSNGHE/ngioletGR

curl -k --user admin:admin -X PATCH -d '{"displayName": 'AMRSNGHE/ngioletGR',"members": [{"value":"","display": 'AMRSNGHE/groupUSR001'}]}' --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Groups/<id returned in the response when creating the group AMRSNGHE/ngioletGR>