Xml Authzforce-简单ABAC策略创建失败

Xml Authzforce-简单ABAC策略创建失败,xml,xacml,abac,authzforce,Xml,Xacml,Abac,Authzforce,我使用的是Authzforce 8.1.0,我已经根据中给出的示例创建了两个RBAC策略场景,但我想创建一个简单的ABAC场景 作为一名XACML语言的新手,我尝试着从中学习一些例子。更具体地说,我正在尝试实施类似于4.1.1示例策略的策略 我要创建的策略 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <error xmlns:ns2="http://authzforce.github.io/core/xmlns

我使用的是
Authzforce 8.1.0
,我已经根据中给出的示例创建了两个
RBAC
策略场景,但我想创建一个简单的
ABAC
场景

作为一名XACML语言的新手,我尝试着从中学习一些例子。更具体地说,我正在尝试实施类似于4.1.1示例策略的策略

我要创建的策略

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error xmlns:ns2="http://authzforce.github.io/core/xmlns/pdp/6.0">
    <message>Failed to find a root PolicySet with id = 'first_policyset_id', Version=1.0,EarliestVersion=*,LatestVersion=*: Matched PolicySet 'first_policyset_id' (version 1.0) is invalid or its content is unavailable</message>
</error>
假设一家名为Medi Corp(由其域名:med.example.com标识)的公司有一个访问控制策略,该策略以英语表示:

在“med.example.com”命名空间中具有电子邮件名称的任何用户都是 允许对任何资源执行任何操作

