def proxy(request):
targetService = request.GET['targetService']
- pgtiou = request.GET['pgt']
+ pgt_id = request.GET['pgt']
try:
- proxyGrantingTicket = ProxyGrantingTicket.objects.get(pgtiou=pgtiou)
+ proxyGrantingTicket = ProxyGrantingTicket.objects.get(ticket=pgt_id)
except ProxyGrantingTicket.DoesNotExist:
return _cas2_error_response(INVALID_TICKET)
- if not proxyGrantingTicket.targetService == targetService:
- return _cas2_error_response(INVALID_SERVICE,
- "The PGT was issued for %(original)s but the PT was requested for %(but)s" % dict(
- original=proxyGrantingTicket.targetService, but=targetService))
-
pt = ProxyTicket.objects.create(proxyGrantingTicket=proxyGrantingTicket,
user=proxyGrantingTicket.serviceTicket.user,
service=targetService)
except ServiceTicket.DoesNotExist:
return _cas2_error_response(INVALID_TICKET)
- if ticket.service != service:
+ ticketUrl = urlparse.urlparse(ticket.service)
+ serviceUrl = urlparse.urlparse(service)
+
+ if not(ticketUrl.hostname == serviceUrl.hostname and ticketUrl.path == serviceUrl.path and ticketUrl.port == serviceUrl.port):
return _cas2_error_response(INVALID_SERVICE)
pgtIouId = None
query = dict(urlparse.parse_qsl(uri[4]))
query.update(params)
- uri[4] = urlencode(query)
+ uri[3] = urlencode(query)
try:
response = urllib2.urlopen(urlparse.urlunsplit(uri))