Wso2 XACML策略集和请求及其示例

Wso2 XACML策略集和请求及其示例,wso2,wso2is,rbac,xacml,xacml3,Wso2,Wso2is,Rbac,Xacml,Xacml3,我是XACML的新手。我计划使用XACML策略和Wso2 ID服务器在我们的组织应用程序中实现RBAC。我读了很多关于使用wso2创建不同XACML策略的文章,也尝试了很多策略示例。但是在浏览了所有可用示例后,我没有找到创建XACML策略集和重新测试策略集的正确方法。我自己尝试创建XACML策略集,但当我尝试在wso2 Id服务器中执行此策略集时,每次都会出现“不适用”错误。我尝试了很多方法以不同的方式创建XACML策略集,但当我为此创建请求时,它不会给出正确的结果。 请帮助我给出XACML策略

我是XACML的新手。我计划使用XACML策略和Wso2 ID服务器在我们的组织应用程序中实现RBAC。我读了很多关于使用wso2创建不同XACML策略的文章,也尝试了很多策略示例。但是在浏览了所有可用示例后,我没有找到创建XACML策略集和重新测试策略集的正确方法。我自己尝试创建XACML策略集,但当我尝试在wso2 Id服务器中执行此策略集时,每次都会出现“不适用”错误。我尝试了很多方法以不同的方式创建XACML策略集,但当我为此创建请求时,它不会给出正确的结果。 请帮助我给出XACML策略集及其请求的适当示例

在这里,我添加了我的策略集和策略以及它的请求。请告诉我有什么问题

在wso2Id中创建的角色是:-testRole 并将此角色分配给testUser

策略集为:-


测试策略集
H1
综合政策
政策


H1
index.jsp
阅读
看法
测试角色
策略集请求

<Request xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" CombinedDecision="false" ReturnPolicyIdList="false">
<Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action">
    <Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" IncludeInResult="false">
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">read</AttributeValue>
    </Attribute>
</Attributes>
<Attributes Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject">
    <Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id" IncludeInResult="false">
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">testU</AttributeValue>
    </Attribute>
</Attributes>
<Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment">
    <Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:environment:environment-id" IncludeInResult="false">
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">H1</AttributeValue>
    </Attribute>
</Attributes>
<Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource">
    <Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" IncludeInResult="false">
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">index.jsp</AttributeValue>
    </Attribute>
</Attributes>

阅读
testU
H1
index.jsp

我使用Axiomatics策略服务器测试了您的策略(请参见屏幕截图):

然后,我使用我们的模拟器测试了策略集:

我收到了
不确定
回复。
不确定
的根本原因是
规则中的条件
http://wso2.org/claims/role
属性,并且由于某种原因,评估没有检索到任何值

WSO2似乎没有检索角色属性的值。您想检查WSO2中的配置是否正确。或者,测试Axiomatics策略服务器


HTH

如果您使用WSO2IS的策略集,请注意以下几点

  • 您需要在PDP中发布策略集策略和引用策略

  • 然后需要在PDP中启用策略集。您可以将引用策略保留为禁用策略

  • 请参阅更多详细信息以及


    如果您打算使用WSO2 Identity Server实现RBAC和ABAC,我建议您仔细了解。

    您好,David,正如您所说的“WSO2没有检索角色属性的值”,但在我的WSO2日志中,它会显示类似于“{org.WSO2.balana.PolicyReference}”的警告-查询了id为ComplexPolicy的PolicyReference,但未配置PolicyFinder“但我已将策略和策略集上载到policy finder。我不知道这是怎么回事。David你能给我一个在PolicySet中有策略引用的PolicySet的例子吗?关于Wso2上下文的PolicySet请求?如果我在policy set中声明策略,工作就可以了。但若我在策略集中传递策略的引用,那个么它会给我类似“不适用”的错误,并且在控制台中会显示类似于上述注释中的警告。
    <Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"  PolicyId="ComplexPolicy" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides" Version="1.0">
       <Target>
          <AnyOf>
             <AllOf>
                <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                   <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">H1</AttributeValue>
                   <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:environment:environment-id" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"></AttributeDesignator>
                </Match>
             </AllOf>
          </AnyOf>
       </Target>
       <Rule Effect="Permit" RuleId="PermitForTestUser">
          <Condition>
             <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
                <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
                   <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">index.jsp</AttributeValue>
                      </Apply>
                      <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"></AttributeDesignator>
                   </Apply>
                   <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">read</AttributeValue>
                         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">view</AttributeValue>
                      </Apply>
                      <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"></AttributeDesignator>
                   </Apply>
                </Apply>
                <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-is-in">
                   <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">testRole</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>
    </Policy>    
    
    <Request xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" CombinedDecision="false" ReturnPolicyIdList="false">
    <Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action">
        <Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" IncludeInResult="false">
            <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">read</AttributeValue>
        </Attribute>
    </Attributes>
    <Attributes Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject">
        <Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id" IncludeInResult="false">
            <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">testU</AttributeValue>
        </Attribute>
    </Attributes>
    <Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment">
        <Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:environment:environment-id" IncludeInResult="false">
            <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">H1</AttributeValue>
        </Attribute>
    </Attributes>
    <Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource">
        <Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" IncludeInResult="false">
            <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">index.jsp</AttributeValue>
        </Attribute>
    </Attributes>