首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Authzforce - XACML AttributeSelector

Authzforce - XACML AttributeSelector
EN

Stack Overflow用户
提问于 2022-03-09 10:09:44
回答 1查看 121关注 0票数 2

我正在使用Authzforce 10.1.1,我已经创建了一些基本策略,现在我试图使用元素<AttributeSelector>来比较我计划在请求中发送的资源的一些值。

我一直在跟踪http://docs.oasis-open.org/xacml/3.0/xacml-3.0-core-spec-os-en.pdf中存在的xacml文档,甚至尝试了他们为<AttributeSelector>提供的一些示例,但都没有成功。

策略我想要创建

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PolicySet xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicySetId="root" Version="1.0.5" PolicyCombiningAlgId="urn:oasis:names:tc:xacml:3.0:policy-combining-algorithm:deny-unless-permit">
   <Target />
   <Policy PolicyId="polo" Version="1.0" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-unless-permit">
       <Target>
       </Target>
       <Rule RuleId="Ruleo" Effect="Permit">
           <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:1.0:subject-category:access-subject" AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:parent-guardian-id" DataType="http://www.w3.org/2001/XMLSchema#string" />
                   </Apply>
                   <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
                     <AttributeSelector MustBePresent="false"
                     Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource"
                     Path="md:record/md:parentGuardian/md:parentGuardianId/text()" DataType="http://www.w3.org/2001/XMLSchema#string" />
                   </Apply>
               </Apply>
           </Condition>
       </Rule>
   </Policy>
</PolicySet>

错误我得到

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error xmlns:ns2="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:ns3="http://authzforce.github.io/core/xmlns/pdp/7">
   <message>Invalid PolicySet with PolicySetId='root', Version=1.0.5</message>
</error>

如果我将<AttributeSelector>替换为<AttributeDesignator>,则策略是成功创建的,因此我假设错误在<AttributeSelector>中,但是从我阅读的文档中找不到错误。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-03-10 02:44:28

确保您启用了关于PDP属性的文档中提到的PDP特性关于PDP属性的文档

更新2022-03-10

然后,您需要修复PolicySet中的一些内容:

  1. 在策略(Set)默认值/ XPath元素中指定XPathVersion版本。我强烈推荐XPath 2.0:<PolicySetDefaults><XPathVersion>http://www.w3.org/TR/2007/REC-xpath20-20070123</XPathVersion></PolicySetDefaults>
  2. 为带有md的XPath中的前缀xmlns:md="..."指定XML命名空间
  3. 更新2022-03-14将AttributeSelector路径更改为"/md:record/md:parentGuardian/md:parentGuardianId/text()" (在开始时添加一个斜杠)或更简单的"//md:parentGuardianId/text()"

固定的PolicySet如下所示:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PolicySet xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:md="urn:example:med:schemas:record" PolicySetId="root" Version="1.0.5" PolicyCombiningAlgId="urn:oasis:names:tc:xacml:3.0:policy-combining-algorithm:deny-unless-permit">
   <PolicySetDefaults>
       <XPathVersion>http://www.w3.org/TR/2007/REC-xpath20-20070123</XPathVersion>
   </PolicySetDefaults>
   <Target />
   <Policy PolicyId="polo" Version="1.0" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-unless-permit">
       <Target>
       </Target>
       <Rule RuleId="Ruleo" Effect="Permit">
           <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:1.0:subject-category:access-subject" AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:parent-guardian-id" DataType="http://www.w3.org/2001/XMLSchema#string" />
                   </Apply>
                   <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
                     <AttributeSelector MustBePresent="false"
                     Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource"
                     Path="/md:record/md:parentGuardian/md:parentGuardianId/text()" DataType="http://www.w3.org/2001/XMLSchema#string" />
                   </Apply>
               </Apply>
           </Condition>
       </Rule>
   </Policy>
</PolicySet>

帮助修复此类错误的故障排除提示:

  1. 在推到AuthzForce核心CLI服务器之前,先用AuthzForce快速测试您的策略。(在PDP配置中设置xPathEnabled="true" - pdp.xml -以便在本例中启用XPath支持。)
  2. 检查/var/log/tomcat9/var/log/tomcat9/authzforce-ce中的日志
  3. 增加/opt/authzforce-ce-server/conf/logback.xml中的日志级别,特别是对于名为org.ow2.authzforce的记录器。
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71407607

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档