kstateome / django-cas

K-State's maintained version of django-cas
MIT License
112 stars 83 forks source link

Add get_proxy_ticket #23

Closed dstegelman closed 10 years ago

dstegelman commented 10 years ago

Should this be apart of django-cas?

def get_proxy_ticket(username):
    from cas.models import Tgt
    from django.core.exceptions import ObjectDoesNotExist

    try:
        tgt = Tgt.objects.get(username=username)
        proxy_ticket = tgt.get_proxy_ticket_for(getattr(settings, 'TICKET_SERVICE_URL', None))

        return proxy_ticket
    except ObjectDoesNotExist:
        return None