[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/services/pluggableauth - __init__.py:1.1.2.1
Zachery Bir
zbir@urbanape.com
Tue, 3 Jun 2003 09:34:06 -0400
Update of /cvs-repository/Zope3/src/zope/app/interfaces/services/pluggableauth
In directory cvs.zope.org:/tmp/cvs-serv21295/src/zope/app/interfaces/services/pluggableauth
Added Files:
Tag: pluggable_authentication_service-branch
__init__.py
Log Message:
In directory src/zope/app/browser/services/pluggableauth:
- src/zope/app/browser/services/pluggableauth/__init__.py
Adding override for the PluggableAuthenticationService
- src/zope/app/browser/services/pluggableauth/configure.zcml
Configuration for the views for PluggableAuthenticationService,
BTreePrincipalSource, and SimplePrincipal
XXX: TODO: - contents.html view for PluggableAuthenticationService
and BTreePrincipalSource
- get BTreePrincipalSource to actually have additional
zmi_views to be more like a container, for example, it
currently does not have a "Contents" tab
- views for the login challenge
In directory src/zope/app/container:
- src/zope/app/container/ordered.py
Implementation of an OrderedContainer
In directory src/zope/app/container/tests:
- src/zope/app/container/tests/test_ordered.py
Test module for OrderedContainer (all tests currently in docstrings)
In directory src/zope/app/interfaces/container:
- src/zope/app/interfaces/container/__init__.py
Added interface for OrderedContainer
In directory src/zope/app/interfaces/services/pluggableauth:
- src/zope/app/interfaces/services/pluggableauth/__init__.py
Interfaces for PluggableAuthenticationService, Read/WritePrincipalSource,
and UserSchemafied
In directory src/zope/app/services:
- src/zope/app/services/configure.zcml
Included the pluggableauth package
In directory src/zope/app/services/pluggableauth:
- src/zope/app/services/pluggableauth/__init__.py
Implementation of the PluggableAuthenticationService, BTreePrincipalSource,
and SimplePrincipal classes
XXX: TODO: - Wrap all returned items from getPrincipals() in both
PluggableAuthenticationService and BTreePrincipalSource
so that the ids being handed up are tuplified (in the case
of BTreePrincipalSource) and triplified (in the case of
PluggableAuthenticationService) to ensure proper uniquity
- src/zope/app/services/pluggableauth/configure.zcml
Content directives for the above
In directory src/zope/app/services/tests:
- src/zope/app/services/tests/test_pluggableauth.py
Test module for PluggableAuthenticationService, BTreePrincipalSource, and
SimplePrincipal classes (all available tests currently in docstrings)
XXX: TODO: - write unit tests for the ContextMethods to ensure proper
delegation of Authentication responsibility (perhaps
functional tests, instead?)
=== Added File Zope3/src/zope/app/interfaces/services/pluggableauth/__init__.py ===
from zope.interface import Interface
from zope.app.interfaces.security import IAuthenticationService
from zope.schema import TextLine, Password
from zope.i18n import MessageIDFactory
_ = MessageIDFactory("zope.app.services.pluggableauth")
class IUserSchemafied(Interface):
"""A User object with schema-defined attributes."""
id = TextLine(title=_(u"Id"))
title = TextLine(title=_(u"Title"))
description = TextLine(title=_(u"Description"))
login = TextLine(title=_(u"Login"))
password = Password(title=_(u"Password"))
def validate(test_password):
"""Confirm whether 'password' is the password of the user."""
class IPluggableAuthenticationService(IAuthenticationService):
"""An AuthenticationService that can contain multiple pricipal sources.
"""
def addPrincipalSource(id, principal_source):
"""Add an IReadPrincipalSource to the end of our OrderedContainer.
If id is already present or invalid (according to site
policy), raise KeyError.
If principal_source does not implement IReadPrincipalSource,
raise TypeError
"""
def removePrincipalSource(id):
"""Remove a PrincipalSource.
If id is not present, raise KeyError.
"""
class IReadPrincipalSource(Interface):
"""A read-only source of IPrincipals.
"""
def getPrincipal(id):
"""Get principal meta-data.
Returns an object of type IPrincipal for the given principal
id. A NotFoundError is raised if the principal cannot be
found.
Note that the authentication service nearest to the requested
resource is called. It is up to authentication service
implementations to collaborate with services higher in the
object hierarchy.
"""
def getPrincipals(name):
"""Get principals with matching names.
Get a iterable object with the principals with names that are
similar to (e.g. contain) the given name.
"""
class IWritePrincipalSource(Interface):
"""A read-write source of IPrincipals.
"""
class IPrincipalSource(IReadPrincipalSource, IWritePrincipalSource):
"""A read-write principal source."""