[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/pas/ SQL PAS Authentication Plugin, sprinting w/Claudia Albisetti

Amos Brocco amos.brocco at mriyasoftware.com
Tue Oct 12 03:35:26 EDT 2004


Log message for revision 27979:
  SQL PAS Authentication Plugin, sprinting w/Claudia Albisetti
  


Changed:
  U   Zope3/trunk/src/zope/app/pas/authenticationplugins.zcml
  A   Zope3/trunk/src/zope/app/pas/sql.py


-=-
Modified: Zope3/trunk/src/zope/app/pas/authenticationplugins.zcml
===================================================================
--- Zope3/trunk/src/zope/app/pas/authenticationplugins.zcml	2004-10-11 23:14:06 UTC (rev 27978)
+++ Zope3/trunk/src/zope/app/pas/authenticationplugins.zcml	2004-10-12 07:35:19 UTC (rev 27979)
@@ -28,5 +28,34 @@
       class="zope.app.pas.zodb.PersistentPrincipalStorage"
       permission="zope.ManageServices"
       />
+      
+      
+    <localUtility class=".sql.SQLAuthenticationPlugin">
 
+    <implements
+        interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
+
+    <require
+        permission="zope.ManageContent"
+        interface="zope.app.sqlscript.interfaces.ISQLScript"
+        set_schema="zope.app.sqlscript.interfaces.ISQLScript"
+        />
+    <require
+        permission="zope.ManageContent"
+        interface="zope.app.file.interfaces.IFileContent"
+        />
+    <require
+        permission="zope.ManageContent"
+        interface=".interfaces.IAuthenticationPlugin" />
+
+  </localUtility>
+
+
+  <browser:addMenuItem
+      title="SQL PAS Authentication Plugin"
+      description="A SQL PAS Authentication Plugin"
+      class="zope.app.pas.sql.SQLAuthenticationPlugin"
+      permission="zope.ManageContent"
+      />
+
 </configure>

Added: Zope3/trunk/src/zope/app/pas/sql.py
===================================================================
--- Zope3/trunk/src/zope/app/pas/sql.py	2004-10-11 23:14:06 UTC (rev 27978)
+++ Zope3/trunk/src/zope/app/pas/sql.py	2004-10-12 07:35:19 UTC (rev 27979)
@@ -0,0 +1,35 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""SQL Authentication Plugin.
+
+$Id: sqlauthpas.py,v 1.0 2004/10/11 mriya3
+"""
+from zope.app.sqlscript import SQLScript
+import zope.interface
+import interfaces
+
+class SQLAuthenticationPlugin(SQLScript):
+    """ SQL Authentication Plugin for Pluggable Authentication System """
+    
+    zope.interface.implements(interfaces.IAuthenticationPlugin)
+        
+    def authenticateCredentials(self, credentials):
+        result = self(**credentials)
+        if not len(result):
+            return None
+        return str(result[0]['id']),result[0]
+
+
+        
+        



More information about the Zope3-Checkins mailing list