gpt4 book ai didi

c# - 用户主体安全。禁用不需要的智能卡提示?

转载 作者:行者123 更新时间:2023-12-05 07:07:24 25 4
gpt4 key购买 nike

我有一个带有登录屏幕的应用程序,用户可以根据域对自己进行身份验证。为此,我使用了 System.DirectoryServices.AccountManagement PrincipalContext/UserPrincipal 类。

                        PrincipalContext domain = new PrincipalContext(ContextType.Domain, "mydomain");
if (domain.ValidateCredentials(UserName, Password))
{
//do stuff
}

这在绝大多数情况下都非常有效。但是,对于少数选定的人来说,这种“domain.ValidateCredentials”方法会在发现 UserName 在域中有效时自动提示插入智能卡。只需再次关闭提示即可让我的应用程序继续,但我更愿意完全摆脱它。

Smart Card Prompt

我没能找到原因/解决方案。如有任何帮助,我们将不胜感激!

最佳答案

我今天也遇到了同样的问题。对我有用的解决方案:添加[System.DirectoryServices.AccountManagement.ContextOptions]'协商'ValidateCredentials 方法:

domain.ValidateCredentials(UserName, Password, [System.DirectoryServices.AccountManagement.ContextOptions]'Negotiate')

关于c# - 用户主体安全。禁用不需要的智能卡提示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62152897/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com