[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - BasicVFSAuthAdapter.py:1.1.4.1 security.zcml:1.1.2.4

Shane Hathaway shane@cvs.zope.org
Fri, 12 Apr 2002 17:31:22 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/Security
In directory cvs.zope.org:/tmp/cvs-serv20835/lib/python/Zope/App/Security

Modified Files:
      Tag: Zope-3x-branch
	security.zcml 
Added Files:
      Tag: Zope-3x-branch
	BasicVFSAuthAdapter.py 
Log Message:
Merged Zope3-Server-Branch.


=== Added File Zope3/lib/python/Zope/App/Security/BasicVFSAuthAdapter.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 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.
# 
##############################################################################
# HTTP Basic Authentication adapter

from Zope.Publisher.VFS.IVFSCredentials import IVFSCredentials
from LoginPassword import LoginPassword

class BasicVFSAuthAdapter(LoginPassword):

    __used_for__ = IVFSCredentials

    __request = None

    def __init__(self, request):
        self.__request = request
        # XXX base64 decoding should be done here, not in request
        lpw = request._authUserPW()
        if lpw is None:
            login, password = None, None
        else:
            login, password = lpw
        LoginPassword.__init__(self, login, password)

    def needLogin(self, realm):
        self.__request.unauthorized("Did not work")


=== Zope3/lib/python/Zope/App/Security/security.zcml 1.1.2.3 => 1.1.2.4 ===
          for="Zope.Publisher.HTTP.IHTTPCredentials." />
 
+<adapter factory="Zope.App.Security.BasicVFSAuthAdapter."
+         provides="Zope.App.Security.ILoginPassword."
+         for="Zope.Publisher.VFS.IVFSCredentials." />
 
 <!-- Role-Permission management view -->