[Zope3-Users] Pluggable authentication, a newbie's question

Alexei Ustyuzhaninov alust at 208.195-224-87.telenet.ru
Mon Jan 29 07:06:43 EST 2007


Hi, David!
Thank you for the help.

David Johnson пишет:
> I'll try.  Your authenticator is registered as a Plugin in a PAU in your 
> current site?  I'm not sure the cause without more details, but when I 
> see this happen I've usually neglected one of the following:

What do you mean by "Your authenticator is registered as a Plugin in a 
PAU in your current site"? I registered the authenticator as a utility 
and assigned the utility name to the authenticatorPlugins attribute of 
the PAU. Is it enough?

> 1. The credentials plugin is not selected and added.
> 2. The authenticator plugin is not selected and added.

I think the plugins were selected and added as well as the PAU. I could 
access them with the queryUtility method later.

> 3. No permissions have been granted to the user, so even though the user 
> is valid, they don't have permissions to do anything and so another 
> authentication is being called as a backup.  This is easy enough to 
> debug by putting print statements at strategic points in your plugin and 
> see if and when they show up in the Zope log.

Yes, I do debugging the same way. And the print statement at the first 
line of the authenticator printed nothing. So I think the authenticator 
wasn't called at all.

> The PAU stuff has changed a lot over the history of Zope 3, so I've also 
> found it to happen when using outdated methods such as the ones in 
> Phillips first edition (which have since been updated to reflect the 
> latest methods - thanks Phillip).
> 
> -- 
> David
> 
> 
> On Jan 28, 2007, at 5:44 PM, Alexei Ustyuzhaninov wrote:
> 
>>
>> Hello,
>>
>> I try to create a plugin, which could authenticate users against an
>> external database. Here is the code:
>>
>> from zope.component import provideUtility
>> from zope.app.authentication import PluggableAuthentication
>> from zope.app.authentication.interfaces import\
>>    ICredentialsPlugin, IAuthenticatorPlugin
>> from zope.app.authentication.session import SessionCredentialsPlugin
>> from zope.app.security.interfaces import IAuthentication
>> from mypackage.Authentication import MyAuthenticatorPlugin
>>
>> provideUtility(SessionCredentialsPlugin(), ICredentialsPlugin,\
>>    'My Credentials Plugin')
>> provideUtility(MyAuthenticatorPlugin(), IAuthenticatorPlugin,
>>    'My Authenticator Plugin')
>> pau=PluggableAuthentication('my_')
>> pau.credentialsPlugins=('Cascade Credentials Plugin', )
>> pau.authenticatorPlugins=('Cascade Authenticator Plugin', )
>> provideUtility(pau, IAuthentication, 'My Pluggable-Authentication 
>> Utility'
>>
>> This code is contained in the file mypackage/__init__.py, mypackage in
>> turn is loaded via ZCML. Both plugins and PAU are registered
>> successfully and I can access them with queryUtility. But the
>> authentication is carried through the standard mechanism and
>> MyAuthenticatorPlugin isn't even called.
>>
>> Could any good soul help me with this case?
>>
>> --Thanks,
>> Alexei
>>
>> _______________________________________________
>> Zope3-users mailing list
>> Zope3-users at zope.org
>> http://mail.zope.org/mailman/listinfo/zope3-users
>>
> 



More information about the Zope3-users mailing list