My problem is pretty complicated. I managed to create a simple python script to connect to the oracle database by the ldap connection but I keep wondering if this is well done, because i can't connect properly. Login, password, LDAP server, basedn works correctly because it works correctly in oracle sql developer app.
import ldap
#from ldap import open
if __name__ == "__main__":
ldap_server="xxxxxxxx.com:389:636"
username = "xxxxxx"
password= "xxxxxxx"
user_dn = "uid="+username+",dc=na,dc=xx,dc=com"
base_dn = "cn=xxxxxxx,dc=na,dc=xx,dc=com"
connect = ldap.open(ldap_server)
search_filter = "uid="+username
try:
connect.bind_s(user_dn,password)
result = connect.search_s(base_dn,ldap.SCOPE_SUBTREE,search_filter)
connect.unbind_s()
print(result)
except ldap.LDAPError:
connect.unbind_s()
print ("authentication error")
Can anyone help me because I'm losing my mind :( ?