# cas_server.cas module

exception cas_server.cas.CASError

  Bases: `ValueError`

class cas_server.cas.ReturnUnicode

  Bases: `object`

  static u(string, charset)

class cas_server.cas.SingleLogoutMixin

  Bases: `object`

  classmethod get_saml_slos(logout_request)

    returns saml logout ticket info

class cas_server.cas.CASClient(*args, **kwargs)

  Bases: `object`

class cas_server.cas.CASClientBase(service_url=None, server_url=None, extra_login_params=None, renew=False, username_attribute=None)

  Bases: `object`

  logout_redirect_param_name = 'service'
  verify_ticket(ticket)

    must return a triple

  get_login_url()

    Generates CAS login URL

  get_logout_url(redirect_url=None)

    Generates CAS logout URL

  get_proxy_url(pgt)

    Returns proxy url, given the proxy granting ticket

  get_proxy_ticket(pgt)

    Returns proxy ticket given the proxy granting ticket

  static get_page_charset(page, default='utf-8')

class cas_server.cas.CASClientV1(service_url=None, server_url=None, extra_login_params=None, renew=False, username_attribute=None)

  Bases: `CASClientBase`, `ReturnUnicode`

  CAS Client Version 1

  logout_redirect_param_name = 'url'
  verify_ticket(ticket)

    Verifies CAS 1.0 authentication ticket.

    Returns username on success and None on failure.

class cas_server.cas.CASClientV2(proxy_callback=None, *args, **kwargs)

  Bases: `CASClientBase`, `ReturnUnicode`

  CAS Client Version 2

  url_suffix = 'serviceValidate'
  logout_redirect_param_name = 'url'
  verify_ticket(ticket)

    Verifies CAS 2.0+/3.0+ XML-based authentication ticket and returns extended attributes

  get_verification_response(ticket)
  classmethod parse_attributes_xml_element(element, charset)
  classmethod verify_response(response, charset)
  classmethod parse_response_xml(response, charset)

class cas_server.cas.CASClientV3(proxy_callback=None, *args, **kwargs)

  Bases: `CASClientV2`, `SingleLogoutMixin`

  CAS Client Version 3

  url_suffix = 'serviceValidate'
  logout_redirect_param_name = 'service'
  classmethod parse_attributes_xml_element(element, charset)
  classmethod verify_response(response, charset)

class cas_server.cas.CASClientWithSAMLV1(proxy_callback=None, *args, **kwargs)

  Bases: `CASClientV2`, `SingleLogoutMixin`

  CASClient 3.0+ with SAML

  verify_ticket(ticket, **kwargs)

    Verifies CAS 3.0+ XML-based authentication ticket and returns extended attributes.

    @date: 2011-11-30 @author: Carlos Gonzalez Vila <carlewis@gmail.com>

    Returns username and attributes on success and None,None on failure.

  fetch_saml_validation(ticket)
  classmethod get_saml_assertion(ticket)

    https://apereo.github.io/cas/7.0.x/protocol/CAS-Protocol-Specification.html#42-samlvalidate-cas-30

    SAML request values:

    RequestID [REQUIRED]:

      unique identifier for the request

    IssueInstant [REQUIRED]:

      timestamp of the request

    samlp:AssertionArtifact [REQUIRED]:

      the valid CAS Service Ticket obtained as a response parameter at login.