Configuring LDAP authentication on turbogears2

45 views
Skip to first unread message

frankentux

unread,
Aug 13, 2009, 11:36:13 AM8/13/09
to TurboGears
Does anyone know of a full working example of how to configure
turbogears2 to use LDAP to authenticate users?
What I would like to do is to use an existing LDAP server for pure
authentication and then to link the authenticated username against my
model.User. That way, the users uname and password are centrally
managed (the LDAP server is used for authentication for many services)
but I could add application specific meta information to the user
object as soon as the user logs in.

I've gotten as far as trying to edit the app_cfg.py file using the
information from:

http://code.gustavonarea.net/repoze.who.plugins.ldap/Using.html
http://www.mail-archive.com/turbo...@googlegroups.com/msg39644.html

but I can't get it working. Currently, I'm getting something like:
ValueError: ldap_auth: An object has failed to implement interface
<InterfaceClass repoze.who.interfaces.IChallenger>
The challenge attribute was not provided.

What would be really helpful in the documentation is an example of how
to configure the app_cfg.py file for LDAP authentication using the
repoze.who.plugins.ldap plugin.

frankentux

unread,
Aug 13, 2009, 4:35:04 PM8/13/09
to TurboGears
On 13 Aug., 17:36, frankentux <cfarrell1...@googlemail.com> wrote:
> Does anyone know of a full working example of how to configure
> turbogears2 to use LDAP to authenticate users?
> What I would like to do is to use an existing LDAP server for pure
> authentication and then to link the authenticated username against my
> model.User. That way, the users uname and password are centrally
> managed (the LDAP server is used for authentication for many services)
> but I could add application specific meta information to the user
> object as soon as the user logs in.
>
> I've gotten as far as trying to edit the app_cfg.py file using the
> information from:
>
> http://code.gustavonarea.net/repoze.who.plugins.ldap/Using.htmlhttp://www.mail-archive.com/turbo...@googlegroups.com/msg39644.html
>
> but I can't get it working. Currently, I'm getting something like:
> ValueError: ldap_auth: An object has failed to implement interface
> <InterfaceClass repoze.who.interfaces.IChallenger>
>         The challenge attribute was not provided.
>
> What would be really helpful in the documentation is an example of how
> to configure the app_cfg.py file for LDAP authentication using the
> repoze.who.plugins.ldap  plugin.

I didn't see that repoze.who.plugins.ldap already carries a full
working tg2 example in the demo subdirectory. Silly me.
On the other hand, I'm now having trouble getting my project based on
the demo working. Now get this error:
UndefinedError: <Request at 0x1f6f0d0 GET http://localhost:8080/> has
no member named "identity"

The files are exactly as they are in the repoze.who.plugins.ldap demo
project (except for changing the values in the who.ini file of
course).
Any idea of what may be causing this?

frankentux

unread,
Aug 13, 2009, 4:37:10 PM8/13/09
to TurboGears
On 13 Aug., 22:35, frankentux <cfarrell1...@googlemail.com> wrote:
> On 13 Aug., 17:36, frankentux <cfarrell1...@googlemail.com> wrote:
>
>
>
> > Does anyone know of a full working example of how to configure
> > turbogears2 to use LDAP to authenticate users?
> > What I would like to do is to use an existing LDAP server for pure
> > authentication and then to link the authenticated username against my
> > model.User. That way, the users uname and password are centrally
> > managed (the LDAP server is used for authentication for many services)
> > but I could add application specific meta information to the user
> > object as soon as the user logs in.
>
> > I've gotten as far as trying to edit the app_cfg.py file using the
> > information from:
>
> >http://code.gustavonarea.net/repoze.who.plugins.ldap/Using.htmlhttp:/...
>
> > but I can't get it working. Currently, I'm getting something like:
> > ValueError: ldap_auth: An object has failed to implement interface
> > <InterfaceClass repoze.who.interfaces.IChallenger>
> >         The challenge attribute was not provided.
>
> > What would be really helpful in the documentation is an example of how
> > to configure the app_cfg.py file for LDAP authentication using the
> > repoze.who.plugins.ldap  plugin.
>
> I didn't see that repoze.who.plugins.ldap already carries a full
> working tg2 example in the demo subdirectory. Silly me.
> On the other hand, I'm now having trouble getting my project based on
> the demo working. Now get this error:
> UndefinedError: <Request at 0x1f6f0d0 GEThttp://localhost:8080/> has
> no member named "identity"
>
> The files are exactly as they are in the repoze.who.plugins.ldap demo
> project (except for changing the values in the who.ini file of
> course).
> Any idea of what may be causing this?

