

def get(self, request, *args, **kwargs):
    '\n        (2.1) As a credential requestor, /login accepts three optional\n        parameters:\n\n        1. ``service``: the identifier of the application the client is\n           accessing. We assume this identifier to be a URL.\n        2. ``renew``: requires a client to present credentials\n           regardless of any existing single sign-on session.\n        3. ``gateway``: causes the client to not be prompted for\n           credentials. If a single sign-on session exists the user\n           will be logged in and forwarded to the specified service.\n           Otherwise, the user remains logged out and is forwarded to\n           the specified service.\n        '
    service = request.GET.get('service')
    renew = to_bool(request.GET.get('renew'))
    gateway = to_bool(request.GET.get('gateway'))
    if renew:
        logger.debug('Renew request received by credential requestor')
    elif (gateway and service):
        logger.debug('Gateway request received by credential requestor')
        if request.user.is_authenticated():
            st = ServiceTicket.objects.create_ticket(service=service, user=request.user)
            if self.warn_user():
                return redirect('cas_warn', params={
                    'service': service,
                    'ticket': st.ticket,
                })
            return redirect(service, params={
                'ticket': st.ticket,
            })
        else:
            return redirect(service)
    elif request.user.is_authenticated():
        if service:
            logger.debug('Service ticket request received by credential requestor')
            st = ServiceTicket.objects.create_ticket(service=service, user=request.user)
            if self.warn_user():
                return redirect('cas_warn', params={
                    'service': service,
                    'ticket': st.ticket,
                })
            return redirect(service, params={
                'ticket': st.ticket,
            })
        else:
            msg = (_('You are logged in as %s') % request.user)
            messages.success(request, msg)
    return super(LoginView, self).get(request, *args, **kwargs)

dataset/ETHPy150Open jbittel/django-mama-cas/mama_cas/views.py LoginView.get/original