简体   繁体   English

在 WSO2 身份服务器 5.10.0 中将本地用户帐户链接到联合用户的正确方法是什么

[英]What is the correct way of linking local user account to federated user in WSO2 Identity server 5.10.0

I am using Google authenticator (Oauth2 client) as an Identity provider in WSO2 5.10.0.我在 WSO2 5.10.0 中使用Google 身份验证器(Oauth2 客户端)作为身份提供程序。 I created a Service provider which uses this google authenticator as Federated authentication .我创建了一个使用这个谷歌身份验证器作为联合身份验证服务提供者

When the user login for the first time using google credentials(gmail), I am able to make a local user by storing user in local user store through Just-In-Time Provisioning in Identity provider.当用户第一次使用谷歌凭据(gmail)登录时,我可以通过身份提供商中的即时配置将用户存储在本地用户存储中来创建本地用户。 https://is.docs.wso2.com/en/latest/learn/configuring-just-in-time-provisioning-for-an-identity-provider/ https://is.docs.wso2.com/en/latest/learn/configuring-just-in-time-provisioning-for-an-identity-provider/

After the first login i assign roles to the local user manually.第一次登录后,我手动为本地用户分配角色。

Now when the user login again using federated(google) authentication, the roles that i provided to the local user does not get link with the federated user.现在,当用户使用联合(谷歌)身份验证再次登录时,我提供给本地用户的角色不会与联合用户建立链接。

I read of Associating user account https://is.docs.wso2.com/en/latest/learn/associating-user-accounts/ using WSO2 user-portal我读到了关联用户帐户https://is.docs.wso2.com/en/latest/learn/associating-user-accounts/使用 Z10F5E949F59263A67AC4D57B58C82FC7

I tried adding我尝试添加

[user.association] enable_for_federated_users = true

in deployment.toml .deployment.toml中。 But when i open user-portal, i only see the option of linking local user account to another local user account.但是当我打开用户门户时,我只看到将本地用户帐户链接到另一个本地用户帐户的选项。

I want to link user account with federated user such that when the federated user logs in, it takes the roles provided to the local user earlier and pass through the XACML role based policy.我想将用户帐户与联合用户相关联,这样当联合用户登录时,它会获取之前提供给本地用户的角色并通过基于 XACML 角色的策略。

XAMCL policy XAMCL 政策


<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"  PolicyId="role_based_login_policy" RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:first-applicable" Version="1.0">
   <Description>This policy template provides ability to authorize users to a given service provider(defined by SP_NAME) in the authentication flow based on the roles of the user (defined by ROLE_1 and ROLE_2). Users who have at least one of the given roles, will be allowed and any others will be denied.</Description>
   <Target>
      <AnyOf>
         <AllOf>
            <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
               <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SP_Name</AttributeValue>
               <AttributeDesignator AttributeId="http://wso2.org/identity/sp/sp-name" Category="http://wso2.org/identity/sp" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"></AttributeDesignator>
            </Match>
            <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
               <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">authenticate</AttributeValue>
               <AttributeDesignator AttributeId="http://wso2.org/identity/identity-action/action-name" Category="http://wso2.org/identity/identity-action" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"></AttributeDesignator>
            </Match>
         </AllOf>
      </AnyOf>
   </Target>
   <Rule Effect="Permit" RuleId="permit_by_roles">
      <Condition>
         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:or">
            <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-is-in">
               <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">admin</AttributeValue>
               <AttributeDesignator AttributeId="http://wso2.org/claims/role" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"></AttributeDesignator>
            </Apply>
         </Apply>
      </Condition>
   </Rule>
   <Rule Effect="Deny" RuleId="deny_others"></Rule>
</Policy>

In the latest versions of the Identity Server (including 5.10.0), when the Just-In-Time provisioning is enabled, federated users and local users are associated automatically.在最新版本的 Identity Server(包括 5.10.0)中,当启用即时供应时,联合用户和本地用户会自动关联。 So you don't need to enable the config you have mentioned and as the documentation has mentioned, it is not recommended.因此,您不需要启用您提到的配置,并且正如文档所提到的,不建议这样做。

So if you want to send the attributes of the local provisioned user to the application, you have to enable Assert identity using mapped local subject identifier configuration for the application.因此,如果您想将本地配置用户的属性发送到应用程序,您必须Assert identity using mapped local subject identifier

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM