[Checkins]
SVN: zope.app.authentication/trunk/src/zope/app/authentication/README.txt
restified
Christian Zagrodnick
cz at gocept.com
Mon Jun 25 10:07:05 EDT 2007
Log message for revision 77041:
restified
Changed:
U zope.app.authentication/trunk/src/zope/app/authentication/README.txt
-=-
Modified: zope.app.authentication/trunk/src/zope/app/authentication/README.txt
===================================================================
--- zope.app.authentication/trunk/src/zope/app/authentication/README.txt 2007-06-25 14:02:09 UTC (rev 77040)
+++ zope.app.authentication/trunk/src/zope/app/authentication/README.txt 2007-06-25 14:07:04 UTC (rev 77041)
@@ -610,7 +610,7 @@
will be used.
Let's look at an example. We'll define a new plugin that specifies an
-'X-Challenge' protocol:
+'X-Challenge' protocol::
>>> class XChallengeCredentialsPlugin(FormCredentialsPlugin):
...
@@ -627,7 +627,7 @@
... request.response.setHeader('X-Challenge', value)
... return True
-and register a couple instances as utilities:
+and register a couple instances as utilities::
>>> provideUtility(XChallengeCredentialsPlugin('basic'),
... name='Basic X-Challenge Plugin')
@@ -635,19 +635,19 @@
>>> provideUtility(XChallengeCredentialsPlugin('advanced'),
... name='Advanced X-Challenge Plugin')
-When we use both plugins with the PAU:
+When we use both plugins with the PAU::
>>> pau.credentialsPlugins = (
... 'Basic X-Challenge Plugin',
... 'Advanced X-Challenge Plugin')
-and call 'unauthorized':
+and call 'unauthorized'::
>>> request = TestRequest()
>>> pau.unauthorized(None, request)
we see that both plugins participate in the challange, rather than just the
-first plugin:
+first plugin::
>>> request.response.getHeader('X-Challenge')
'advanced basic'
@@ -661,13 +661,13 @@
unique ids within a PAU. If there are multiple pluggable-authentication
utilities in a system, it's a good idea to give each PAU a unique prefix, so
that principal ids from different PAUs don't conflict. We can provide a prefix
-when a PAU is created:
+when a PAU is created::
>>> pau = authentication.PluggableAuthentication('mypau_')
>>> pau.credentialsPlugins = ('My Credentials Plugin', )
>>> pau.authenticatorPlugins = ('My Authenticator Plugin', )
-When we create a request and try to authenticate:
+When we create a request and try to authenticate::
>>> pau.authenticate(TestRequest(credentials='secretcode'))
Principal('mypau_bob')
@@ -675,7 +675,7 @@
Note that now, our principal's id has the pluggable-authentication
utility prefix.
-We can still lookup a principal, as long as we supply the prefix:
+We can still lookup a principal, as long as we supply the prefix::
>> pau.getPrincipal('mypas_42')
Principal('mypas_42', "{'domain': 42}")
@@ -687,7 +687,7 @@
Searching
=========
-PAU implements ISourceQueriables:
+PAU implements ISourceQueriables::
>>> from zope.schema.interfaces import ISourceQueriables
>>> ISourceQueriables.providedBy(pau)
@@ -701,19 +701,19 @@
IQuerySchemaSearch to indicate they can be used in the PAU's principal search
scheme.
-Currently, our list of authenticators:
+Currently, our list of authenticators::
>>> pau.authenticatorPlugins
('My Authenticator Plugin',)
does not include a queriable authenticator. PAU cannot therefore provide any
-queriables:
+queriables::
>>> list(pau.getQueriables())
[]
Before we illustrate how an authenticator is used by the PAU to search for
-principals, we need to setup an adapter used by PAU:
+principals, we need to setup an adapter used by PAU::
>>> provideAdapter(
... authentication.authentication.QuerySchemaSearchAdapter,
@@ -722,7 +722,7 @@
This adapter delegates search responsibility to an authenticator, but prepends
the PAU prefix to any principal IDs returned in a search.
-Next, we'll create a plugin that provides a search interface:
+Next, we'll create a plugin that provides a search interface::
>>> class QueriableAuthenticatorPlugin(MyAuthenticatorPlugin):
...
@@ -734,7 +734,7 @@
... yield 'foo'
...
-and install it as a plugin:
+and install it as a plugin::
>>> plugin = QueriableAuthenticatorPlugin()
>>> provideUtility(plugin,
@@ -742,7 +742,7 @@
... name='Queriable')
>>> pau.authenticatorPlugins += ('Queriable',)
-Now, the PAU provides a single queriable:
+Now, the PAU provides a single queriable::
>>> list(pau.getQueriables()) # doctest: +ELLIPSIS
[('Queriable', ...QuerySchemaSearchAdapter object...)]
@@ -754,7 +754,7 @@
['mypau_foo']
Note that the resulting principal ID includes the PAU prefix. Were we to search
-the plugin directly:
+the plugin directly::
>>> list(plugin.search('not-used'))
['foo']
More information about the Checkins
mailing list