0

我正在尝试在 ADAM 中重置用户密码。为此,我正在使用 Accountmanagement 命名空间

我尝试了什么:

PrincipalContext rootPrincipalContext;
LdapConnection objLdapconnection;
rootPrincipalContext = new PrincipalContext(ContextType.ApplicationDirectory, host, baseDN, ContextOptions.Negotiate, username, password);
LdapDirectoryIdentifier identifier = new LdapDirectoryIdentifier(host, Convert.ToInt32(port));
NetworkCredential credential = new NetworkCredential(username, password);
LdapConnection ldapCon = new LdapConnection(identifier, credential);
ldapCon.AuthType = AuthType.Negotiate;
objLdapconnection = ldapCon;

密码重置:

 UserPrincipal existingUsr = UserPrincipal.FindByIdentity(rootPrincipalContext, IdentityType.DistinguishedName, "cn=" + inputName + ",ou=gslab,dc=starfish");

existingUsr.SetPassword(userPassvalue); this lines throws exception "directory property can not be found"

我检查了所有字符串都不是空的,还尝试了 contextOption.secureSocketlayer 但没有任何效果

我需要提供加密密码吗?还是我需要设置任何属性?提前致谢。

4

1 回答 1

0

好吧,我得到了解决方案。只需删除

ContextOptions.Negotiate 

在实例化rootprincipalContext.

和之前的使用ExpirePasswordNow()方法SetPassword()

于 2013-09-02T11:06:21.993 回答