Authentication (ADSI)
In ADSI, credentials that consist of a user name and password are used to provide or restrict access to objects in the directory service. The ADsGetObject function uses the credentials of the calling thread for authentication. The ADsOpenObject function and IADsOpenDSObject::OpenDSObject method can be used to specify credentials other than those of the calling thread. When an object is bound to with an authenticated user, the user is allowed access to the object as supported by the underlying directory service security requirements.
Note
The ADsOpenObject function and IADsOpenDSObject::OpenDSObject method should not be used to validate user credentials.
The following code example shows how to use the OpenDSObject method to authenticate a user.
Dim MyNamespace As IADsOpenDSObject
Dim X
oUsername="MyUserName"
oPassword="MyPassword"
OnError GoTo CleanuUp
Set MyNamespace = GetObject("LDAP:")
' For authentication, pass a variable for the user name and password to be used for
' authentication. For security reasons, it is recommended that you use the ADS_SECURE_AUTHENTICATION flag.
'
Set X = MyNamespace.OpenDSObject(DN, oUserName, oPassword, ADS_SECURE_AUTHENTICATION)
CleanUp:
MsgBox ("An error has occurred.")
Set MyNamespace = Nothing
Set X = Nothing
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for