XACML 规则中如何使用 Fiware 服务和服务路径?

How can Fiware services and service paths be used in XACML rules?

我们正在研究 Keyrock + Wilma + AuthZForce 以保护我们的 FIWARE 系统 运行 Orion 和 Quantum Leap。我们系统中的实体位于服务和服务路径下。这些是通过适当的 headers 访问的,即 Fiware-Service 和 Fiware-Service 路径。

我正在尝试为 AuthZForce 创建包含服务和服务路径的 XACML 规则,但尚未成功。如果有人能够这样做,我将不胜感激。此外,如果这种方法是错误的,我将不胜感激关于服务和服务路径如何与 FIWARE 访问控制一起使用的其他建议。

处理 FIWARE headers 对 Authzforce 来说不是问题,它只是 PEP 代理的默认行为.

Authzforce 是一个完全通用的 PDP,如果您提供正确的 XACML 策略集并发送适当的数据,它将为您做出裁决。下面的<Rule>permit全部访问/v2/entitiesfiware-header = "smartgondor"

<?xml version="1.0" encoding="UTF-8"?>
<Rule RuleId="ccxsx-xs-xsx-xsxs-xs" Effect="Permit">
   <Description>Context Broker Access with Header=SmartGondor</Description>
   <Target>
      <AnyOf>
         <AllOf>
            <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-starts-with">
               <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">/v2/entities</AttributeValue>
               <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:thales:xacml:2.0:resource:sub-resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" />
            </Match>
         </AllOf>
      </AnyOf>
      <AnyOf>
         <AllOf>
            <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
               <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">smartgondor</AttributeValue>
               <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="fiware-header" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" />
            </Match>
         </AllOf>
      </AnyOf>
   </Target>
</Rule>

不幸的是,默认情况下,PEP 代理 code 在向 Authzforce 发出请求时,仅传递以下值 out-of-the-box:

  • 角色
  • 动作
  • 资源网址
  • appId

如您所见,默认没有传递任何header信息。

包括有关 FIWARE header 的信息。您将不得不更改文件以从发送到 PEP 代理的请求中读取 headers,并添加与请求一起发送到 Authzforce 的另一个属性。可以在 Administrating-XACML Tutorial

中找到此类自定义请求的更简单示例

Security Staff Can only ring the alarm bell before 9 a.m. or after 5 p.m., except for Charlie who can ring the bell at any time

可以在 tutorial codebase 中找到向 Authzforce 发送请求的自定义代码 - Charlie 的用户名包含在请求中。