dth*_*rpe 9 xacml xacml2 xacml3
我正在考虑将我的客户端应用程序从使用XACML 2.0授权服务迁移到使用更新的XACML 3.0服务.
在将客户端应用程序从生成XACML 2.0请求迁移到发出XACML 3.0请求时,我会遇到哪些更改或问题?
dth*_*rpe 10
XACML 2.0和XACML 3.0与客户端应用程序的最大区别在于,在XACML 3.0中,authz请求中的属性结构发生了显着变化.
在XACML 2.0中,使用XML元素标记将属性组织为主题,资源,环境或操作类别:
<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns="urn:oasis:names:tc:xacml:2.0:context:schema:os"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:context:schema:os access_control-xacml-2.0-context-schema-os.xsd">
<Subject>
<Attribute
AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"
DataType="http://www.w3.org/2001/XMLSchema#string">
<AttributeValue>Julius Hibbert</AttributeValue>
</Attribute>
</Subject>
<Resource>
<Attribute
AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
DataType="http://www.w3.org/2001/XMLSchema#anyURI">
<AttributeValue>http://medico.com/record/patient/BartSimpson</AttributeValue>
</Attribute>
</Resource>
<Action>
<Attribute
AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
DataType="http://www.w3.org/2001/XMLSchema#string">
<AttributeValue>read</AttributeValue>
</Attribute>
</Action>
<Environment/>
</Request>
Run Code Online (Sandbox Code Playgroud)
在XACML 3.0中,使用XML属性而不是XML元素标记来指示这些类别:
<?xml version="1.0" encoding="utf-8"?>
<Request xsi:schemaLocation="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17 http://docs.oasis-open.org/xacml/3.0/xacml-core-v3-schema-wd-17.xsd" ReturnPolicyIdList="false" CombinedDecision="false" xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Attributes Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject">
<Attribute IncludeInResult="false" AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Julius Hibbert</AttributeValue>
</Attribute>
</Attributes>
<Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource">
<Attribute IncludeInResult="false" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">http://medico.com/record/patient/BartSimpson</AttributeValue>
</Attribute>
</Attributes>
<Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action">
<Attribute IncludeInResult="false" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">read</AttributeValue>
</Attribute>
</Attributes>
<Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment" />
</Request>
Run Code Online (Sandbox Code Playgroud)
例如<Subject>,XACML 2.0中的元素变为<Attributes Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject">XACML 3.0.同样适用于资源,环境和行动类别.
这种结构变化简化了处理请求的处理模型,并且可以轻松地使用自定义应用程序特定或特定于域的类别扩展模型,而不会与模式验证相冲突.
XACML 3.0中定义了新的数据类型和函数,用于策略定义.AnyURI数据类型现在与字符串数据类型不同.一些2.0组合算法已经被弃用,而不是新的3.0等价,它更精确地定义了不确定状态如何通过策略决策树传播.旧的组合算法仍然作为"遗留"工件包含在内.
XACML 2.0请求和策略可以机械地转换为XACML 3.0格式,而不会丢失信息.如果您坚持简单的允许/拒绝响应,则可以将3.0响应转换回2.0格式.