Fixed handling of 'better'.

This commit is contained in:
Roland Hedberg 2013-04-28 10:21:57 +02:00
parent 1f3dd5de31
commit ff1b92f071
2 changed files with 20 additions and 3 deletions

View File

@ -127,10 +127,14 @@ class AuthnBroker(object):
else:
_item = self.db["info"][_refs[0]]
_level = _item["level"]
if _item["method"]:
res = [(_item["method"], _refs[0])]
if comparision_type != "better":
if _item["method"]:
res = [(_item["method"], _refs[0])]
else:
res = []
else:
res = []
for ref in _refs[1:]:
item = self.db[ref]
res.append((item["method"], ref))

View File

@ -135,5 +135,18 @@ def test_authn_3():
method, ref = info[0]
assert REF2METHOD[AL4] == method
rac = requested_authn_context(AL1, "exact")
info = authn.pick(rac)
assert len(info) == 1
method, ref = info[0]
assert REF2METHOD[AL1] == method
rac = requested_authn_context(AL1, "better")
info = authn.pick(rac)
assert len(info) == 3
if __name__ == "__main__":
test_authn_2()
test_authn_3()