【问题标题】:XACML policy - HOW to set a policy as the root policy?XACML 策略 - 如何将策略设置为根策略?
【发布时间】:2018-07-17 18:40:17
【问题描述】:

我正在尝试使用 Authzforce PDP 引擎 (Web API) 根据以下策略评估一些请求。

<PolicySet xsi:schemaLocation="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17 http://docs.oasis-open.org/xacml/3.0/xacml-core-v3-schema-wd-17.xsd" PolicySetId="root" Version="2.0" PolicyCombiningAlgId="identifier:policy-combining-algorithm:deny-overrides">
 <Target/>
  <Policy xsi:schemaLocation="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17 http://docs.oasis-open.org/xacml/3.0/xacml-core-v3-schema-wd-17.xsd" PolicyId="urn:oasis:names:tc:xacml:3.0:example:MyPolicy" Version="1.0" RuleCombiningAlgId="identifier:rule-combining-algorithm:deny-overrides">
   <Target/>
   <Rule RuleId="urn:oasis:names:tc:xacml:3.0:example:MyRule" Effect="Permit">
     <Target>
      <AnyOf>
       <AllOf>
         <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
          <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Medical record</AttributeValue> 
            <AttributeDesignator MustBePresent="false" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string"/>
         </Match>
         <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
          <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Doctor</AttributeValue>
            <AttributeDesignator MustBePresent="false" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id-qualifier" DataType="http://www.w3.org/2001/XMLSchema#string"/>
         </Match>
        </AllOf>
       </AnyOf>
     </Target>
     <Condition>
       <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
        <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
         <AttributeDesignator MustBePresent="false" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string"/>
        </Apply>
       <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">write</AttributeValue>
      </Apply>
     </Condition>
    </Rule>
   </Policy>
</PolicySet>

但是,当我想将此策略设置为根策略(以激活此策略)时,我收到以下错误。

HTTP/1.1 400 Bad Request
Server: Apache-Coyote/1.1
Date: Wed, 07 Feb 2018 12:40:19 GMT
Content-Type: application/xml
Content-Length: 361
Connection: close

* Closing connection 0
<?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 = 'root', Version=Optional.empty,EarliestVersion=Optional.empty,LatestVersion=Optional.empty: Matched PolicySet 'root' (version 2.0) is invalid or its content is unavailable</message>
</error>

我认为我的政策可能有问题。请告诉我是什么问题?

【问题讨论】:

  • 您是如何制定此政策的?它甚至不是有效的 XML。未定义 schemaLocation 的命名空间前缀 xsi。
  • @star 你能接受答案吗?

标签: authorization access-control xacml abac authzforce


【解决方案1】:

正如大卫所说,您的 PolicySet 不是有效的 XML,因为 xsi 命名空间未定义。要修复它,请完全删除 xsi:schemaLocation 属性(AuthzForce 不需要)。

一般来说,每当您使用 XACML 文档(PolicySet、Request、Response 等)时,请确保它是有效的 XML,尤其是对 XACML schema 有效。为了快速验证,您可以使用XML validator online(它们很多,链接只是一个示例),或者像xmllint 这样的命令行XML 工具。要进行更彻底的验证,包括 XACML 特定的语义(例如,还要确保您使用正确的 XACML 标识符,以及具有正确参数的 XACML 函数等)和 XACML 请求验证/测试,您可以使用AuthzForce CLI

最终,如果 AuthzForce 服务器仍然拒绝该策略,您可以在 /var/log/tomcat8/authzforce-ce/error.log 中查看 AuthzForce 服务器日志以获取更多详细信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-13
    • 1970-01-01
    • 1970-01-01
    • 2019-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多