X-Git-Url: https://git.mdrn.pl/django-cas-provider.git/blobdiff_plain/243a932dd7165b4dbe5d8938f622450b4b7cdaa3..2cf88a572643b5e54858f5d3b00d188b8e7230ed:/cas_provider/views.py?ds=inline diff --git a/cas_provider/views.py b/cas_provider/views.py index 0f53d38..126e3d1 100644 --- a/cas_provider/views.py +++ b/cas_provider/views.py @@ -239,7 +239,7 @@ def proxy(request): return _cas2_error_response(INVALID_TICKET) pt = ProxyTicket.objects.create(proxyGrantingTicket=proxyGrantingTicket, - user=proxyGrantingTicket.serviceTicket.user, + user=proxyGrantingTicket.user, service=targetService) return _cas2_proxy_success(pt.ticket) @@ -276,13 +276,9 @@ def ticket_validate(service, ticket_string, pgtUrl): if hasattr(ticket, 'proxyticket'): pgt = ticket.proxyticket.proxyGrantingTicket # I am issued by this proxy granting ticket - if hasattr(pgt.serviceTicket, 'proxyticket'): - while pgt: - if hasattr(pgt.serviceTicket, 'proxyticket'): - proxies += (pgt.serviceTicket.service,) - pgt = pgt.serviceTicket.proxyticket.proxyGrantingTicket - else: - pgt = None + while pgt.pgt is not None: + proxies += (pgt.service,) + pgt = pgt.pgt user = ticket.user ticket.delete() @@ -315,12 +311,10 @@ def generate_proxy_granting_ticket(pgt_url, ticket): uri = list(urlsplit(pgt_url)) pgt = ProxyGrantingTicket() - pgt.serviceTicket = ticket - pgt.targetService = pgt_url - - if hasattr(ticket, 'proxyGrantingTicket'): - # here we got a proxy ticket! tata! - pgt.pgt = ticket.proxyGrantingTicket + pgt.user = ticket.user + pgt.service = ticket.service + # Remember if it's a chained PGT. + pgt.pgt = getattr(ticket, 'proxyGrantingTicket', None) params = {'pgtId': pgt.ticket, 'pgtIou': pgt.pgtiou}