WSO2 IS 5.9.0 更新用户声明

WSO2 IS 5.9.0 Updating user claims

我有两个问题,当使用来自 RemoteUserStoreManagerService SOAP 端点的方法 setUserClaimValue 时,更新效果很好。

但是,endpont /userinfo 丢失了值,我需要重新验证用户以生成新的访问令牌,并且一切正常。

我需要使用 RemoteUserStoreManagerService 中的方法 setUserClaimValue 来更新多个声明,但什么也没发生,我没有任何错误,但声明没有更新。

这是我的环境:

<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)

What method I should use for update more thant one claim?

您必须使用 RemoteUserStoreManagerService 中的 setUserClaimValues。您可以关注此 document 以获得有关此 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)

Why when update claims, my actual access token lost data from /userinfo endpoint?

我无法在本地重现此问题。即使在通过管理服务更新声明后,我也能够在不重新验证的情况下获得用户声明。

更新用户声明时,映射到访问令牌的用户属性缓存也将被事件清除。所以下次调用 useinfo 端点时,缓存将为空。在这种情况下,声明将从 userstore 获得。请参考这里 code。因此,用户不需要重新验证,因为用户属性存在于用户存储中。

但是当您启用电子邮件作为用户名并通过该服务更新用户的电子邮件时,您可能会遇到这个问题。