检查AD为同一密码 [英] Check AD for same passwords

查看:166
本文介绍了检查AD为同一密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个问题,在工作的地方有太多人有相同的密码,并最终登录到其他用户的帐户。这不是由组帮助谁坚持一切工作的密码领导人应该是相似的。

We have an issue at work where too many people have the same password and end up logging into other user's accounts. This is not helped by the group leaders who insist all work passwords should be similar.

我知道这是一个不同的问题,而是有没有办法来检查AD,并说这些用户具有相同的密码?

I know it is a different issue, but is there a way to check the AD and say these users have the same password?

推荐答案

如果你有密码,你可以知道谁在使用相同的密码 PrincipalContext System.Security.Principal 类,用这样的事情:

If you have the password, you could know who have the same password using PrincipalContext from System.Security.Principal class, using something like that:

/// <summary>
/// Return true if user is authenticated
/// </summary>
/// <param name="strUsername_">User name</param>
/// <param name="strPassword_">User password</param>
/// <returns>True if authenticated</returns>
public static bool IsAuthenticated(string strUsername_, string strPassword_)
{
    using (var pc = new PrincipalContext(ContextType.Domain, DomainManager.DomainName))
        return pc.ValidateCredentials(strUsername_, strPassword_);
}

在此code, DomainManager.DomainName Domain.GetCurrentDomain()。名称 System.DirectoryServices.ActiveDirectory 库。

In this code, DomainManager.DomainName is Domain.GetCurrentDomain().Name from System.DirectoryServices.ActiveDirectory library.

用户已指定的密码验证,该方法将返回true。

The user has the specified password verified, the method will return true.

但在任何情况下,你将永远不会得到一个密码的用户,你只能尽力核实。

But in any case, you will never get a password from the user, you can only try to verify it.

这篇关于检查AD为同一密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