Added identifier history support to CAS 2.0 validation. `signals.on_cas_collect_histo...
authordeyk <deyk@crossway.org>
Mon, 16 Apr 2012 23:48:37 +0000 (16:48 -0700)
committerdeyk <deyk@crossway.org>
Mon, 16 Apr 2012 23:48:37 +0000 (16:48 -0700)
cas_provider/views.py

index 68e6784..be6c4d4 100644 (file)
@@ -169,7 +169,7 @@ def validate(request):
             username = ticket.user.username
             ticket.delete()
 
-            results = signals.on_cas_collect_histories.send(sender=validate, for_email=ticket.user.email)
+            results = signals.on_cas_collect_histories.send(sender=validate, for_user=ticket.user)
             histories = '\n'.join('\n'.join(rs) for rc, rs in results)
             logger.info('Validated %s %s', username, "(also %s)" % histories if histories else '')
             return HttpResponse("yes\n%s\n%s" % (username, histories))
@@ -341,6 +341,8 @@ def auth_success_response(user, pgt, proxies):
         if custom:
             attrs.update(custom)
 
+    attrs['identifiers'] = [i for r, i in signals.on_cas_collect_histories.send(sender=validate, for_user=user)]
+
     if attrs:
         formatter = get_callable(settings.CAS_CUSTOM_ATTRIBUTES_FORMATER)
         formatter(auth_success, attrs)