Page 3 of 3

Re: FW user login to authenticate from windows active directory

Posted: Thu Jun 24, 2021 2:27 pm
by Antonio Linares
Is this code what we are looking for ?

https://wightideas.org/2014/06/25/excel-ldap-authentication/

We could easily adapt it to Harbour and FWH

Re: FW user login to authenticate from windows active directory

Posted: Tue Jun 29, 2021 12:17 pm
by Antonio Linares
This code from Charly, Felix and others is what we were looking for:

Code: Select all | Expand

FUNCTION ConectaLDAP()
LOCAL lOk    := FALSE

TRY
// Creamos el objeto ADO de conexión
    oConexion:= TOleAuto():new( "ADODB.Connection" )
    oConexion:Provider:= 'ADsDSOObject'
    oProperties := oConexion:Properties( 'User ID' )
    oProperties:value := 'Your User'
   
    oProperties := oConexion:Properties( 'Password' )
    oProperties:value := 'Your Password'
    oProperties := oConexion:Properties( 'Encrypt Password' )
    oProperties:value := TRUE
// Abrimos la conexión 
    oConexion:Open( "Active Directory Provider" )
   lOk := TRUE
   
CATCH oError
    AdoError( oError, lMessage )
    //xBrowse( oError )
END

RETURN lOk