【问题标题】:UserPrincipal Security. Disabling unwanted smart card prompt?用户主体安全。禁用不需要的智能卡提示?
【发布时间】:2020-09-20 23:23:03
【问题描述】:

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

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

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

我没有太多运气找到原因/解决方案。任何帮助将不胜感激!

【问题讨论】:

  • 碰撞线程。不幸的是,我仍然坚持这一点
  • 同样的问题。

标签: c# security prompt smartcard principalcontext


【解决方案1】:

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

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

【讨论】:

  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-09-02
  • 2023-03-07
  • 2018-06-28
  • 1970-01-01
  • 2010-12-21
  • 1970-01-01
  • 2014-03-21
相关资源
最近更新 更多