2009-10-09 5 views

답변

4

나는 이와 유사한 코드를 사용하여 사용자 암호를 변경하기 위해 Sun One 기반 LDAP에 연결했습니다. 내가 당 Noalt 마태 복음 회칠 한 두 가지의 접근 방식에 동의

using System.DirectoryServices.Protocols; 
using System.Net; 

//... 

// Connect to the directory: 
LdapDirectoryIdentifier ldi = new LdapDirectoryIdentifier("theServerOrDirectoryName"); 
// You might need to specify a full DN for "theUsername" (I had to): 
NetworkCredential nc = new NetworkCredential("theUsername", "theOldPassword"); 
// You might need to experiment with setting a different AuthType: 
LdapConnection connection = new LdapConnection(ldi, nc, AuthType.Negotiate); 

DirectoryAttributeModification modifyUserPassword = new DirectoryAttributeModification(); 
modifyUserPassword.Operation = DirectoryAttributeOperation.Replace; 
modifyUserPassword.Name = "userPassword"; 
modifyUserPassword.Add("theNewPassword"); 

ModifyRequest modifyRequest = new ModifyRequest("theUsername", modifyUserPassword); 
DirectoryResponse response = connection.SendRequest(modifyRequest); 
+0

.NET 3.5 이상을 사용하는 경우이 대답을 고려해보십시오. http://stackoverflow.com/questions/1066131/how-to-programaticly-change-active-directory-password – Philippe

1

암호를 제거한 다음 다시 추가해야합니다. 이 작업을 수행 할 때 Novell의 LDAP 라이브러리를 사용했습니다. 제대로 작동하려면 DirectoryEntry를 사용해야 할 수도 있습니다.

Deleting non readable attribute from eDirectory - LDAP through ADSI/System.DirectoryServices


당신이 암호의 종류에 따라 문제가 발생 할 수

e 디렉토리 여기


How to change eDirectory or Universal Password through LDAP

LDAP/Universal Password with eDirectory 8.8

에서 사용은 LDIF 샘플

에게 있습니다
dn: cn=<myuser>,ou=<myou>,o=<myo> 
changetype: modify 
replace: userPassword 
userPassword: <newPassWord> 
+0

Novell의 C# 라이브러리는 SSL을 지원하지 않습니다. 그래서, 나는 그것을 실제로 사용할 수 없다. 나는 S.DS.P를 사용해야한다고 생각한다. –

+0

현재 LDAP 서버를 운영하고 있지 않으므로 (eDirectory는 제외) 더 많은 도움을 줄 수 없다. 적어도 공놀이에 빠지기를 바랍니다. –

1

(노벨 eDirectory에 ... 다르지 없을 겁니다). 그러나 수입에 대한 부작용이 있습니다.

사용자 암호 변경과 관리자 암호 변경 간에는 차이가 있습니다.

userPassword를 바꾸면 관리자 암호가 변경되고 암호 정책에 따라 암호가 즉시 만료 될 수 있습니다. (eDir은 암호 만료 및 유예 로그인 수를 사용합니다).

이전 암호와 새 암호를 제공하면 사용자가 암호를 재설정하기 시작했습니다.

1

the .net developer's guide to directory services programming의 System.DirectoryServices.Protocols를 사용하여 사용자가 암호를 변경하고 관리자 암호를 변경하는 코드 예가 ​​있습니다. 저작권을 이유로 코드 예제를 여기에 붙여 넣을 수는 없다고 가정하지만 System.DirectoryServices.Protocols 및 System.DirectoryServices를 사용하여 작업하고 싶다면이 책을 구입하는 것이 좋습니다.

관련 문제