# cas_server.federate module

federated mode helper classes

cas_server.federate.logger = <Logger cas_server.federate (INFO)>

  logger facility

class cas_server.federate.CASFederateValidateUser(provider, service_url, renew=False)

  Bases: `object`

  Class CAS client used to authenticate the user again a CAS provider

  Parameters:

    - provider (cas_server.models.FederatedIendityProvider) – The provider to use for authenticate the user.

    - service_url (unicode) – The service url to transmit to the `provider`.

  username = None

    the provider returned username

  attributs = {}

    the provider returned attributes

  federated_username = None

    the provider returned username this the provider suffix appended

  provider = None

    the identity provider

  client = None

    the CAS client instance

  get_login_url()
    Returns:

      the CAS provider login url

    Return type:

      unicode

  get_logout_url(redirect_url=None)
    Parameters:

      redirect_url (`unicode` or `NoneType`) – The url to redirect to after logout from the provider, if provided.

    Returns:

      the CAS provider logout url

    Return type:

      unicode

  verify_ticket(ticket)

    test `ticket` against the CAS provider, if valid, create a `FederatedUser` matching provider returned username and attributes.

    Parameters:

      ticket (unicode) – The ticket to validate against the provider CAS

    Returns:

      `True` if the validation succeed, else `False`.

    Return type:

      bool

  static register_slo(username, session_key, ticket)

    association a `ticket` with a (`username`, `session_key`) for processing later SLO request by creating a `cas_server.models.FederateSLO` object.

    Parameters:

      - username (unicode) – A logged user username, with the `@` component.

      - session_key (unicode) – A logged user session_key matching `username`.

      - ticket (unicode) – A ticket used to authentication `username` for the session `session_key`.

  clean_sessions(logout_request)

    process a SLO request: Search for ticket values in `logout_request`. For each ticket value matching a `cas_server.models.FederateSLO`, disconnect the corresponding user.

    Parameters:

      logout_request (unicode) – An XML document contening one or more Single Log Out requests.