如何在 WSO2 中使用 SCIM 将用户添加到角色 [英] how to add users to roles using SCIM in WSO2

查看:32
本文介绍了如何在 WSO2 中使用 SCIM 将用户添加到角色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 WSO2 身份服务器中以编程方式向用户添加角色.我可以通过 SCIM API 创建用户.但是找不到将用户添加到角色的 API.我尝试在 wso2/scim/Users POST API 中将用户名指定为 "userName":"role/myusername".但它不工作;不确定它是否是正确的方法.有人能告诉我如何向现有用户添加角色以及如何向新用户添加角色吗?

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?

谢谢

推荐答案

答案此处展示了如何使用SCIM PUT 命令.

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

此外,从 IS 5.1.0 开始,您还可以使用 文档

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

将用户 AMRSNGHE/groupUSR001 添加到组 AMRSNGHE/ngioletGR

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/ 在创建组 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>

这篇关于如何在 WSO2 中使用 SCIM 将用户添加到角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