Skip to content

Commit e1060b1

Browse files
committed
Make get_location more robust with POST binding
1 parent 6374209 commit e1060b1

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

djangosaml2/utils.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,11 @@ def get_idp_sso_supported_bindings(idp_entity_id=None, config=None):
6060

6161
def get_location(http_info):
6262
"""Extract the redirect URL from a pysaml2 http_info object"""
63-
assert 'headers' in http_info
64-
headers = http_info['headers']
65-
66-
assert len(headers) == 1
67-
header_name, header_value = headers[0]
68-
assert header_name == 'Location'
69-
return header_value
63+
try:
64+
headers = dict(http_info['headers'])
65+
return headers['Location']
66+
except KeyError:
67+
return http_info['url']
7068

7169

7270
def fail_acs_response(request, *args, **kwargs):

0 commit comments

Comments
 (0)