[英]Policy Entitlement XACML in WSO2 Identity Server with WSO2 API Manager
我在將WSO2身份服務器(5.3)內部LDAP與WSO2 API管理器(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+基於角色的+ Access + Control +使用+ 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>
謝謝阿比舍克
問題1的答案:是的,LDAP僅用作用戶存儲。 元數據存儲在單獨的數據庫中。 如果您還需要共享元數據,那么您也必須共享元數據DB。 請為此更改/repository/conf/datasourses/master-datasourses.xml。
問題2的答案:無法直接回答此問題,但我可以提供一些要檢查的要點。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.