LDAP Authentication using plugin

111 views
Skip to first unread message

Dave

unread,
Mar 27, 2023, 11:39:49 AM3/27/23
to py4web
Hello,

I am having some issues trying to use the LDAP plugin for authentication.

I enabled LDAP in the settings, and provided configurations for my LDAP environment. In this case I am using AD.

I am getting the following error when I click the 'LDAP Login" button that now appears on the login page:

```
ERROR:root:Traceback (most recent call last):
File "C:\Users\dave\env1\temp\py4web\py4web\core.py", line 930, in wrapper
ret = func(*func_args, **func_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dave\env1\temp\py4web\py4web\core.py", line 915, in wrapper
raise context["exception"]
File "C:\Users\dave\env1\temp\py4web\py4web\core.py", line 894, in wrapper
context["output"] = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dave\env1\temp\py4web\py4web\utils\auth.py", line 972, in _
return plugin.handle_request(self, path, request.query, request.json)
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'LDAPPlugin' object has no attribute 'handle_request'

127.0.0.1 - "GET /myapp/auth/plugin/ldap/login HTTP/1.1" - 500 541
INFO:Rocket.Requests:127.0.0.1 - "GET /myapp/auth/plugin/ldap/login HTTP/1.1" - 500 541
```
Looking at util/auth_plugins/ldap_plugin.py I see there is no handle_request method.

Any help is appreciated.

Thank you.

Massimo

unread,
Mar 29, 2023, 11:02:58 PM3/29/23
to py4web
ldap and pam and majorly broken because they have not been fully ported from web2py.
I made a change in master that may may things better. Would  be great if you could help me test it.
In a few iterations we may be able to fix it.

Dave

unread,
Mar 30, 2023, 12:47:34 PM3/30/23
to py4web
Hi Massimo,

Thanks for your help!

I grabbed master.

Now when I click the LDAP Login button, it takes me to: /auth/plugin/ldap/login
There are no errors, but I just get a blank screen.

Thanks

Massimo DiPierro

unread,
Mar 30, 2023, 10:38:02 PM3/30/23
to Dave, py4web
well. that's progress. i will take another pass at it

--
You received this message because you are subscribed to the Google Groups "py4web" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/py4web/0e8979a0-3da3-4439-993c-090b53f253ffn%40googlegroups.com.

Massimo

unread,
Apr 9, 2023, 11:00:24 PM4/9/23
to py4web
Hello Dave,

in order to better debug I have created a new plugin:
                          
from py4web.utils.auth_plugins import UsernamePassword
auth.register_plugin(UsernamePassword(test_mode=True))

this plugin is very dumb. If the password is "password" is logins, else it does not. I then fixed the workflow using the plugin.

The LDAP plugin now extends this one so all workflow issues should be fixed. The LDAP plugin is a class with a single function check_credentials(username, password). If there is a problem now, it is in the latter and there is nothing py4web specific in there. 

Please give it one more try and maybe you can help me debug that check_credentials functions.

Massimo
Reply all
Reply to author
Forward
Message has been deleted
0 new messages