Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*- # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for # more details. # # You should have received a copy of the GNU General Public License version 3 # along with this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # (c) 2016 Valentin Samir
#: logger facility
""" Class CAS client used to authenticate the user again a CAS provider
:param cas_server.models.FederatedIendityProvider provider: The provider to use for authenticate the user. :param unicode service_url: The service url to transmit to the ``provider``. """ #: the provider returned username #: the provider returned attributes #: the CAS client instance #: the provider returned username this the provider suffix appended #: the identity provider
service_url=service_url, version=provider.cas_protocol_version, server_url=provider.server_url, renew=renew, )
""" :return: the CAS provider login url :rtype: unicode """
""" :param redirect_url: The url to redirect to after logout from the provider, if provided. :type redirect_url: :obj:`unicode` or :obj:`NoneType<types.NoneType>` :return: the CAS provider logout url :rtype: unicode """
""" test ``ticket`` against the CAS provider, if valid, create a :class:`FederatedUser<cas_server.models.FederatedUser>` matching provider returned username and attributes.
:param unicode ticket: The ticket to validate against the provider CAS :return: ``True`` if the validation succeed, else ``False``. :rtype: bool """ username=username, provider=self.provider, defaults=dict(attributs=attributs, ticket=ticket) )[0] else:
def register_slo(username, session_key, ticket): """ association a ``ticket`` with a (``username``, ``session_key``) for processing later SLO request by creating a :class:`cas_server.models.FederateSLO` object.
:param unicode username: A logged user username, with the ``@`` component. :param unicode session_key: A logged user session_key matching ``username``. :param unicode ticket: A ticket used to authentication ``username`` for the session ``session_key``. """ username=username, session_key=session_key, ticket=ticket ) except IntegrityError: # pragma: no cover (ignore if the FederateSLO already exists) pass
""" process a SLO request: Search for ticket values in ``logout_request``. For each ticket value matching a :class:`cas_server.models.FederateSLO`, disconnect the corresponding user.
:param unicode logout_request: An XML document contening one or more Single Log Out requests. """ except NameError: # pragma: no cover (should not happen) slos = [] "Got an SLO requests for ticket %s, logging out user %s" % ( federate_slo.username, federate_slo.ticket ) ) username=federate_slo.username, session_key=federate_slo.session_key ) except User.DoesNotExist: # pragma: no cover (should not happen) pass |