[Zope3-Users] Authentication howto
Christophe Combelles
ccomb at free.fr
Mon Jun 11 10:28:32 EDT 2007
The first and simple way to add authentication and users via the ZMI is the
following :
- go to the site manager (in the root, or in your folder/site)
- add a Pluggable Authentication Utility (name as you want, prefix empty)
- enter it
- activate "no challenge if auth" and "session credentials" in this order
- add a Principal Folder (name and prefix as you want)
- return back to the PAU, and activate your Principal Folder
- Now, register both the PAU and the Principal Folder
The same thing made automatically from an event subscriber when my site is added
into the ZMI gives the following:
def initial_setup(site):
sm = site.getSiteManager()
# create and register the PAU (Pluggable Auth Utility)
pau = PluggableAuthentication()
sm['authentication'] = pau
sm.registerUtility(pau, IAuthentication)
# and the auth plugin
users = EztranetUsersContainer()
sm['authentication']['EztranetUsers'] = users
sm.registerUtility(users, IAuthenticatorPlugin, name="EztranetUsers")
# activate the auth plugins in the pau
pau.authenticatorPlugins = (users.__name__, ) # a tuple with one element
#activate the wanted credential plugins
pau.credentialsPlugins = ( "No Challenge if Authenticated", "Session
Credentials" )
EztranetUsersContainer() is just a derived PrincipalFolder()
because I wanted to have a custom container with custom users and a custom template.
Christophe
Torvald Bringsvor a écrit :
> Hi
>
> I'm a Zope newbie (kind of), and I've read the von
> Weitershausen book. However I'm having trouble
> following the authentication stuff.
>
> My situation:
> I need a kind of teaspoon HOWTO on how to add
> authentication to the application I'm writing. I want
> show unauthenticated users a simple username/password
> form, using a session to "remember" them.
>
> It seems every example I come across wants to do
> something mega-complicated, giving me the feeling that
> this will be loads of work. Does it need to be?
>
> -Torvald
>
> _______________________________________________
> 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