[Checkins] SVN: Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/ Support for login_transform in all relevant plugins.

Maurits van Rees cvs-admin at zope.org
Fri Dec 28 17:07:41 UTC 2012


Log message for revision 128929:
  Support for login_transform in all relevant plugins.
  
  Now also in DelegatingMultiPlugin, DomainAuthHelper, 
  HTTPBasicAuthHelper, InlineAuthHelper and SessionAuthHelper.
  No tests for those yet.

Changed:
  U   Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/DelegatingMultiPlugin.py
  U   Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/DomainAuthHelper.py
  U   Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/HTTPBasicAuthHelper.py
  U   Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/InlineAuthHelper.py
  U   Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/SessionAuthHelper.py

-=-
Modified: Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/DelegatingMultiPlugin.py
===================================================================
--- Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/DelegatingMultiPlugin.py	2012-12-28 15:53:47 UTC (rev 128928)
+++ Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/DelegatingMultiPlugin.py	2012-12-28 17:07:40 UTC (rev 128929)
@@ -19,8 +19,7 @@
 __version__ = '$Revision$'[11:-2]
 
 # General Python imports
-import copy, os
-from urllib import quote_plus
+import copy
 
 # Zope imports
 from Acquisition import aq_base
@@ -128,6 +127,7 @@
                 AuthEncoding.pw_validate(emergency_user._getPassword(), password):
             return ( login, login )
 
+        login = self.applyTransform(login)
         user = acl.getUser(login)
 
         if user is None:
@@ -205,6 +205,8 @@
         if acl is None:
             return ()
 
+        if login:
+            login = self.applyTransform(login)
         if exact_match:
             if id:
                 user = acl.getUserById(id)
@@ -221,8 +223,8 @@
                                , 'editurl' : '%s' % edit_url
                                } )
         else:
-            l_results = []
-            seen = []
+            l_results = []  # never used
+            seen = []  # never used
             # XXX WAAAAA!!!!
             all_users = acl.getUsers()
 

Modified: Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/DomainAuthHelper.py
===================================================================
--- Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/DomainAuthHelper.py	2012-12-28 15:53:47 UTC (rev 128928)
+++ Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/DomainAuthHelper.py	2012-12-28 17:07:40 UTC (rev 128929)
@@ -19,13 +19,12 @@
 
 # General Python imports
 import socket
-import os
 import time
-import copy
 import re
 
 try:
     from IPy import IP
+    IP  # pyflakes
 except ImportError:
     IP = None
 
@@ -180,6 +179,7 @@
         login = credentials.get('login', '')
         r_host = credentials.get('remote_host', '')
         r_address = credentials.get('remote_address', '')
+        login = self.applyTransform(login)
         matches = self._findMatches(login, r_host, r_address)
 
         if len(matches) > 0:
@@ -229,6 +229,7 @@
         if not r_host and not r_address:
             return tuple(matches)
 
+        login = self.applyTransform(login)
         all_info = list(self._domain_map.get(login, []))
         all_info.extend(self._domain_map.get('', []))
 
@@ -250,7 +251,7 @@
         candidates = [r_host, r_address]
 
         for match_info in all_info:
-            m = []
+            m = []  # XXX never used
             m_type = match_info['match_type']
             m_string = match_info['match_string']
             filter = match_info.get('match_filter')

Modified: Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/HTTPBasicAuthHelper.py
===================================================================
--- Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/HTTPBasicAuthHelper.py	2012-12-28 15:53:47 UTC (rev 128928)
+++ Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/HTTPBasicAuthHelper.py	2012-12-28 17:07:40 UTC (rev 128929)
@@ -78,7 +78,7 @@
         if login_pw is not None:
             name, password = login_pw
 
-            creds[ 'login' ] = name
+            creds[ 'login' ] = self.applyTransform(name)
             creds[ 'password' ] = password
             creds[ 'remote_host' ] = request.get('REMOTE_HOST', '')
 

Modified: Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/InlineAuthHelper.py
===================================================================
--- Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/InlineAuthHelper.py	2012-12-28 15:53:47 UTC (rev 128928)
+++ Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/InlineAuthHelper.py	2012-12-28 17:07:40 UTC (rev 128929)
@@ -16,9 +16,6 @@
 $Id$
 """
 
-from base64 import encodestring, decodestring
-from urllib import quote
-
 from AccessControl.SecurityInfo import ClassSecurityInfo
 from OFS.Folder import Folder
 from App.class_init import default__class_init__ as InitializeClass
@@ -26,19 +23,15 @@
 from zope.interface import Interface
 
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
-from Products.PageTemplates.ZopePageTemplate import manage_addPageTemplate
 
 from Products.PluggableAuthService.interfaces.plugins import \
         ILoginPasswordHostExtractionPlugin
 from Products.PluggableAuthService.interfaces.plugins import \
         IChallengePlugin
-from Products.PluggableAuthService.interfaces.plugins import \
-        ICredentialsUpdatePlugin
-from Products.PluggableAuthService.interfaces.plugins import \
-        ICredentialsResetPlugin
 from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin
 from Products.PluggableAuthService.utils import classImplements
 
+
 class IInlineAuthHelper(Interface):
     """ Marker interface.
     """
@@ -96,7 +89,7 @@
         password = request.get('__ac_password', '')
 
         if login:
-            creds['login'] = login
+            creds['login'] = self.applyTransform(login)
             creds['password'] = password
 
         if creds:

Modified: Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/SessionAuthHelper.py
===================================================================
--- Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/SessionAuthHelper.py	2012-12-28 15:53:47 UTC (rev 128928)
+++ Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/plugins/SessionAuthHelper.py	2012-12-28 17:07:40 UTC (rev 128929)
@@ -73,7 +73,7 @@
         password = request.SESSION.get('__ac_password', '')
 
         if name:
-            creds[ 'login' ] = name
+            creds[ 'login' ] = self.applyTransform(name)
             creds[ 'password' ] = password
         else:
             # Look into the request now
@@ -81,6 +81,7 @@
 
             if login_pw is not None:
                 name, password = login_pw
+                name = self.applyTransform(name)
                 creds[ 'login' ] = name
                 creds[ 'password' ] = password
                 request.SESSION.set('__ac_name', name)
@@ -99,7 +100,7 @@
     security.declarePrivate('updateCredentials')
     def updateCredentials(self, request, response, login, new_password):
         """ Respond to change of credentials. """
-        request.SESSION.set('__ac_name', login)
+        request.SESSION.set('__ac_name', self.applyTransform(login))
         request.SESSION.set('__ac_password', new_password)
 
     security.declarePrivate('resetCredentials')



More information about the checkins mailing list