[英]Comparing specific custom-defined attribute of user
對於我想到的XACML策略文檔,我有一個主題(用戶)和一個對象,每一個都帶有標簽。 我們稱其為myLabel = {[a,b,c], [1,2,3]}
。 我希望對該標簽的各個部分進行比較。
如何定義訪問請求和策略中包含此標簽的主題和對象,以制定比較此決定的決定?
我希望使用XML而不是JSON或ALFA來聲明以上內容。
XACML(和ALFA)帶有一組明確定義的數據類型和功能。 例如,XACML定義以下數據類型:
現成的數據類型大約有18種。
為了處理這些數據類型,XACML定義了數百種功能,例如:
XACML中的屬性(例如標簽,角色或部門)必須具有數據類型。 屬性可以是多值的。 換句話說, role = ["manager"]
或role = ["manager", "employee", "janitor"]
。 兩者都是完全有效的。
就您而言,您所指的值結構如下: {[a,b,c],[1,2,3]}
。 這不是標准數據類型。 這是一個復雜的對象,因此需要進一步處理(在PEP中?在PIP中?)。 您如何考慮將其傳遞給PDP?
假設我們有簡單的值,例如label ='2'。 要將用戶的標簽與資源的標簽進行比較,並在它們相等時授予訪問權限,請編寫以下代碼:
/**
* Control access based on labels
*/
policy labelAccessControl{
apply firstApplicable
rule allowIfSameLabel{
permit
condition user.label == object.label
}
}
<?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.axiomatics.labelAccessControl"
RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:first-applicable"
Version="1.0">
<xacml3:Description>Control access based on labels</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="com.axiomatics.labelAccessControl.allowIfSameLabel">
<xacml3:Description />
<xacml3:Target />
<xacml3:Condition>
<xacml3:Apply
FunctionId="urn:oasis:names:tc:xacml:3.0:function:any-of-any">
<xacml3:Function
FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal" />
<xacml3:AttributeDesignator
AttributeId="com.axiomatics.user.label"
Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
DataType="http://www.w3.org/2001/XMLSchema#string"
MustBePresent="false" />
<xacml3:AttributeDesignator
AttributeId="com.axiomatics.object.label"
Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource"
DataType="http://www.w3.org/2001/XMLSchema#string"
MustBePresent="false" />
</xacml3:Apply>
</xacml3:Condition>
</xacml3:Rule>
</xacml3:Policy>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.