Commit 4e64c503 by Ed Crewe

fix broken proxy auth check

parent 9d56c5a2
...@@ -49,10 +49,10 @@ def _verify_cas2(ticket, service): ...@@ -49,10 +49,10 @@ def _verify_cas2(ticket, service):
urlencode(params)) urlencode(params))
page = urlopen(url) page = urlopen(url)
try:
response = page.read() response = page.read()
tree = ElementTree.fromstring(response) tree = ElementTree.fromstring(response)
page.close()
if tree[0].tag.endswith('authenticationSuccess'): if tree[0].tag.endswith('authenticationSuccess'):
username = tree[0][0].text username = tree[0][0].text
if len(tree[0]) >= 2 and tree[0][1].tag.endswith('proxyGrantingTicket'): if len(tree[0]) >= 2 and tree[0][1].tag.endswith('proxyGrantingTicket'):
...@@ -68,8 +68,6 @@ def _verify_cas2(ticket, service): ...@@ -68,8 +68,6 @@ def _verify_cas2(ticket, service):
return username return username
else: else:
return None return None
finally:
page.close()
def verify_proxy_ticket(ticket, service): def verify_proxy_ticket(ticket, service):
......
...@@ -98,6 +98,7 @@ class TestCAS(unittest.TestCase): ...@@ -98,6 +98,7 @@ class TestCAS(unittest.TestCase):
print 'PASS: Got PT - %s' % pt print 'PASS: Got PT - %s' % pt
else: else:
print pt print pt
#self.logout()
print '' print ''
print 'Test SSO server login with proxy ticket' print 'Test SSO server login with proxy ticket'
...@@ -107,6 +108,7 @@ class TestCAS(unittest.TestCase): ...@@ -107,6 +108,7 @@ class TestCAS(unittest.TestCase):
print 'PASS: Got Success response for app %s using proxy %s' % (self.urls['app'], proxy) print 'PASS: Got Success response for app %s using proxy %s' % (self.urls['app'], proxy)
else: else:
print 'FAIL: The proxy login to %s via %s has failed' % (self.urls['app'], self.urls['proxy']) print 'FAIL: The proxy login to %s via %s has failed' % (self.urls['app'], self.urls['proxy'])
self.logout()
print '' print ''
print 'Test direct proxy login' print 'Test direct proxy login'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment