[Zope-PAS] Re: New IChallengePlugin interface
Jim Fulton
jim at zope.com
Mon Oct 4 13:09:38 EDT 2004
Lennart Regebro wrote:
> 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.
You don't have to.
The PAS knows that if the challenger doesn't have a protocol,
then it can't interoperate with anythng else. The simplest thing,
if such a challenger fires is to break out of the loop, but other
implementations are possible.
> Otherwise other None-challengers
> might be called... And also, how to differentiate between no challenge
> and a None challenge being called? ;)
You know that a challenger doesn't belong to a protocol
if it's protocol is None. You can tell of a plugin fired by
whether it returns True.
> 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()
Or even:
plug_protocol = plugin
> if protocol == '' or protocol == plug_protocol:
^^^^^ is None
> if plugin.challenge(request, response):
> protocol = plug_protocol
>
> if protocol is None:
> fallback()
Right. That's one possibility.
> 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?
Works for me.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope-PAS
mailing list