How can I read the user name and password from Active Directory? in other
words how can I authenticate a user through Active Directory?

Thanks

HME

Re: Active Directory User name and Password by Dave

Dave
Sun Mar 25 14:30:36 CDT 2007

Sys(0) will return the machine name and user name. I doubt anything
will return the password.

Dave tiffany

HME wrote:
> How can I read the user name and password from Active Directory? in other
> words how can I authenticate a user through Active Directory?
>
> Thanks
>
> HME
>
>

Re: Active Directory User name and Password by Brian

Brian
Sun Mar 25 15:38:06 CDT 2007

I did this a long time ago and have forgotten most of the detail, but this
may get you headed in the correct direction.

To get an array of users from AD...

oADSobj = GETOBJECT("WinNT://" + ALLTRIM(_SCREEN.oApp.cADServer))
IF TYPE("oADSobj") <> "O"
WAIT WINDOW "Problem connecting to AD server: WinNT://" +
ALLTRIM(_SCREEN.oApp.cADServer) + ". Press any key..."
This.lUseAD = .f.
ELSE
FOR EACH Child IN oADSobj
IF Child.Class = "Group"
IF _SCREEN.oApp.aADAllGroups(1) <> "<None>"
DIMENSION _SCREEN.oApp.aADAllGroups(ALEN(_SCREEN.oApp.aADAllGroups) + 1)
ENDIF
_SCREEN.oApp.aADAllGroups(ALEN(_SCREEN.oApp.aADAllGroups)) =
UPPER(Child.Name)
ENDIF
IF Child.Class = "User" AND NOT Child.AccountDisabled
IF _SCREEN.oApp.aADAllUsers(1) <> "<None>"
DIMENSION _SCREEN.oApp.aADAllUsers(ALEN(_SCREEN.oApp.aADAllUsers) + 1)
ENDIF
_SCREEN.oApp.aADAllUsers(ALEN(_SCREEN.oApp.aADAllUsers)) =
UPPER(Child.Name)
ENDIF
ENDFOR
RELEASE oADSobj

= ASORT(_SCREEN.oApp.aADAllGroups)
= ASORT(_SCREEN.oApp.aADAllUsers)
ENDIF


Get the username and password from the user. Once you have checked the
username is in the array created above, check the password like this...


dlcServerName = _SCREEN.oApp.cADServer
dlcUserName = dlcServerName + "\" + ALLTRIM(THISFORM.txtid.VALUE)
dlcPassword = ALLTRIM(THISFORM.txtpassword.VALUE)

dlcDCStr = STRTRAN(_SCREEN.oApp.cADServer, ".", ",dc=")
dlcADsPath = "LDAP://" + _SCREEN.oApp.cADServer + "/cn=users,dc=" +
dlcDCStr
oADsNamespace = GetObject("LDAP:")
dlcOnError = ON("ERROR")
ON ERROR *
oDS = oADsNamespace.OpenDSObject(dlcADsPath, dlcUserName, dlcPassword, 1)
ON ERROR &dlcOnError

IF TYPE("oDS") = "O"
dllPAsswordOK = .t.
ELSE
dllPasswordOK = .f.
ENDIF

Regards,

Brian


"HME" <helassaad@comcast.net> wrote in message
news:TYCdnbHsiOhinJvbnZ2dnUVZ_tWhnZ2d@comcast.com...
> How can I read the user name and password from Active Directory? in other
> words how can I authenticate a user through Active Directory?
>
> Thanks
>
> HME
>



Re: Active Directory User name and Password by Rolf

Rolf
Sun Mar 25 18:30:47 CDT 2007


Lparameters m.UserName , m.Password

Local m.adspath, m.domene,m.con,m.com,m.rs,m.RootDSE,m.dom,m.retval
m.retval = .F.
m.adspath = ""
Try
m.RootDSE = Getobject("LDAP://RootDSE")
If Type("rootDSE")="O" And Not Isnull(m.RootDSE)
m.dom = Getobject("LDAP://" + RootDSE.Get("defaultNamingContext"))
m.domene = dom.Get("distinguishedName")
m.con = Createobject("ADODB.Connection")
m.com = Createobject("ADODB.Command")
m.con.Provider = "ADsDSOObject"
m.con.Open( "Active Directory Provider" )
m.com.ActiveConnection = m.con
m.com.CommandText = "select SamaccountName,AdsPath from 'LDAP://" + m.domene
+ "' WHERE objectCategory='Person' AND objectClass = 'user'"
m.rs = m.com.Execute
If m.rs.recordcount > 0
Do While Not m.rs.Eof
If Upper(m.rs.Fields("samAccountName").Value) == Upper( m.UserName )
m.adspath = m.rs.Fields("AdsPath").Value
Exit
Endif
m.rs.movenext
Enddo
Endif
If Not Empty( m.adspath )
Local m.ns,m.oS
m.ns = Getobject("LDAP:")
Try
m.oS = m.ns.OpenDSObject( m.adspath , m.domene + "\" + m.UserName ,
m.Password , 1 )
m.retval = .T.
m.oS = Null
Catch
m.retval = .F.
Endtry
Endif
Endif
Catch
m.retval = .f.
Endtry
Return m.retval



Re: Active Directory User name and Password by HME

HME
Sun Mar 25 20:47:34 CDT 2007

Thank you guys, I'll give it a try. Also thank you Brian, I sent you an
email, but the email I had for you was from 2005. Didn't think you'd see
the message. lol
thanks again.

HME



