Cert auth works!
authorAlex Dehnert <adehnert@mit.edu>
Tue, 2 Feb 2010 16:38:15 +0000 (11:38 -0500)
committerAlex Dehnert <adehnert@mit.edu>
Mon, 6 Jun 2011 05:57:09 +0000 (01:57 -0400)
django/mit/__init__.py

index 4757fdd6e7fff64142d94cc71169c2601728166d..e496dbd9472cafb7cbb99e67a04bc01a079441e1 100644 (file)
@@ -1,4 +1,6 @@
 from django.contrib.auth.middleware import RemoteUserMiddleware
+from django.contrib.auth.backends import RemoteUserBackend
+from django.contrib import auth
 
 def zephyr(msg, clas='remit', instance='log', rcpt='adehnert',):
     import os
@@ -6,14 +8,12 @@ def zephyr(msg, clas='remit', instance='log', rcpt='adehnert',):
 
 class ScriptsRemoteUserMiddleware(RemoteUserMiddleware):
     header = 'SSL_CLIENT_S_DN_Email'
-    
-    def clean_username(username):
-        zephyr(username)
+
+class ScriptsRemoteUserBackend(RemoteUserBackend):
+    def clean_username(self, username, ):
         if '@' in username:
             name, domain = username.split('@')
             assert domain.upper() == 'MIT.EDU'
             return name
         else:
-            return name
-
-zephyr('Defined ScriptsRUM')
+            return username