views:

38

answers:

1

I am currently trying to authenticate users in a c++ application in Windows. I need to display a dialog for username and password and verify that they are an authenticated user on the Windows machine. Are there any libraries that allow for this functionality or a good way to go about it?

+1  A: 

Probably CredUIPromptForWindowsCredentials (see http://msdn.microsoft.com/en-us/library/aa375178.aspx) or old CredUIPromptForCredentials (see http://msdn.microsoft.com/en-us/library/aa375177.aspx) could solve your problem?

UPDATED: Another the most old way to authenticate a user is using of SSPI. It will not help with displaying a dialog but this can you implement yourself. You can find a very old code example (probably the first one published by Microsoft) here http://support.microsoft.com/kb/180548.

If you do want use LDAP API (see http://msdn.microsoft.com/en-us/library/aa366102.aspx) you can use ldap_bind_s (see http://msdn.microsoft.com/en-us/library/aa366156.aspx) to verify user authentication. See http://msdn.microsoft.com/en-us/library/aa366106.aspx as a code example (it is not exactly what you want, but you can understand how these API work)

Oleg