"HME" <helassaad@comcast.net> wrote in message
news:TYCdnbHsiOhinJvbnZ2dnUVZ_tWhnZ2d@comcast.com...
> How can I read the user name and password from Active Directory? in other
> words how can I authenticate a user through Active Directory?
>
> Thanks
>
> HME
>



Re: Active Directory User name and Password by Cindy

Cindy
Mon Mar 26 13:51:13 CDT 2007

Hi HME,

Others have given you code to get user names.

Is your data on an AD server which is part of a domain? If so then doesn't
the domain authentication cover access to the directory where the data is?
I'm new to Active Directory so I may be missing something. (We've recently
moved away from Novell where I work.)

--
Cindy Winegarden
cindy@cindywinegarden.com


VFP OLE DB: http://msdn2.microsoft.com/en-us/vfoxpro/bb190232.aspx
VFP ODBC: http://msdn2.microsoft.com/en-us/vfoxpro/bb190233.aspx




"HME" <helassaad@comcast.net> wrote in message
news:TYCdnbHsiOhinJvbnZ2dnUVZ_tWhnZ2d@comcast.com...
> How can I read the user name and password from Active Directory? in other
> words how can I authenticate a user through Active Directory?
>
> Thanks
>
> HME
>



Re: Active Directory User name and Password by HME

HME
Mon Mar 26 22:51:14 CDT 2007

Cindy,

Actually we are in the process of moving to AD from Novell. But although
one is authenticated to AD and the data is on the server, my application
(the client) still needs to be logged into. Not all users that are
authenticated to AD will have access to my application. What I was trying
to do, is to allow a user to use a single User Name and Password (which is
AD credentials) and limit access control to my application's users.

HME

"Cindy Winegarden" <cindy@cindywinegarden.com> wrote in message
news:Odvflh9bHHA.3616@TK2MSFTNGP05.phx.gbl...
> Hi HME,
>
> Others have given you code to get user names.
>
> Is your data on an AD server which is part of a domain? If so then doesn't
> the domain authentication cover access to the directory where the data is?
> I'm new to Active Directory so I may be missing something. (We've recently
> moved away from Novell where I work.)
>
> --
> Cindy Winegarden
> cindy@cindywinegarden.com
>
>
> VFP OLE DB: http://msdn2.microsoft.com/en-us/vfoxpro/bb190232.aspx
> VFP ODBC: http://msdn2.microsoft.com/en-us/vfoxpro/bb190233.aspx
>
>
>
>
> "HME" <helassaad@comcast.net> wrote in message
> news:TYCdnbHsiOhinJvbnZ2dnUVZ_tWhnZ2d@comcast.com...
>> How can I read the user name and password from Active Directory? in other
>> words how can I authenticate a user through Active Directory?
>>
>> Thanks
>>
>> HME
>>
>
>



Re: Active Directory User name and Password by Cindy

Cindy
Tue Mar 27 10:47:51 CDT 2007

Hi HME,

Do any users (other than the LAN administrators) who don't have access to
your application have AD rights to the directory where the data resides?

--
Cindy Winegarden
cindy@cindywinegarden.com


VFP OLE DB: http://msdn2.microsoft.com/en-us/vfoxpro/bb190232.aspx
VFP ODBC: http://msdn2.microsoft.com/en-us/vfoxpro/bb190233.aspx




"HME" <helassaad@comcast.net> wrote in message
news:xsydnbfajNkvCZXbnZ2dnUVZ_oOknZ2d@comcast.com...
> Cindy,
>
> Actually we are in the process of moving to AD from Novell. But although
> one is authenticated to AD and the data is on the server, my application
> (the client) still needs to be logged into. Not all users that are
> authenticated to AD will have access to my application. What I was trying
> to do, is to allow a user to use a single User Name and Password (which is
> AD credentials) and limit access control to my application's users.
>
> HME



Re: Active Directory User name and Password by HME

HME
Tue Mar 27 17:33:03 CDT 2007

No, they shouldn't

"Cindy Winegarden" <cindy@cindywinegarden.com> wrote in message
news:O6LhmhIcHHA.3616@TK2MSFTNGP05.phx.gbl...
> Hi HME,
>
> Do any users (other than the LAN administrators) who don't have access to
> your application have AD rights to the directory where the data resides?
>
> --
> Cindy Winegarden
> cindy@cindywinegarden.com
>
>
> VFP OLE DB: http://msdn2.microsoft.com/en-us/vfoxpro/bb190232.aspx
> VFP ODBC: http://msdn2.microsoft.com/en-us/vfoxpro/bb190233.aspx
>
>
>
>
> "HME" <helassaad@comcast.net> wrote in message
> news:xsydnbfajNkvCZXbnZ2dnUVZ_oOknZ2d@comcast.com...
>> Cindy,
>>
>> Actually we are in the process of moving to AD from Novell. But although
>> one is authenticated to AD and the data is on the server, my application
>> (the client) still needs to be logged into. Not all users that are
>> authenticated to AD will have access to my application. What I was
>> trying to do, is to allow a user to use a single User Name and Password
>> (which is AD credentials) and limit access control to my application's
>> users.
>>
>> HME
>
>



Re: Active Directory User name and Password by Ashu

Ashu
Fri Mar 30 12:05:50 CDT 2007

I have a similar problem, but Active Directory is not on the Windows 2000
server.
Any ideas about how to do this (read user names and check passwords) without
AD ?

Thanks in advance,
AK

"HME" <helassaad@comcast.net> wrote in message
news:TYCdnbHsiOhinJvbnZ2dnUVZ_tWhnZ2d@comcast.com...
> How can I read the user name and password from Active Directory? in other
> words how can I authenticate a user through Active Directory?
>
> Thanks
>
> HME
>