Here is the log output. I doubt it will help though:

serving on http://127.0.0.1:8080
2009-08-13 22:36:00,723 -- repoze.who request started (/) --
2009-08-13 22:36:00,723 request classification: browser
2009-08-13 22:36:00,724 identifier plugins registered [<FormPlugin
32781904>, <AuthTktCookiePlugin 32781776>]
2009-08-13 22:36:00,724 identifier plugins matched for classification
"browser": [<FormPlugin 32781904>, <AuthTktCookiePlugin 32781776>]
2009-08-13 22:36:00,724 no identity returned from <FormPlugin
32781904> (None)
2009-08-13 22:36:00,724 no identity returned from <AuthTktCookiePlugin
32781776> (None)
2009-08-13 22:36:00,725 identities found: []
2009-08-13 22:36:00,725 no identities found, not authenticating
22:36:00,734 INFO [tg.i18n] Language ['de-de', 'de', 'en-us', 'en']:
not supported
22:36:00,736 INFO [tg.i18n] Set request language for FormEncode to
['de-de', 'de', 'en-us', 'en']
22:36:00,737 INFO [tg.i18n] Language ['de-de', 'de', 'en-us', 'en']:
not supported
22:36:00,738 INFO [tg.i18n] Set request language for FormEncode to
['de-de', 'de', 'en-us', 'en']
Debug at: http://localhost:8080/_debug/view/1250195760
2009-08-13 22:36:01,351 no challenge required
2009-08-13 22:36:01,351 -- repoze.who request ended (/) --
2009-08-13 22:36:01,639 -- repoze.who request started (/_debug/media/
pylons/img/pylons-tower120.png) --
2009-08-13 22:36:01,639 request classification: browser
2009-08-13 22:36:01,639 identifier plugins registered [<FormPlugin
32781904>, <AuthTktCookiePlugin 32781776>]
2009-08-13 22:36:01,639 identifier plugins matched for classification
"browser": [<FormPlugin 32781904>, <AuthTktCookiePlugin 32781776>]
2009-08-13 22:36:01,639 no identity returned from <FormPlugin
32781904> (None)
2009-08-13 22:36:01,639 no identity returned from <AuthTktCookiePlugin
32781776> (None)
2009-08-13 22:36:01,640 identities found: []
2009-08-13 22:36:01,640 no identities found, not authenticating
22:36:01,642 INFO [tg.i18n] Language ['de-de', 'de', 'en-us', 'en']:
not supported
22:36:01,642 INFO [tg.i18n] Set request language for FormEncode to
['de-de', 'de', 'en-us', 'en']
22:36:01,643 INFO [tg.i18n] Language ['de-de', 'de', 'en-us', 'en']:
not supported
22:36:01,644 INFO [tg.i18n] Set request language for FormEncode to
['de-de', 'de', 'en-us', 'en']
Debug at: http://localhost:8080/_debug/media/pylons/img/pylons-tower120.png/_debug/view/1250195761
2009-08-13 22:36:02,033 no challenge required
2009-08-13 22:36:02,033 -- repoze.who request ended (/_debug/media/
pylons/img/pylons-tower120.png) --
Reply all
Reply to author
Forward
0 new messages