AD 도메인 계정 로그인
도메인 서비스 데이터 읽기와 쓰기에는 두 가지 모드가 있습니다.
1. 경량급 데이터 읽기
_domain
PrincipalContext pc = new PrincipalContext(ContextType.Domain, _domain)
pc.ValidateCredentials(jobNumber, password)
System.DirectoryServices.AccountManagement , ,AD
using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, _domain))
{
//
using (var userPrincipal = UserPrincipal.FindByIdentity(pc, IdentityType.SamAccountName,loginModel.JobNumber))
{
if (userPrincipal == null)
{
return " , ";
}
if (!pc.ValidateCredentials(loginModel.JobNumber, loginModel.Password))
{
return @" , ";
}
//GivenName ,Surname ( ),Name + ( )
PersonDetailInfo personDetailInfo = new PersonDetailInfo()
{
SearchName = userPrincipal.Name,
UserName = userPrincipal.GivenName,
JobNumber = userPrincipal.SamAccountName,
EmailAddress = userPrincipal.EmailAddress
};
return personDetailInfo;
}
}
2、DectoryEntry
전체 서버의 데이터를 가져올 수도 있고 그 정보를 수정할 수도 있다
유사한 기사 참조:
http://www.it165.net/pro/html/201308/6829.html