1. Pedro Diaz Donoso
  2. PowerBuilder
  3. Wednesday, 2 October 2024 12:21 PM UTC

 

Hi,
I can't connect with oleobject to active directory SSL.
With a non SSL conection works fine. But now we need SSL

My code:
adoCommand    = Create OLEObject
adoConnection = Create OLEObject
adoRootDSE    = Create OLEObject

// Setup ADO objects
li_rc = adoCommand.ConnectToNewObject("ADODB.Command")
If f_Ldap_ConnectError(li_rc, "ADODB.Command") Then Return FALSE

li_rc = adoConnection.ConnectToNewObject("ADODB.Connection")
If f_Ldap_ConnectError(li_rc, "ADODB.Connection") Then Return FALSE

adoConnection.Provider = "ADsDSOObject"

//Conexión con autentificación de usuario
adoConnection.Properties("User ID", ls_user)
adoConnection.Properties("Password", ls_pass)

adoConnection.Open("Active Directory Provider")
adoCommand.ActiveConnection = adoConnection

///Consulta para comprobar si el usuario con el que se ha realizado la conexión es válido.
ls_Query = "SELECT sAMAccountName "
ls_Query +=  "FROM 'LDAP://" + ls_DNSDomain + "' "
ls_Query +=  "WHERE objectClass='user' and objectCategory='person' and samaccountname='"+ ls_red +"'"

try 
	// Run the query
	adoCommand.CommandText = ls_Query
	adoRecordset = adoCommand.Execute
	If NOT adoRecordset.EOF Then ls_Value = String(adoRecordset.Fields("sAMAccountName").Value)
	If upper(ls_value) = upper(ls_red) then lb_valido = TRUE
	// Close the connection
	adoRecordset.Close
catch ( oleruntimeerror orte )
	//No tiene permisos
	MessageBox("OLERuntimeError", orte.Text)
end try


I allways catch an error:
Se requiere un método de autenticación más seguro para este servidor.
Or if I use FROM 'LDAPS://" 
I get the message "La tabla no existe"

 

Thank you

Who is viewing this page
Accepted Answer
Pedro Diaz Donoso Accepted Answer Pending Moderation
  1. Wednesday, 2 October 2024 14:48 PM UTC
  2. PowerBuilder
  3. # Permalink

Finally I have solved the problem with this parametr:

adoConnection.Properties("Encrypt Password", TRUE)

Comment
  1. Armeen Mazda @Appeon
  2. Thursday, 3 October 2024 14:42 PM UTC
Thanks for sharing the solution!
  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.