本文介绍了活动目录域PrincipalContext.ValidateCredentials歧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我负责的两个领域 - 一个是信任域。有可能是一个JohnSmith上一个域与另一个JohnSmith为另一方。这两种人需要登录到我的应用程序。

我的问题:没关系我通过在哪个域 - 这code返回true! 如何知道哪些JohnSmith是登录?

 静态公共布尔CheckCredentials(
        用户名字符串,字符串密码,串域)
    {
        使用(VAR上下文=新PrincipalContext(ContextType.Domain,域))
        {
            返回context.ValidateCredentials(用户名,密码);
        }
    }
 

解决方案

ValidateCredentials 的UserPrincipalName 的作品,你也许可以尝试建立的第一个参数(用户名)相结合的登录和创建用户名域 [email protected] [email protected]

I'm dealing with two domains - one is a trusted domain. There may be a JohnSmith on one domain and another JohnSmith on the other. Both of these people need to log into my application.

My problem: it doesn't matter which domain I pass in - this code returns true! How do I know which JohnSmith is logging in?

    static public bool CheckCredentials(
        string userName, string password, string domain)
    {
        using (var context = new PrincipalContext(ContextType.Domain, domain))
        {
            return context.ValidateCredentials(userName, password);
        }
    }
解决方案

The ValidateCredentials works with userPrincipalName you perhaps can try to build the first parameter (username) combining the login and the domain to create the username [email protected] versus [email protected].

这篇关于活动目录域PrincipalContext.ValidateCredentials歧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 00:34