Skip to content

Commit 0ef73c9

Browse files
committed
Fix logic error in pick_binding method for class Entity
Fix logic in the pick_binding method for the class Entity that prevented the method from properly returning binding and location tuples for authentication requests with AssertionConsumerServiceIndex instead of AssertionConsumerServiceURL. The logic error was assuming that a getattr() call on a request without an AssertionConsumerServiceURL would throw an AttributeError. It does not and instead returns None, so the resulting path through the code would cause the "first" binding and location tuple found in the SAML metadata to be returned instead of the tuple corresponding to the AssertionConsumerServiceIndex.
1 parent 8214b54 commit 0ef73c9

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/saml2/entity.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -269,16 +269,8 @@ def pick_binding(self, service, bindings=None, descr_type="", request=None,
269269
else:
270270
descr_type = "spsso"
271271

272-
_url = _index = None
273-
if request:
274-
try:
275-
_url = getattr(request, "%s_url" % service)
276-
except AttributeError:
277-
_url = None
278-
try:
279-
_index = getattr(request, "%s_index" % service)
280-
except AttributeError:
281-
pass
272+
_url = getattr(request, "%s_url" % service, None)
273+
_index = getattr(request, "%s_index" % service, None)
282274

283275
for binding in bindings:
284276
try:

0 commit comments

Comments
 (0)