Hi,

do you really use Azure AD? Otherwise, for normal on-premise AD, see the
documentation on
http://web2py.com/books/default/chapter/29/09/access-control#LDAP and
https://github.com/web2py/web2py/blob/master/gluon/contrib/login_methods/ldap_auth.py

Nico


Il giorno mer 2 mar 2022 alle ore 16:48 [email protected] <
[email protected]> ha scritto:

> We're looking into adding AD authentication to our app. We have an active
> directory account and an app registered on it.
>
> In the documentation I found this example of enabling AD auth:
>
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
> auth.settings.login_methods.append(
>   ldap_auth(
>    mode='ad',
>    server='https://aad.portal.azure.com/',
>    base_dn='ou=Users,dc=domain,dc=com'
>   )
> )
>
> However I get this error when trying to login
>
> DEBUG:web2py.auth.ldap_auth:Traceback (most recent call last):
>   File
> "C:\urban\web2py_latest\web2py\gluon\contrib\login_methods\ldap_auth.py",
> line 236, in ldap_auth_aux
>     con = init_ldap()
>   File
> "C:\urban\web2py_latest\web2py\gluon\contrib\login_methods\ldap_auth.py",
> line 630, in init_ldap
>     "ldap://"; + ldap_server + ":" + str(ldap_port))
>   File "C:\Python27\lib\site-packages\ldap\functions.py", line 92, in
> initialize
>     uri, trace_level, trace_file, trace_stack_limit, bytes_mode, **kwargs)
>   File "C:\Python27\lib\site-packages\ldap\ldapobject.py", line 106, in
> __init__
>     self._l =
> ldap.functions._ldap_function_call(ldap._ldap_module_lock,_ldap.initialize,uri)
>   File "C:\Python27\lib\site-packages\ldap\functions.py", line 55, in
> _ldap_function_call
>     result = func(*args,**kwargs)
> LDAPError: (0, 'Error')
>
> Am I doing anything wrong on the web2py side or is the issue in the AD
> configuration?
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/7d013980-154b-4b94-9365-4a64f9e32423n%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/7d013980-154b-4b94-9365-4a64f9e32423n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAAE8D_CCFLo69%3DQirQNPrTZxnymTjDP6Pg1u2y0cBzipvJUZrw%40mail.gmail.com.

Reply via email to