活动目录域PrincipalContext.ValidateCredentials歧

编程入门 行业动态 更新时间:2024-10-26 06:30:02
本文介绍了活动目录域PrincipalContext.ValidateCredentials歧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

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

解决方案

在 ValidateCredentials 与的UserPrincipalName 的作品,你也许可以尝试建立的第一个参数(用户名)相结合的登录和创建用户名域 JohnSmith@dom1 与 JohnSmith@dom2 。

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 JohnSmith@dom1 versus JohnSmith@dom2.

更多推荐

活动目录域PrincipalContext.ValidateCredentials歧

本文发布于:2023-11-17 05:14:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1608951.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:目录   PrincipalContext   ValidateCredentials

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!