2

我对 XACML(可扩展访问控制标记语言)非常陌生,我正在研究 TSPM(它是使用 XACML 的商业产品)可以为某些业务需求做些什么。

所以我一直在寻找这个问题的答案:

假设我有一个网站页面,其中包含由具有特定应用程序配置文件的用户访问的 3 个链接。是否可以根据某些规则创建一个限制和管理“链接”的策略(假设某个个人资料用户在午夜之前只能看到 2 个链接而不是 3 个)?

主要问题是我无法弄清楚 XACML 断言中的资源是什么,我只是在一些文档中找到了这个定义:

资源是可以控制访问的任何东西。示例包括 XQuery 模块和 Java 方法。

任何人都可以通过实际示例 XACML 帮助更好地理解?

谢谢你们!

4

2 回答 2

2

(我是 TSPM 的技术主管,或者是不熟悉该产品的其他人的 Tivoli Security Policy Manager)。

您描述的用例绝对是可能的。不过,您可能不需要专注于原始 XACML - 我们付出了很多努力来为创作策略提供更高级别的用户界面。

对此进行建模的一种方法是让每个链接由 TSPM UI 中的不同结构点表示,并为每个链接附加适当的策略。例如,两个链接可能具有表示“随时允许所有用户”的策略,一个链接可能具有“当前时间在午夜之前时允许”。

然后,您将在呈现每个链接之前调用我们的运行时,以查看当前经过身份验证的用户是否应该能够查看它。如果您愿意,您也可以拨打一个电话以获取当前可查看链接的列表。

如果您在 WebSphere 上运行,您可以使用 WebSphere Portal 标记库或我们的授权 API。如果您不是,那么为大多数平台构建一个 Web 服务客户端真的很容易,这些平台可以使用 XACML over SOAP 调用授权服务。有关调用授权服务的更多信息,请参阅我们的公共 wiki

编辑:

我意识到我并没有真正解决您的问题,即关于 XACML 方面的资源是什么。您可能知道,XACML 将请求上下文分为四个部分:主题、资源、操作和环境。这些部分中的每一个都包含零个或多个属性,每个属性都有一个标识符和一个类型。XACML 中的资源只是“资源”部分中的一个属性或属性组合,它们共同唯一标识您要保护的任何内容。

规范urn:oasis:names:tc:xacml:1.0:resource:resource-id为此目的定义了标识符,它可以是任何类型,但通常是字符串或 URI。

在您的用例中,每个链接可能有一个字符串标识符,如“link-1”、“link-2”和“link-3”。您的策略将使用这些标识符,并且您的应用程序将在请求对每个链接做出决定时传递这些标识符。

于 2011-10-05T21:15:43.763 回答
1

In XACML you can write policies that take into account any attributes. Attributes are essentially labels that describe a situation. For instance role, citizenship, age, and clearance are all user attributes. Page URL, classification, and location are attributes of the resource (i.e. what the user is trying to access). You can have attributes about the action (edit, view, delete...) and even about the environment.

In your example, you mention that you want to control access to webpages and that you want to take into account the time of the day. To do that you'd write a XACML policy where you would check the URL page of the page and the time of the day.

In pseudocode, that would be:

Permit if resource-id=='/pages/MyPage.jsp' AND current-time>09:00AM AND current-time<05:00PM

In ALFA, a shorthand notation for XACML, this would be:

namespace com.stackoverflow.xacml{
import Attributes.*
policy accessPages{
    apply firstApplicable
    rule accessPage1{
        target clause resourceId=="/pages/MyPage.jspx" 
               and currentTime>"09:00:00":time 
               and currentTime<"17:00:00":time
        permit
    }
}
}

The ALFA plugin for Eclipse - a free tool - will generate this into XACML 3.0 code:

<?xml version="1.0" encoding="UTF-8"?>
 <!--This file was generated by the ALFA Plugin for Eclipse from Axiomatics AB (http://www.axiomatics.com). 
 Any modification to this file will be lost upon recompilation of the source ALFA file-->
<xacml3:Policy xmlns:xacml3="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"
    PolicyId="http://axiomatics.com/alfa/identifier/com.stackoverflow.xacml.accessPages"
    RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:first-applicable"
    Version="1.0">
    <xacml3:Description />
    <xacml3:PolicyDefaults>
        <xacml3:XPathVersion>http://www.w3.org/TR/1999/REC-xpath-19991116</xacml3:XPathVersion>
    </xacml3:PolicyDefaults>
    <xacml3:Target />
    <xacml3:Rule 
            Effect="Permit"
            RuleId="http://axiomatics.com/alfa/identifier/com.stackoverflow.xacml.accessPages.accessPage1">
        <xacml3:Description />
        <xacml3:Target>
            <xacml3:AnyOf>
                <xacml3:AllOf>
                    <xacml3:Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                        <xacml3:AttributeValue
                            DataType="http://www.w3.org/2001/XMLSchema#string">/pages/MyPage.jspx</xacml3:AttributeValue>
                        <xacml3:AttributeDesignator 
                            AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
                            DataType="http://www.w3.org/2001/XMLSchema#string"
                            Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource"
                            MustBePresent="false"
                        />
                    </xacml3:Match>
                    <xacml3:Match MatchId="urn:oasis:names:tc:xacml:1.0:function:time-less-than-or-equal">
                        <xacml3:AttributeValue
                            DataType="http://www.w3.org/2001/XMLSchema#time">09:00:00</xacml3:AttributeValue>
                        <xacml3:AttributeDesignator 
                            AttributeId="urn:oasis:names:tc:xacml:1.0:environment:current-time"
                            DataType="http://www.w3.org/2001/XMLSchema#time"
                            Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment"
                            MustBePresent="false"
                        />
                    </xacml3:Match>
                    <xacml3:Match MatchId="urn:oasis:names:tc:xacml:1.0:function:time-greater-than-or-equal">
                        <xacml3:AttributeValue
                            DataType="http://www.w3.org/2001/XMLSchema#time">17:00:00</xacml3:AttributeValue>
                        <xacml3:AttributeDesignator 
                            AttributeId="urn:oasis:names:tc:xacml:1.0:environment:current-time"
                            DataType="http://www.w3.org/2001/XMLSchema#time"
                            Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment"
                            MustBePresent="false"
                        />
                    </xacml3:Match>
                </xacml3:AllOf>
            </xacml3:AnyOf>
        </xacml3:Target>
    </xacml3:Rule>
</xacml3:Policy>

Then all you need to do is send the right authorization question/request from your application to the XACML PDP. Essentially what you will ask is:

Can user Alice access page /pages/MyPage.jsp?

The PDP will then reply with either of a Permit, Deny or NotApplicable.

于 2013-01-08T09:03:01.480 回答