我有一个场景,我发送资源:来自请求的root-resource-id,如下所示
<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="true">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">
Customer
</AttributeValue>
</Attribute>
<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:resource:root-resource-id" IncludeInResult="true">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">
Customer
</AttributeValue>
</Attribute>
<Attribute AttributeId="urn:oasis:names:tc:xacml:2.0:resource:scope" IncludeInResult="false">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">
Descendants
</AttributeValue>
</Attribute>
</Attributes>`
现在,我必须访问SampleResourceFinderModule中的资源:root-resource-id,如果我访问资源:resource-id:
if("Customer".equals(parentResourceId.encode())){}
你能告诉我我是怎么做到的吗?
答案 0 :(得分:0)
我不确定你要做的是什么,你的确切问题是什么。我猜你正在尝试使用WSO2IS的层次资源配置文件,提到here。似乎是你通过实现“PIPResourceFinder”编写了新的扩展。此扩展的想法是检索给定根资源下的子资源或后代资源。因此,在XACML请求中,您需要发送根资源和范围(子项或子项)。
然后根资源由“urn:oasis:names:tc:xacml:1.0:resource:resource-id”属性id标识。 (不是“urn:oasis:names:tc:xacml:1.0:resource:root-resource-id”属性id ..我猜blog帖子有一些错误。根据博文中的情景,它可能会需要发送具有不同属性id的根资源。
范围由“urn:oasis:names:tc:xacml:2.0:resource:scope”属性标识。
最后,您可以访问“PIPResourceFinder”查找程序中的根资源。然后,您可以返回与根资源相关的子资源。您可以浏览this博客中提到的示例实现。