Hi Steve,
> One of my clients wants to authenticate their VFP app through ADS rather
than storing the username & password as it currently does.
Here's a function that authenticates a user through LDAP:
*===========================================================================
=============
* Attempts to log the user onto an LDAP server. .T. means that the user
could
* successfully log on. .F. is returned when there's either an error or the
credentials
* were wrong.
*===========================================================================
=============
LPARAMETERS tcLogonName, tcPassword, tcLDAPServer
*---------------------------------------------------------------------------
-----------
* Status
*---------------------------------------------------------------------------
-----------
LOCAL llOK
llOK = .T.
*---------------------------------------------------------------------------
-----------
* Connect to LDAP. The name in GetObject is case sensitive!
*---------------------------------------------------------------------------
-----------
LOCAL loLDAP
IF m.llOK
TRY
loLDAP = GETOBJECT("LDAP:")
CATCH
llOK = .F.
ENDTRY
ENDIF
*---------------------------------------------------------------------------
-----------
* Access the user's own data
*---------------------------------------------------------------------------
-----------
LOCAL loUser
IF m.llOK
TRY
loUser = loLDAP.OpenDsObject( ;
"LDAP://"+m.tcLDAPServer+"/"+m.tcLogonName,
;
m.tcLogonName, ;
m.tcPassword, ;
0x0 ;
)
IF NOT VARTYPE(loUser) == T_OBJECT
llOK = .F.
ENDIF
CATCH
llOK = .F.
ENDTRY
ENDIF
RETURN m.llOK
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/2cff5a469fdb4b1ab77df70e8e397...@fpl5
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.