【发布时间】:2018-03-07 21:57:21
【问题描述】:
我需要将 WSO2 Identity server(5.3) 内部 LDAP 与 WSO2 API Manager(2.1) 集成。
我已经通过取消注释以下代码来取消注释 wso2-api-2.1\repository\conf\user-mgt.xml 中的 LDAP 配置来完成更改。
<UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager">
and commented the below.
<UserStoreManager class="org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager">
我遵循了 WSO2 文档中提到的使用 XACML 进行基于角色的访问控制的所有步骤,如下所示。 https://docs.wso2.com/display/AM210/Enabling+Role-Based+Access+Control+Using+XACML
我创建了一个角色“schooladmin”和一个用户“testuser”。我将角色“schooladmin”分配给身份服务器中的“testuser”以及授予的所有权限。
我能够在 WSO2 身份存储中测试 PDP,它工作正常。
问题:
由于 Identity Server 和 API Manager 是通过 LDAP 连接的,我无法在 API Manager 中看到 Identity Server 中开发的 PDP。这是正确的行为吗?
-
我创建并部署了一个基于业务服务的 REST API,并在配置期间添加了权利,如 WSO2 文档中所述。
<sequence xmlns="http://ws.apache.org/ns/synapse" name="newEntitlementMediator"> <entitlementService xmlns="http://ws.apache.org/ns/synapse" remoteServiceUrl="https://localhost:9443/services" remoteServiceUserName="admin" remoteServicePassword="admin" callbackClass="org.wso2.sample.handlers.entitlement.APIEntitlementCallbackHandler"/> </sequence>
当我尝试在 Postman 中新开发 REST API 时,我总是收到以下错误。
<am:fault xmlns:am="http://wso2.org/apimanager">
<am:code>0</am:code>
<am:type>Status report</am:type>
<am:message>Runtime Error</am:message>
<am:description>User is not authorized to perform the action</am:description>
</am:fault>
为了测试,我正在使用以下提供的服务创建具有正确用户“testuser”的新令牌 - https://localhost:8244/token
如果有任何限制或我错过了任何配置,请提出建议。
我正在添加在 WSO2 IS 服务器中创建的策略以获得权利。 请查看。
<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="iib_policy_entitlement" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-unless-permit" Version="1.0">
<Target/>
<Rule Effect="Permit" RuleId="iib_test_rule">
<Target>
<AnyOf>
<AllOf>
<Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">/login/v1</AttributeValue>
<AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/>
</Match>
<Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">POST</AttributeValue>
<AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/>
</Match>
</AllOf>
</AnyOf>
</Target>
<Condition>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of">
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-bag">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">iib_role</AttributeValue>
</Apply>
<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"/>
</Apply>
</Condition>
</Rule>
</Policy>
谢谢, 阿布舍克
【问题讨论】: