Reputation: 159
I am using Online LDAP Test Server(https://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/)
I am trying to connect to it using python ldap3 module.
This is my code:
import ldap3
user = 'riemann'
password = 'password'
server = ldap3.Server('ldap.forumsys.com', port=389)
connection = ldap3.Connection(server, user=user, password=password)
connection.bind()
conn = connection.search(search_base='ou=mathematicians,dc=example,dc=com', search_filter='(&(objectClass=user)(userPrincipalName='+user+'))', attributes='*')
print conn
When I check the conn it is False.
Can someone help me in getting the connection Thanks in advance
Upvotes: 0
Views: 5752
Reputation: 122
if you change user='riemann'
to user='uid=riemann,dc=example,dc=com'
you'll get a connection
for more information check the docs: http://ldap3.readthedocs.io/bind.html#simple-bind
Upvotes: 1