wso2 - WSO2 IS 5.9.0 更新用户声明
问题描述
我有两个问题,当使用setUserClaimValue
来自RemoteUserStoreManagerService
SOAP 端点的方法时,更新效果很好。
但是,端点/userinfo
丢失了值,我需要重新验证用户以生成新的访问令牌,并且一切正常。
我需要使用setUserClaimValue
来自RemoteUserStoreManagerService
更新多个声明的方法,但什么也没发生,我没有任何错误,但声明没有更新。
这是我的环境:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.ws.um.carbon.wso2.org" xmlns:xsd="http://common.mgt.user.carbon.wso2.org/xsd">
<soapenv:Header/>
<soapenv:Body>
<ser:setUserClaimValues>
<!--Optional:-->
<ser:userName>username@mail.com</ser:userName>
<!--Zero or more repetitions:-->
<ser:claims>
<!--Optional:-->
<xsd:claimURI>http://wso2.org/claims/emailaddress</xsd:claimURI>
<!--Optional:-->
<xsd:value>newemail@mail.com</xsd:value>
</ser:claims>
<!--Optional:-->
<ser:profileName></ser:profileName>
</ser:setUserClaimValues>
</soapenv:Body>
</soapenv:Envelope>
我应该使用什么方法来更新多个索赔?为什么更新声明时,我的实际访问令牌从 /userinfo 端点丢失了数据,是否有必要生成新的访问令牌?
解决方案
1)
我应该使用什么方法来更新多个索赔?
你必须使用setUserClaimValues
from RemoteUserStoreManagerService
。您可以关注此文档以获取更多信息RemoteUserStoreManagerService
。
下面给出了一个示例肥皂服务。
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://service.ws.um.carbon.wso2.org" xmlns:xsd="http://common.mgt.user.carbon.wso2.org/xsd">
<soap:Header/>
<soap:Body>
<ser:setUserClaimValues>
<ser:userName>piraveena</ser:userName>
<ser:claims>
<xsd:claimURI>http://wso2.org/claims/organization</xsd:claimURI>
<xsd:value>wso2</xsd:value>
</ser:claims>
<ser:claims>
<xsd:claimURI>http://wso2.org/claims/country</xsd:claimURI>
<xsd:value>srilanka</xsd:value>
</ser:claims>
<ser:profileName>default</ser:profileName>
</ser:setUserClaimValues>
</soap:Body>
</soap:Envelope>
2)
为什么更新声明时,我的实际访问令牌从 /userinfo 端点丢失了数据?
我无法在本地重现此问题。即使在通过管理服务更新声明后,我也能够在不重新验证的情况下获得用户声明。
当用户声明更新时,映射到访问令牌的用户属性缓存也将被事件清除。所以下次调用 useinfo 端点时,缓存将为空。在这种情况下,将从用户存储中获取声明。请在此处参考此代码。因此,用户不需要重新认证,因为用户属性存在于用户存储中。
但是当您启用电子邮件作为用户名并通过服务更新用户的电子邮件时,您可能会遇到此问题。
推荐阅读
- javascript - puppeter AWS lambada 卡在 newPage 方法上
- python - 通过高斯策略进行的 RL 连续控制如何工作?
- sapui5 - 部署到 SAP Cloud Platform 时,有没有办法重用组件?
- jquery - 如何在 air-datepicker.js 上设置初始日期选择?
- javascript - 完全使用存根测试函数
- jquery - 使用 jQuery 更改 URL 后使用 GET 参数
- php - 部分表单提交
- c# - 如果已打开,则在现有窗口中读取文档
- javascript - 使用 Vue JS 构建原生应用
- angular - 如何在充满多个组件的页面中从 Angular 组件打开模式