简体   繁体   English

C ++中的Windows LDAP身份验证

[英]Windows LDAP Authentication in C++

I am currently trying to authenticate users in a c++ application in Windows. 我目前正在尝试在Windows中的C ++应用程序中对用户进行身份验证。 I need to display a dialog for username and password and verify that they are an authenticated user on the Windows machine. 我需要显示一个用户名和密码对话框,并确认它们是Windows计算机上的经过身份验证的用户。 Are there any libraries that allow for this functionality or a good way to go about it? 是否有允许使用此功能的库或实现该功能的好方法?

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? 可能是CredUIPromptForWindowsCredentials (请参阅http://msdn.microsoft.com/en-us/library/aa375178.aspx )或旧的CredUIPromptForCredentials (请参阅http://msdn.microsoft.com/en-us/library/aa375177.aspx )解决你的问题?

UPDATED : Another the most old way to authenticate a user is using of SSPI. 更新 :验证用户身份的另一种最古老的方法是使用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 . 您可以在http://support.microsoft.com/kb/180548上找到一个非常旧的代码示例(可能是Microsoft发布的第一个示例)。

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. 如果您确实想使用LDAP API(请参阅http://msdn.microsoft.com/zh-cn/library/aa366102.aspx ),则可以使用ldap_bind_s (请参阅http://msdn.microsoft.com/zh-cn/library /aa366156.aspx )以验证用户身份验证。 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) 请参见http://msdn.microsoft.com/zh-cn/library/aa366106.aspx作为代码示例(这不是您想要的,但您可以理解这些API的工作原理)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM