Answered by:
is it possible to implement LDAP using Visual Foxpro?

Question
-
Is it possible to implement LDAP using Visual Foxpro 8.0?
How? Can anyone provide sample Code to autheticate the user using LDAP in Visual Foxpro 8.0?
Thursday, January 5, 2006 10:49 AM
Answers
-
Hi chicks_in
It's certainly possible to authenticate a user with the LDAP provider's OpenDSObject method, but not recommended [1]
cDomain = "mydomain"
* Name of user to validate
* cUser = "firstname lastname"
* any OUs required to access user object
cOUString = "OU=Users,OU=Department"
* required DC string - replace .co.uk with .com or .wvr
cDCString = "DC=" + cDomain + ",DC=co,DC=uk"
* The path returned must be valid - able to create a user using
* VFP's GetObject() function - in order to work with OpenDSPath()
cPath = "LDAP://" + cDomain + "/CN=" + cUser + "," ; + cOUString + "," + cDCString
* These credentials are used to authenticate to the AD
cUserName = "adminperson"
cPassword = inputbox("Password please")
oLDAP = getobject("LDAP:")
oUser = oLDAP.OpenDSObject(cPath, addbs(cDomain) + ;
cUserName, cPassword, 0)
? oUser.Name
[1] http://msdn.microsoft.com/library/en-us/adsi/adsi/iadsopendsobject_opendsobject.aspThursday, January 5, 2006 1:52 PM
All replies
-
Hi chicks_in
It's certainly possible to authenticate a user with the LDAP provider's OpenDSObject method, but not recommended [1]
cDomain = "mydomain"
* Name of user to validate
* cUser = "firstname lastname"
* any OUs required to access user object
cOUString = "OU=Users,OU=Department"
* required DC string - replace .co.uk with .com or .wvr
cDCString = "DC=" + cDomain + ",DC=co,DC=uk"
* The path returned must be valid - able to create a user using
* VFP's GetObject() function - in order to work with OpenDSPath()
cPath = "LDAP://" + cDomain + "/CN=" + cUser + "," ; + cOUString + "," + cDCString
* These credentials are used to authenticate to the AD
cUserName = "adminperson"
cPassword = inputbox("Password please")
oLDAP = getobject("LDAP:")
oUser = oLDAP.OpenDSObject(cPath, addbs(cDomain) + ;
cUserName, cPassword, 0)
? oUser.Name
[1] http://msdn.microsoft.com/library/en-us/adsi/adsi/iadsopendsobject_opendsobject.aspThursday, January 5, 2006 1:52 PM -
If all you want to do is let your users into the application based upon their login credentials; then what I do is pick the user name out of the sys(0) information and then check that against a user table in my application. This works for us inhouse. Obviously it doesn't implement LDAP but it might do what you want.Monday, February 6, 2006 10:42 AM
-
Is it possible to use 'REAL' LDAP instead of the IADsOpenDSObject and the 'LDAP Provider' ?
I need to verify a username and password through an application and it may not necessarily be the logged in user. All I want to do is a simple LDAP bind to verify the user and password, and I can't for the life of me find an already documented way to do it in VFP.
I did it in the 90s with C on Win9x and Netware. I did it a couple years ago with PHP on Linux and AD. I can do it right now with ldapsearch on Linux and AD. But it seems VFP on Win to a Windows Server is just not very popular at all.
Is there a free .Net library I can use? I can't seem to locate a library I can easily integrate into VFP. Otherwise I'm stuck distributing cygwin to all the desktops so I can use *nix command line tools. :/
Sorry - I'm not a programmer, I just make stuff workFriday, April 20, 2007 9:18 PM -
Yes, it is definitely possible to implement via Windows LDAP API calls.
Anatoliy Mogylevets
Thursday, June 26, 2014 9:37 PM