Handle representing a CAS server
Parameters: |
|
---|
Generate a URL to log into a CASService.
>>> srv = CASServer('https://cas.example.org/cas')
>>> svc = type('CASService', (object,), dict(url='https://www.example.org/blah/login'))()
>>> srv.login(svc)
'https://cas.example.org/cas/login?service=https%3A%2F%2Fwww.example.org%2Fblah%2Flogin'
>>> srv.login(svc, gateway=True)
'https://cas.example.org/cas/login?gateway=true&service=https%3A%2F%2Fwww.example.org%2Fblah%2Flogin'
>>> srv.login(svc, renew=True)
'https://cas.example.org/cas/login?renew=true&service=https%3A%2F%2Fwww.example.org%2Fblah%2Flogin'
>>> srv.login(svc, gateway=True, renew=True)
AssertionError: Cannot use renew and gateway together
Check with the CAS server to see if a service ticket is valid.
Parameters: |
|
---|---|
Returns: | the username associated with the ticket |
Raises: | InvalidTicketError if the ticket is not valid |
Be aware that CAS service tickets are not reusable. This prevents replay attacks.
Handle representing a CAS service
Parameter: | url – The url of the service. |
---|
Create a new CASService relocated to be under a different host+scheme+path
>>> svc = CASService('http://www.example.com/login')
>>> svc.url
'http://www.example.com/login'
>>> svc.base('http://www.example.com/test').url
'http://www.example.com/test/login'
Attempt to authenticate to a CAS /login form using the provided username and password.
Parameters: |
|
---|---|
Returns: | a file handle that can be read to see the result and a urllib2 opener with cookiejar |
Raises: | CASLoginError if there was a problem parsing the login form or if username or password retrievel caused an exception |
Raises: | urllib2.URLError if the form location or login result page could not be retrieved successfully |
lxml.etree.HTMLParser will be used if it is available. Otherwise an XML parser choosen by xml.etree.cElementTree will be used.