首页
学习
活动
专区
圈层
工具
发布

XACML资源
EN

Stack Overflow用户
提问于 2013-02-27 05:56:03
回答 2查看 223关注 0票数 0

我正在尝试编写一个代码,将允许用户访问基于安全角色的网站内容。因此,一些用户可以看到所有内容,而一些用户只能看到带有特定扩展名的urls。

我的大部分代码都可以工作,但我在访问3个子类别时遇到了问题。

代码语言:javascript
复制
<Rule Effect="Permit" RuleId="accesses">
    <Description>Permission for lower clearance</Description>
    <Target>
        <Resources>
            <Resource>
                <ResourceMatch
                    MatchId="urn:oasis:names:tc:xacml:1.0:function:regexp-string-match">
                    <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">home.html
                    </AttributeValue>
                    <ResourceAttributeDesignator
                        AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
                        DataType="http://www.w3.org/2001/XMLSchema#string" Issuer="policy-admin@website.com"
                        MustBePresent="true" />
                </ResourceMatch>
            </Resource>
            <Resource>
                <ResourceMatch
                    MatchId="urn:oasis:names:tc:xacml:1.0:function:regexp-string-match">
                    <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">localweather.html
                    </AttributeValue>
                    <ResourceAttributeDesignator
                        AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
                        DataType="http://www.w3.org/2001/XMLSchema#string" Issuer="policy-admin@website.com"
                        MustBePresent="true" />
                </ResourceMatch>
            </Resource>
            <Resource>
                <ResourceMatch
                    MatchId="urn:oasis:names:tc:xacml:1.0:function:regexp-string-match">
                    <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">about.html
                    </AttributeValue>
                    <ResourceAttributeDesignator
                        AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
                        DataType="http://www.w3.org/2001/XMLSchema#string" Issuer="policy-admin@website.com"
                        MustBePresent="true" />
                </ResourceMatch>
            </Resource>
        </Resources>
    </Target>
    <Condition>
        <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:regexp-string-match">
            <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
                <SubjectAttributeDesignator AttributeId="AccessLevel"
                    DataType="http://www.w3.org/2001/XMLSchema#string" Issuer="policy-admin@website.com"
                    MustBePresent="true" />
                <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Clear</AttributeValue>
            </Apply>
        </Apply>
    </ Condition >
</Rule>

我有这3个资源,当我运行这个程序时,我得到了一个“不确定”的响应。每条规则只能有一个资源吗?是否有其他东西抛出了异常?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-02-27 19:45:15

你可以在目标中拥有树资源。根据你的规则,他们将充当"OR“。请检查您的XACML请求,可能是您正在发送的请求与策略不匹配(策略有MustBePresent="true“表示,如果属性不在那里,PDP将创建一个不确定的错误)。请将它们更改为"false”并查看。

票数 0
EN

Stack Overflow用户

发布于 2013-07-26 20:37:09

这实际上是一个条件问题。这些资源都是叶级别的文件。我的策略没有正确的用户属性值。我将它与我的LDAP模式进行了比较,并使其正常工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15100111

复制
相关文章

相似问题

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