[abac] Test script updated
This commit is contained in:
parent
38eccafb74
commit
3ca2307646
|
@ -195,45 +195,60 @@ class Command(BaseCommand):
|
|||
|
||||
#predicates for age
|
||||
p1 = PredicateComparison(operand1=adef_age1, operand2=val18_d,
|
||||
comparison_type=ACS_XACML_COMPARISON_INTEGER_GRT_OE, rule=rule)
|
||||
comparison_type=ACS_XACML_COMPARISON_INTEGER_GRT_OE,
|
||||
operand1_single_value=True, operand2_single_value=True,
|
||||
rule=rule)
|
||||
p1.save()
|
||||
print "Predicate age 1 %s, id: %s" % (p1, p1.id)
|
||||
p2 = PredicateComparison(operand1=adef_age1, operand2=val21_d,
|
||||
comparison_type=ACS_XACML_COMPARISON_INTEGER_GRT_OE, rule=rule)
|
||||
comparison_type=ACS_XACML_COMPARISON_INTEGER_GRT_OE,
|
||||
operand1_single_value=True, operand2_single_value=True,
|
||||
rule=rule)
|
||||
p2.save()
|
||||
print "Predicate age 2 %s, id: %s" % (p2, p2.id)
|
||||
#predicates for nationality:
|
||||
p3 = PredicateComparison(operand1=adef_nationality1, operand2=french_d,
|
||||
comparison_type=ACS_XACML_COMPARISON_EQUALITY_STRING_IGN_CASE, rule=rule)
|
||||
comparison_type=ACS_XACML_COMPARISON_EQUALITY_STRING_IGN_CASE,
|
||||
multivalues='EQUAL_OP1_SUBSET_OP2', rule=rule)
|
||||
p3.save()
|
||||
print "Predicate nationality 3 %s, id: %s" % (p3, p3.id)
|
||||
p4 = PredicateComparison(operand1=adef_nationality1, operand2=italian_d,
|
||||
comparison_type=ACS_XACML_COMPARISON_EQUALITY_STRING_IGN_CASE, rule=rule)
|
||||
comparison_type=ACS_XACML_COMPARISON_EQUALITY_STRING_IGN_CASE,
|
||||
multivalues='EQUAL_OP1_SUBSET_OP2', rule=rule)
|
||||
p4.save()
|
||||
print "Predicate nationality 4 %s, id: %s" % (p4, p4.id)
|
||||
p5 = PredicateComparison(operand1=adef_nationality1, operand2=english_d,
|
||||
comparison_type=ACS_XACML_COMPARISON_EQUALITY_STRING_IGN_CASE, rule=rule)
|
||||
comparison_type=ACS_XACML_COMPARISON_EQUALITY_STRING_IGN_CASE,
|
||||
multivalues='EQUAL_OP1_SUBSET_OP2', rule=rule)
|
||||
p5.save()
|
||||
print "Predicate nationality 5 %s, id: %s" % (p5, p5.id)
|
||||
p6 = PredicateComparison(operand1=adef_nationality1, operand2=spanish_d,
|
||||
comparison_type=ACS_XACML_COMPARISON_EQUALITY_STRING_IGN_CASE, rule=rule)
|
||||
comparison_type=ACS_XACML_COMPARISON_EQUALITY_STRING_IGN_CASE,
|
||||
multivalues='EQUAL_OP1_SUBSET_OP2', rule=rule)
|
||||
p6.save()
|
||||
print "Predicate nationality 6 %s, id: %s" % (p6, p6.id)
|
||||
#Predicates only required
|
||||
p7 = PredicateRequired(definition=adef_unikid1, rule=rule)
|
||||
p7 = PredicateRequired(definition=adef_unikid1,
|
||||
single_value=True, rule=rule)
|
||||
p7.save()
|
||||
print "Predicate required unique ID: %s, id: %s" % (p7, p7.id)
|
||||
#Predicates for certificate types
|
||||
p8 = PredicateComparison(operand1=adef_typecert1, operand2=eID_d,
|
||||
comparison_type=ACS_XACML_COMPARISON_EQUALITY_STRING_IGN_CASE, rule=rule)
|
||||
comparison_type=ACS_XACML_COMPARISON_EQUALITY_STRING_IGN_CASE,
|
||||
operand1_single_value=True, operand2_single_value=True,
|
||||
rule=rule)
|
||||
p8.save()
|
||||
print "Predicate certificate type 8 %s, id: %s" % (p8, p8.id)
|
||||
p9 = PredicateComparison(operand1=adef_typecert2, operand2=drvlicence_d,
|
||||
comparison_type=ACS_XACML_COMPARISON_EQUALITY_STRING_IGN_CASE, rule=rule)
|
||||
comparison_type=ACS_XACML_COMPARISON_EQUALITY_STRING_IGN_CASE,
|
||||
operand1_single_value=True, operand2_single_value=True,
|
||||
rule=rule)
|
||||
p9.save()
|
||||
print "Predicate certificate type 9 %s, id: %s" % (p9, p9.id)
|
||||
p10 = PredicateComparison(operand1=adef_typecert3, operand2=assass_d,
|
||||
comparison_type=ACS_XACML_COMPARISON_EQUALITY_STRING_IGN_CASE, rule=rule)
|
||||
comparison_type=ACS_XACML_COMPARISON_EQUALITY_STRING_IGN_CASE,
|
||||
operand1_single_value=True, operand2_single_value=True,
|
||||
rule=rule)
|
||||
p10.save()
|
||||
print "Predicate certificate type 10 %s, id: %s" % (p10, p10.id)
|
||||
#Predicates for same identity checking
|
||||
|
@ -261,28 +276,20 @@ class Command(BaseCommand):
|
|||
#Bags of values to test multivalued attributes
|
||||
bag1 = AttributeData(definition=def_age)
|
||||
bag1.save()
|
||||
IntegerM(data=bag1, value=4).save()
|
||||
IntegerM(data=bag1, value=3).save()
|
||||
IntegerM(data=bag1, value=5).save()
|
||||
bag1_d = AssertionData(attribute_data=bag1)
|
||||
bag1_d.save()
|
||||
bag2 = AttributeData(definition=def_age)
|
||||
bag2.save()
|
||||
IntegerM(data=bag2, value=5).save()
|
||||
IntegerM(data=bag2, value=4).save()
|
||||
IntegerM(data=bag2, value=5).save()
|
||||
IntegerM(data=bag2, value=6).save()
|
||||
bag2_d = AssertionData(attribute_data=bag2)
|
||||
bag2_d.save()
|
||||
'''
|
||||
Diff strict: (ACS_XACML_COMPARISON_INTEGER_LT, ACS_XACML_COMPARISON_INTEGER_GRT)
|
||||
DIFF_ONE_VALUE, DIFF_ALL_VALUES,
|
||||
Diff or equal: (ACS_XACML_COMPARISON_INTEGER_LT_OE, ACS_XACML_COMPARISON_INTEGER_GRT_OE)
|
||||
DE_ONE_VALUE_ONE_VALUE, DE_ONE_VALUE_OP1_SUBSET_OP2,
|
||||
DE_ONE_VALUE_EXACT_MATCH, DE_ALL_VALUES_ONE_VALUE,
|
||||
DE_ALL_VALUES_OP1_SUBSET_OP2, DE_ALL_VALUES_EXACT_MATCH
|
||||
'''
|
||||
p15 = PredicateComparison(operand1=bag1_d, operand2=bag2_d,
|
||||
comparison_type=ACS_XACML_COMPARISON_INTEGER_LT_OE, rule=rule,
|
||||
multivalues='DE_ALL_VALUES_OP1_SUBSET_OP2')
|
||||
comparison_type=ACS_XACML_COMPARISON_INTEGER_GRT, rule=rule,
|
||||
multivalues='DIFF_ONE_OP1_WITH_BOTTOM_LIMIT_OP2')
|
||||
p15.save()
|
||||
print "Predicate test comp 15 %s, id: %s" % (p15, p15.id)
|
||||
|
||||
|
@ -321,11 +328,11 @@ class Command(BaseCommand):
|
|||
attr['namespace'] = 'ACS-ABAC'
|
||||
attr['values'] = ('eID',)
|
||||
data['attributes'].append(attr)
|
||||
# attr = {}
|
||||
# attr['name'] = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth'
|
||||
# attr['namespace'] = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims'
|
||||
# attr['values'] = ('19',)
|
||||
# data['attributes'].append(attr)
|
||||
attr = {}
|
||||
attr['name'] = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth'
|
||||
attr['namespace'] = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims'
|
||||
attr['values'] = ('22', )
|
||||
data['attributes'].append(attr)
|
||||
attr = {}
|
||||
attr['name'] = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname'
|
||||
attr['namespace'] = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims'
|
||||
|
@ -366,10 +373,15 @@ class Command(BaseCommand):
|
|||
attr['values'] = ('31q3sdf1q3sdf213q2d1f5qs',)
|
||||
data['attributes'].append(attr)
|
||||
# attr = {}
|
||||
# attr['name'] = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth'
|
||||
# attr['name'] = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier'
|
||||
# attr['namespace'] = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims'
|
||||
# attr['values'] = ('19',)
|
||||
# attr['values'] = ('41q3sdf1q3sdf213q2d1f5qs',)
|
||||
# data['attributes'].append(attr)
|
||||
attr = {}
|
||||
attr['name'] = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth'
|
||||
attr['namespace'] = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims'
|
||||
attr['values'] = ('17', )
|
||||
data['attributes'].append(attr)
|
||||
session['certificates']['IdP2'] = data
|
||||
|
||||
data = {}
|
||||
|
@ -444,8 +456,8 @@ class Command(BaseCommand):
|
|||
new_rule = make_new_rule_from_missing_predicates(missing_p)
|
||||
print "New rule: %s" % new_rule
|
||||
|
||||
raise Exception('END')
|
||||
|
||||
raise
|
||||
except Exception, err:
|
||||
print "Exception: %s" %str(err)
|
||||
transaction.rollback()
|
||||
|
|
Reference in New Issue