[Zope-PAS] Re: New IChallengePlugin interface

Lennart Regebro regebro at nuxeo.com
Mon Oct 4 12:50:46 EDT 2004


Jim Fulton wrote:
> Also, I think that a challenger that doesn't interoperate with
> anything else should have None as it's protocol.  Then the PAS
> can do the book keeping any way it wants.

That makes it slightly more complex, since you need to break out of the 
loop in a None-challenger succeeds. Otherwise other None-challengers 
might be called... And also, how to differentiate between no challenge 
and a None challenge being called? ;)

Hmm...Of course, we could do:

   protocol = None

   for plugin in plugin:
       plug_protocol = getattr(plugin, 'protocol', None)
       if plug_protocol is None:
           plug_protocol == plugin.getId()

       if protocol == '' or protocol == plug_protocol:
           id plugin.challenge(request, response):
               protocol = plug_protocol

   if protocol is None:
       fallback()

That actually covers both protocol = None and no protocol attribute at 
all, both meaning that the plugin will run by itself. Not very 
complicated either.

Does that work?


More information about the Zope-PAS mailing list