Small fixes to cas.py, waiting for upstream merge

This commit is contained in:
Valentin Samir 2016-06-23 12:14:15 +02:00
parent 7a637c7321
commit e820a3a57a
1 changed files with 4 additions and 1 deletions

View File

@ -134,7 +134,7 @@ class CASClientV1(CASClientBase):
Returns username on success and None on failure. Returns username on success and None on failure.
""" """
params = [('ticket', ticket), ('service', self.service)] params = [('ticket', ticket), ('service', self.service_url)]
url = (urllib_parse.urljoin(self.server_url, 'validate') + '?' + url = (urllib_parse.urljoin(self.server_url, 'validate') + '?' +
urllib_parse.urlencode(params)) urllib_parse.urlencode(params))
page = urllib_request.urlopen(url) page = urllib_request.urlopen(url)
@ -294,6 +294,9 @@ class CASClientWithSAMLV1(CASClientV2, SingleLogoutMixin):
success = tree.find('.//' + SAML_1_0_PROTOCOL_NS + 'StatusCode') success = tree.find('.//' + SAML_1_0_PROTOCOL_NS + 'StatusCode')
if success is not None and success.attrib['Value'].endswith(':Success'): if success is not None and success.attrib['Value'].endswith(':Success'):
# User is validated # User is validated
name_identifier = tree.find('.//' + SAML_1_0_ASSERTION_NS + 'NameIdentifier')
if name_identifier is not None:
user = name_identifier.text
attrs = tree.findall('.//' + SAML_1_0_ASSERTION_NS + 'Attribute') attrs = tree.findall('.//' + SAML_1_0_ASSERTION_NS + 'Attribute')
for at in attrs: for at in attrs:
if self.username_attribute in list(at.attrib.values()): if self.username_attribute in list(at.attrib.values()):