到目前为止,我在authzforce中看到的所有示例都是从一个
声明开始的(在该声明中,我们可以声明多个
块,因此我认为这可能是一个问题,并尝试将策略包含在
策略集中,如下所示:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PolicySet
 xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"
 PolicySetId="first_policyset_id"
 Version="1.0"
 PolicyCombiningAlgId="urn:oasis:names:tc:xacml:3.0:policy-combining-algorithm:permit-unless-deny">
 <Description>Policy for Github</Description>
 <Target />
 <Policy
   PolicyId="urn:oasis:names:tc:xacml:3.0:example:SimplePolicy1"
           Version="1.0"
           RuleCombiningAlgId="identifier:rule-combining-algorithm:deny-overrides">
  <Description>
       Medi Corp access control policy
     </Description>
     <Target/>
      <Rule
       RuleId= "urn:oasis:names:tc:xacml:3.0:example:SimpleRule1"
       Effect="Permit">
       <Description>
         Any subject with an e-mail name in the med.example.com domain
         can perform any action on any resource.
       </Description>
       <Target>
         <AnyOf>
           <AllOf>
             <Match
               MatchId="urn:oasis:names:tc:xacml:1.0:function:rfc822Name-match">
                <AttributeValue  DataType="http://www.w3.org/2001/XMLSchema#string">med.example.com</AttributeValue>
                <AttributeDesignator
                    Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
                    AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"
                    MustBePresent="false"
                    DataType="urn:oasis:names:tc:xacml:1.0:data-type:rfc822Name"/>
                </Match>
           </AllOf>
         </AnyOf>
       </Target>
      </Rule>
    </Policy>
</PolicySet>

Github的策略
Medi Corp访问控制策略
在med.example.com域中具有电子邮件名称的任何主题
可以对任何资源执行任何操作。
med.example.com
但现在我得到了以下信息:

响应

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error xmlns:ns2="http://authzforce.github.io/core/xmlns/pdp/6.0">
    <message>Failed to find a root PolicySet with id = 'first_policyset_id', Version=1.0,EarliestVersion=*,LatestVersion=*: Matched PolicySet 'first_policyset_id' (version 1.0) is invalid or its content is unavailable</message>
</error>

找不到id为“first\u PolicySet\u id”、版本为1.0、EarliestVersion=*、LatestVersion=*的根策略集:匹配的策略集“first\u PolicySet\u id”(版本1.0)无效或其内容不可用

XACML请求的正确格式是什么,可以生成这样一个简单的ABAC策略场景?在此基础上的策略访问请求示例也将非常感谢,提前感谢!

第4.1.1节中的示例已经知道了一些问题,不幸的是,其中一些问题我已经在上报告过了。它应该在下一版本中修复XACML规范的版本。同时,您需要修复以下问题:

  • 完全删除
    xsi:schemaLocation
    。因为位置
    http://docs.oasis-open.org/xacml/FIXME.xsd
    错误,AuthzForce已将其自己的位置用于XACML架构
  • RuleCombiningAlgId
    标识符:规则组合算法:拒绝覆盖
    错误。替换为
    urn:oasis:names:tc:xacml:3.0:规则组合算法:拒绝覆盖
  • 我还确认AuthzForce服务器的REST API只接受策略集作为
    /pap/policies
    端点上的输入,因此您必须像以前一样将策略包装在策略集中。但是,如果您希望得到结果,您应该将PolicyCombiningAlgId更改为
    urn:oasis:names:tc:xacml:1.0:策略组合算法:只有一个适用的
    策略集的t与策略相等

    --编辑2020-04-06--

    因此,固定策略集如下所示:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <PolicySet 
     xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"
     PolicySetId="PolicySet_1"
     Version="1.0"
     PolicyCombiningAlgId="urn:oasis:names:tc:xacml:1.0:policy-combining-algorithm:only-one-applicable">
     <Description>Sample PolicySet</Description>
     <Target />
     <Policy 
      PolicyId="urn:oasis:names:tc:xacml:3.0:example:SimplePolicy1"
      Version="1.0"
      RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-overrides">
      <Description>Medi Corp access control policy</Description>
      <Target/>
      <Rule
       RuleId= "urn:oasis:names:tc:xacml:3.0:example:SimpleRule1"
       Effect="Permit">
       <Description>Any subject with an e-mail name in the med.example.com domain can perform any action on any resource.</Description>
       <Target>
         <AnyOf>
           <AllOf>
             <Match
              MatchId="urn:oasis:names:tc:xacml:1.0:function:rfc822Name-match">
              <AttributeValue  DataType="http://www.w3.org/2001/XMLSchema#string">med.example.com</AttributeValue>
              <AttributeDesignator
               Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
               AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"
               DataType="urn:oasis:names:tc:xacml:1.0:data-type:rfc822Name"
               MustBePresent="true"/>
             </Match>
           </AllOf>
         </AnyOf>
       </Target>
      </Rule>
     </Policy>
    </PolicySet>
    
    
    样本策略集
    Medi Corp访问控制策略
    在med.example.com域中具有电子邮件名称的任何主题都可以对任何资源执行任何操作。
    med.example.com
    
    感谢@Cyril的大力帮助,还有一些问题需要解决,因此该政策将被接受,例如1)从
    中删除
    xmls
    xmlns:xsi
    ,并在
    AttributeDesignator
    属性中添加
    MustBePresent
    属性,因为这是强制性的。您可以将最终结果包含在您的答案中,因此我将接受它:好的,我已将最终结果添加到我的答案中,欢迎您接受:-)
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <PolicySet 
     xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"
     PolicySetId="PolicySet_1"
     Version="1.0"
     PolicyCombiningAlgId="urn:oasis:names:tc:xacml:1.0:policy-combining-algorithm:only-one-applicable">
     <Description>Sample PolicySet</Description>
     <Target />
     <Policy 
      PolicyId="urn:oasis:names:tc:xacml:3.0:example:SimplePolicy1"
      Version="1.0"
      RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-overrides">
      <Description>Medi Corp access control policy</Description>
      <Target/>
      <Rule
       RuleId= "urn:oasis:names:tc:xacml:3.0:example:SimpleRule1"
       Effect="Permit">
       <Description>Any subject with an e-mail name in the med.example.com domain can perform any action on any resource.</Description>
       <Target>
         <AnyOf>
           <AllOf>
             <Match
              MatchId="urn:oasis:names:tc:xacml:1.0:function:rfc822Name-match">
              <AttributeValue  DataType="http://www.w3.org/2001/XMLSchema#string">med.example.com</AttributeValue>
              <AttributeDesignator
               Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
               AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"
               DataType="urn:oasis:names:tc:xacml:1.0:data-type:rfc822Name"
               MustBePresent="true"/>
             </Match>
           </AllOf>
         </AnyOf>
       </Target>
      </Rule>
     </Policy>
    </PolicySet>