本文介绍了UserPrincipal.RefreshExpiredPassword()更新什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如问题中所述,它将用户密码年龄重置为零,但是如何?



pwLastSet属性仍然显示旧日期。



还有其他属性吗?



将pwLastSet值重置为当前日期更好吗?

解决方案

我知道这个问题很旧,但是源代码现在可用,因此您可以确切地看到它的作用。



简而言之,它调用 ADStoreCtx.UnexpircePassword(),它会设置 pwdLastSet 至-1。至少现在是这样。谁知道自2014年以来是否已更改。



以下是相关代码:

  ///< summary> 
///通过将pwdLastSet设置为-1来取消密码
///< / summary>
///< param name = p>< / param>
内部重写void UnexpirePassword(AuthenticablePrincipal p)
{
GlobalDebug.WriteLineIf(GlobalDebug.Info, ADStoreCtx, UnexpirePassword);

Debug.Assert(p.fakePrincipal == false);

WriteAttribute(p, pwdLastSet,-1);
}

从此处:


as noted in this question, it resets the users password age to zero, but how?

pwLastSet attribute still displays the old date.

Is there another attribute?

Is it better to just reset pwLastSet value to current date?

解决方案

I know this question is old, but the source code is available now, so you can see exactly what it does.

In short, it calls ADStoreCtx.UnexpircePassword(), which sets pwdLastSet to -1. At least that's what it does now. Who knows if it's been changed since 2014.

Here's the relevant code:

/// <summary>
/// Unexpire password by setting pwdLastSet to -1
/// </summary>
/// <param name="p"></param>
internal override void UnexpirePassword(AuthenticablePrincipal p)
{
    GlobalDebug.WriteLineIf(GlobalDebug.Info, "ADStoreCtx", "UnexpirePassword");

    Debug.Assert(p.fakePrincipal == false);

    WriteAttribute(p, "pwdLastSet", -1);
}

From here: https://github.com/dotnet/corefx/blob/a1746a74091c4427890078eb817f7f4ee8423304/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx.cs#L958

这篇关于UserPrincipal.RefreshExpiredPassword()更新什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 00:09