zope.login-1.0.0/bootstrap.py0000644000000000000000000000337010601427554016130 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2006 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (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. # ############################################################################## """Bootstrap a buildout-based project Simply run this script in a directory containing a buildout.cfg. The script accepts buildout command-line options, so you can use the -c option to specify an alternate configuration file. $Id: bootstrap.py 73551 2007-03-25 09:14:36Z dobe $ """ import os, shutil, sys, tempfile, urllib2 tmpeggs = tempfile.mkdtemp() ez = {} exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py' ).read() in ez ez['use_setuptools'](to_dir=tmpeggs, download_delay=0) import pkg_resources cmd = 'from setuptools.command.easy_install import main; main()' if sys.platform == 'win32': cmd = '"%s"' % cmd # work around spawn lamosity on windows ws = pkg_resources.working_set assert os.spawnle( os.P_WAIT, sys.executable, sys.executable, '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout', dict(os.environ, PYTHONPATH= ws.find(pkg_resources.Requirement.parse('setuptools')).location ), ) == 0 ws.add_entry(tmpeggs) ws.require('zc.buildout') import zc.buildout.buildout zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap']) shutil.rmtree(tmpeggs) zope.login-1.0.0/buildout.cfg0000644000000000000000000000013411317141754016044 0ustar rootroot00000000000000[buildout] develop = . parts = test [test] recipe = zc.recipe.testrunner eggs = zope.login zope.login-1.0.0/CHANGES.txt0000644000000000000000000000030711317145366015352 0ustar rootroot00000000000000Changelog ========= 1.0.0 (2009-12-31) ------------------ - Extracted BasicAuthAdapter and FTPAuth adapters from zope.publisher. They should have never gone into that package in the first place. zope.login-1.0.0/PKG-INFO0000644000000000000000000000221011317145430014621 0ustar rootroot00000000000000Metadata-Version: 1.0 Name: zope.login Version: 1.0.0 Summary: Login helpers for zope.publisher / authentication. Home-page: http://pypi.python.org/pypi/zope.login Author: Zope Corporation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Description: Overview ======== This package provides a login helpers for zope.publisher based on the concepts of zope.authentication. Changelog ========= 1.0.0 (2009-12-31) ------------------ - Extracted BasicAuthAdapter and FTPAuth adapters from zope.publisher. They should have never gone into that package in the first place. Keywords: zope login authentication Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Classifier: Framework :: Zope3 zope.login-1.0.0/README.txt0000644000000000000000000000017211317141752015232 0ustar rootroot00000000000000Overview ======== This package provides a login helpers for zope.publisher based on the concepts of zope.authentication. zope.login-1.0.0/setup.cfg0000644000000000000000000000007311317145430015352 0ustar rootroot00000000000000[egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 zope.login-1.0.0/setup.py0000644000000000000000000000405111317145256015251 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2006-2009 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (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. # ############################################################################## import os from setuptools import setup, find_packages def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() setup(name='zope.login', version = '1.0.0', author='Zope Corporation and Contributors', author_email='zope-dev@zope.org', description='Login helpers for zope.publisher / authentication.', long_description=( read('README.txt') + '\n' + read('CHANGES.txt') ), keywords = "zope login authentication", classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: Zope Public License', 'Programming Language :: Python', 'Natural Language :: English', 'Operating System :: OS Independent', 'Topic :: Internet :: WWW/HTTP', 'Framework :: Zope3'], url='http://pypi.python.org/pypi/zope.login', license='ZPL 2.1', packages=find_packages('src'), package_dir = {'': 'src'}, namespace_packages=['zope'], install_requires=['setuptools', 'zope.authentication', 'zope.component', 'zope.interface', 'zope.publisher', ], include_package_data = True, zip_safe = False, ) zope.login-1.0.0/src/zope/__init__.py0000644000000000000000000000010011317141776017406 0ustar rootroot00000000000000import pkg_resources; pkg_resources.declare_namespace(__name__) zope.login-1.0.0/src/zope/login/__init__.py0000644000000000000000000000000111317145234020507 0ustar rootroot00000000000000#zope.login-1.0.0/src/zope/login/configure.zcml0000644000000000000000000000064411317144712021263 0ustar rootroot00000000000000 zope.login-1.0.0/src/zope/login/ftp.py0000644000000000000000000000240511317145012017545 0ustar rootroot00000000000000############################################################################## # # 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.1 (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 # ############################################################################## from zope.authentication.loginpassword import LoginPassword from zope.component import adapts from zope.publisher.interfaces.ftp import IFTPCredentials class FTPAuth(LoginPassword): """ILoginPassword adapter for handling common FTP authentication.""" adapts(IFTPCredentials) def __init__(self, request): self.__request = request lpw = request._authUserPW() if lpw is None: login, password = None, None else: login, password = lpw super(FTPAuth, self).__init__(login, password) def needLogin(self, realm): self.__request.unauthorized("Did not work") zope.login-1.0.0/src/zope/login/http.py0000644000000000000000000000255111317144234017742 0ustar rootroot00000000000000############################################################################## # # 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.1 (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. # ############################################################################## from zope.authentication.loginpassword import LoginPassword from zope.component import adapts from zope.publisher.interfaces.http import IHTTPCredentials class BasicAuthAdapter(LoginPassword): """ILoginPassword adapter for handling HTTP Basic authentication""" adapts(IHTTPCredentials) def __init__(self, request): self.__request = request # TODO base64 decoding should be done here, not in request lpw = request._authUserPW() if lpw is None: login, password = None, None else: login, password = lpw super(BasicAuthAdapter, self).__init__(login, password) def needLogin(self, realm): self.__request.unauthorized('basic realm="%s"' % realm) zope.login-1.0.0/src/zope/login/tests/__init__.py0000644000000000000000000000000111317144750021653 0ustar rootroot00000000000000#zope.login-1.0.0/src/zope/login/tests/test_basicauth.py0000644000000000000000000000273611317145146023137 0ustar rootroot00000000000000############################################################################## # # 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.1 (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. # ############################################################################## from unittest import TestCase from zope.publisher.http import BasicAuthAdapter class Request(object): def __init__(self, lpw): self.lpw = lpw def _authUserPW(self): return self.lpw challenge = None def unauthorized(self, challenge): self.challenge = challenge class Test(TestCase): def testBasicAuthAdapter(self): r = Request(None) a = BasicAuthAdapter(r) self.assertEqual(a.getLogin(), None) self.assertEqual(a.getPassword(), None) r = Request(("tim", "123")) a = BasicAuthAdapter(r) self.assertEqual(a.getLogin(), "tim") self.assertEqual(a.getPassword(), "123") def testUnauthorized(self): r = Request(None) a = BasicAuthAdapter(r) a.needLogin("tim") self.assertEqual(r.challenge, 'basic realm="tim"') zope.login-1.0.0/src/zope/login/tests/test_ftpauth.py0000644000000000000000000000314411317145130022632 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2003 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (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. # ############################################################################## from unittest import TestCase from zope.interface import implements from zope.publisher.ftp import FTPAuth from zope.publisher.interfaces.ftp import IFTPCredentials class FTPCredentials(object): __doc__ = IFTPCredentials.__doc__ implements(IFTPCredentials) def __init__(self, credentials): self.credentials = credentials def _authUserPW(self): return self.credentials unauth = 0 def unauthorized(self, challenge): self.unauth += 1 class Test(TestCase): def test(self): request = FTPCredentials(('bob', '123')) auth = FTPAuth(request) self.assertEqual(auth.getLogin(), 'bob') self.assertEqual(auth.getPassword(), '123') unauth = request.unauth auth.needLogin('xxx') self.assertEqual(request.unauth, unauth+1) request = FTPCredentials(None) auth = FTPAuth(request) self.assertEqual(auth.getLogin(), None) self.assertEqual(auth.getPassword(), None) zope.login-1.0.0/src/zope.login.egg-info/dependency_links.txt0000644000000000000000000000000111317145430024144 0ustar rootroot00000000000000 zope.login-1.0.0/src/zope.login.egg-info/namespace_packages.txt0000644000000000000000000000000511317145430024424 0ustar rootroot00000000000000zope zope.login-1.0.0/src/zope.login.egg-info/not-zip-safe0000644000000000000000000000000111317142026022322 0ustar rootroot00000000000000 zope.login-1.0.0/src/zope.login.egg-info/PKG-INFO0000644000000000000000000000221011317145430021166 0ustar rootroot00000000000000Metadata-Version: 1.0 Name: zope.login Version: 1.0.0 Summary: Login helpers for zope.publisher / authentication. Home-page: http://pypi.python.org/pypi/zope.login Author: Zope Corporation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Description: Overview ======== This package provides a login helpers for zope.publisher based on the concepts of zope.authentication. Changelog ========= 1.0.0 (2009-12-31) ------------------ - Extracted BasicAuthAdapter and FTPAuth adapters from zope.publisher. They should have never gone into that package in the first place. Keywords: zope login authentication Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Classifier: Framework :: Zope3 zope.login-1.0.0/src/zope.login.egg-info/requires.txt0000644000000000000000000000011311317145430022471 0ustar rootroot00000000000000setuptools zope.authentication zope.component zope.interface zope.publisherzope.login-1.0.0/src/zope.login.egg-info/SOURCES.txt0000644000000000000000000000106211317145430021761 0ustar rootroot00000000000000CHANGES.txt README.txt bootstrap.py buildout.cfg setup.py src/zope/__init__.py src/zope.login.egg-info/PKG-INFO src/zope.login.egg-info/SOURCES.txt src/zope.login.egg-info/dependency_links.txt src/zope.login.egg-info/namespace_packages.txt src/zope.login.egg-info/not-zip-safe src/zope.login.egg-info/requires.txt src/zope.login.egg-info/top_level.txt src/zope/login/__init__.py src/zope/login/configure.zcml src/zope/login/ftp.py src/zope/login/http.py src/zope/login/tests/__init__.py src/zope/login/tests/test_basicauth.py src/zope/login/tests/test_ftpauth.pyzope.login-1.0.0/src/zope.login.egg-info/top_level.txt0000644000000000000000000000000511317145430022623 0ustar rootroot00000000000000zope