Certificate auth start
authorAlex Dehnert <adehnert@mit.edu>
Tue, 2 Feb 2010 15:55:36 +0000 (10:55 -0500)
committerAlex Dehnert <adehnert@mit.edu>
Mon, 6 Jun 2011 05:57:09 +0000 (01:57 -0400)
django/mit/__init__.py [new file with mode: 0644]

diff --git a/django/mit/__init__.py b/django/mit/__init__.py
new file mode 100644 (file)
index 0000000..4757fdd
--- /dev/null
@@ -0,0 +1,19 @@
+from django.contrib.auth.middleware import RemoteUserMiddleware
+
+def zephyr(msg, clas='remit', instance='log', rcpt='adehnert',):
+    import os
+    os.system("zwrite -d -c '%s' -i '%s' '%s' -m '%s'" % (clas, instance, rcpt, msg, ))
+
+class ScriptsRemoteUserMiddleware(RemoteUserMiddleware):
+    header = 'SSL_CLIENT_S_DN_Email'
+    
+    def clean_username(username):
+        zephyr(username)
+        if '@' in username:
+            name, domain = username.split('@')
+            assert domain.upper() == 'MIT.EDU'
+            return name
+        else:
+            return name
+
+zephyr('Defined ScriptsRUM')