Creates 'authenticated' principals.

An authenticated principal is created as a result of an authentication operation.

To use the factory, create it with the info (interfaces.IPrincipalInfo) of the principal to create and a request:

>>> info = PrincipalInfo('users.mary', 'mary', 'Mary', 'The site admin.')
>>> from zope.publisher.base import TestRequest
>>> request = TestRequest('/')
>>> factory = AuthenticatedPrincipalFactory(info, request)

The factory must be called with a pluggable-authentication object:

>>> class Auth:
...     prefix = 'auth.'
>>> auth = Auth()
>>> principal = factory(auth)

The factory uses the pluggable authentication and the info to create a principal with the same ID, title, and description:

>>> principal.title
>>> principal.description
'The site admin.'

It also fires an AuthenticatedPrincipalCreatedEvent:

>>> from zope.component.eventtesting import getEvents
>>> [event] = getEvents(interfaces.IAuthenticatedPrincipalCreated)
>>> event.principal is principal, event.authentication is auth
(True, True)
>>> event.request is request

Listeners can subscribe to this event to perform additional operations when the authenticated principal is created.

For information on how factories are used in the authentication process, see README.txt.

Base classes

Implemented Interfaces


There are no attributes in this class.


There are no methods in this class.

Known Subclasses

There are no known subclasses.