I am trying to connect to LDAP server for authentication. Our LDAP server use SSL but we don't use any SSL certificate.
Following is my code:
I have two url provided by system admin. There are as follows:
url1 = "ldap://100.x.x.x:389"
url2 = "ldaps://10.x.x.x:636"
My first questionis which url I should use ? what is difference between ldap:// and ldaps://
LDAP authentication code is as follows, I have tried to use both(url1 and url2):
conn = ldap.initialize(url)
ldap.TLS_AVAIL
1
conn.simple_bind_s(
'CN={0},ou=users,DC=compnay,DC=com'.format(myemail),
mypassword
)
conn.simple_bind(
'CN={0},ou=users,DC=compnay,DC=com'.format(myemail),
mypassword
)
if i used first url (url1) with simple_bind_s, then following is error:
INVALID_CREDENTIALS: {'info': u'80090308: LdapErr: DSID-0C0903D9, comment: AcceptSecurityContext error, data 52e, v2580', 'desc': u'Invalid credentials'}
but when I use with simple_bind, it gives me int even though password or username is wrong.
What is difference between simple_bind_s and simple_bind. How can I use simple_bind for authentication?