PluggableAuth / grok-1.7

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

PluggableAuth / grok-1.7

Andreas Knote
Hello,

I'm trying to set up PAU using grok-1.7 and the corresponding ZTK libraries (zope.pluggableauth, zope.authentication, zope.security ..).

I used merlot's auth.py (https://code.google.com/p/merlot/source/browse/merlot/auth.py) as a starting point / guide and tried to port it to the new libraries.

I've managed to get it to compile & run, but I still can't log in. I found out that my UserAuthenticationPlugin is called at least two times on each request to a restricted page and the right Principal is returned on the first but not on the subsequent calls (seems like it loses the credentials in between).

Result: No Login possible.

I attached pdb output below (Excerpts from Login-Form request trying to login as 'joe' / 'joe' )

My auth.py:

http://pastebin.com/QxwWEtws

and app.py:

http://pastebin.com/3w9n12Ld

I would be happy if you could help me.

Andreas


/Users/andreasknote/Sandboxes/dev_from_above/unidoc/src/unidoc/auth.py(80)getAccount()
-> user_folder = grok.getSite()['users'] if 'users' in grok.getSite() else ''
(Pdb) n
> /Users/andreasknote/Sandboxes/dev_from_above/unidoc/src/unidoc/auth.py(81)getAccount()
-> return username in user_folder and user_folder[username] or None
(Pdb)

....

(Pdb) n
--Return--
> /Users/andreasknote/Sandboxes/dev_from_above/unidoc/src/unidoc/auth.py(68)authenticateCredentials()-><unidoc....02773c50>
-> description = account.real_name)
(Pdb) n
> /Users/andreasknote/.buildout/eggs/zope.pluggableauth-1.3-py2.7.egg/zope/pluggableauth/authentication.py(64)authenticate()
-> if info is None:
(Pdb) p info
<unidoc.auth.PrincipalInfo object at 0x102773c50>
(Pdb) n

### This is the Right principal

-> return principal
(Pdb) n
--Return--
> /Users/andreasknote/.buildout/eggs/zope.pluggableauth-1.3-py2.7.egg/zope/pluggableauth/authentication.py(71)authenticate()->Principal('joe')
-> return principal
(Pdb) p principal
Principal('joe')
(Pdb) n
> /Users/andreasknote/.buildout/eggs/zope.app.publication-3.13.1-py2.7.egg/zope/app/publication/zopepublication.py(125)_maybePlacefullyAuthenticate()
-> if principal is None:
(Pdb) n
> /Users/andreasknote/.buildout/eggs/zope.app.publication-3.13.1-py2.7.egg/zope/app/publication/zopepublication.py(131)_maybePlacefullyAuthenticate()
-> request.setPrincipal(principal)
(Pdb) n
--Return--
> /Users/andreasknote/.buildout/eggs/zope.app.publication-3.13.1-py2.7.egg/zope/app/publication/zopepublication.py(131)_maybePlacefullyAuthenticate()->None
....
> /Users/andreasknote/.buildout/eggs/zope.app.publication-3.13.1-py2.7.egg/zope/app/publication/zopepublication.py(137)callTraversalHooks()->None
-> self._maybePlacefullyAuthenticate(request, ob)
(Pdb) n
> /Users/andreasknote/.buildout/eggs/zope.publisher-3.12.6-py2.7.egg/zope/publisher/base.py(251)traverse()
-> if not traversal_stack:
(Pdb) continue
127.0.0.1 - - [20/Jun/2011:11:41:29 +0200] "POST /unidoc/%40%40login HTTP/1.1" 303 0 "http://localhost:8080/unidoc/@@login?camefrom=http%3A%2F%2Flocalhost%3A8080%2Funidoc%2Fusers%2F%40%40index" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30"
> /Users/andreasknote/Sandboxes/dev_from_above/unidoc/src/unidoc/auth.py(80)getAccount()
-> user_folder = grok.getSite()['users'] if 'users' in grok.getSite() else ''
(Pdb) n
> /Users/andreasknote/Sandboxes/dev_from_above/unidoc/src/unidoc/auth.py(81)getAccount()
-> return username in user_folder and user_folder[username] or None
(Pdb) n
--Return--


### Here it returns none

> /Users/andreasknote/Sandboxes/dev_from_above/unidoc/src/unidoc/auth.py(81)getAccount()->None
-> return username in user_folder and user_folder[username] or None
(Pdb)



_______________________________________________
Grok-dev mailing list
[hidden email]
https://mail.zope.org/mailman/listinfo/grok-dev