물론입니다. 이것은 특히 인트라넷 응용 프로그램에 유용합니다.
환경을 지정하지 않았으므로 .NET이라고 가정하겠습니다.하지만 가능한 유일한 방법은 아닙니다.
Active Directory는 LDAP을 사용하여 쉽게 쿼리 할 수 있습니다. .NET을 사용하는 경우 this code example 또는 아래 예제와 같은 작업을 수행 할 수 있습니다. SQL environments에서도 가능합니다.
인증을 처리하기 위해 Windows가 필요한 경우 예를 들어 Windows Authentication에 대한 .NET 웹 앱을 설정할 수 있습니다. 응용 프로그램에 대해 IIS 내에서 turn off Anonymous Logins을 사용해야합니다. 작업이 완료되면 사용자의 Windows 로그온 이름에 액세스하여이를 사용하여 추가 보안 확인을 수행 할 수 있습니다 (예 : AD에서 group/role membership).
또한 Enterprise Library의 Security Application Block과 같은 것을 사용하여 전체적인 작업을 단순화 할 수 있습니다. 여기
짧은 C# 예제입니다 : 당신은 도메인 컨트롤러를 지정할 필요가 없습니다
using System.DirectoryServices;
/// <summary>
/// Gets the email address, if defined, of a user from Active Directory.
/// </summary>
/// <param name="userid">The userid of the user in question. Make
/// sure the domain has been stripped first!</param>
/// <returns>A string containing the user's email address, or null
/// if one was not defined or found.</returns>
public static string GetEmail(string userid)
{
DirectorySearcher searcher;
SearchResult result;
string email;
// Check first if there is a slash in the userid
// If there is, domain has not been stripped
if (!userid.Contains("\\"))
{
searcher = new DirectorySearcher();
searcher.Filter = String.Format("(SAMAccountName={0})", userid);
searcher.PropertiesToLoad.Add("mail");
result = searcher.FindOne();
if (result != null)
{
email = result.Properties["mail"][0].ToString();
}
}
return email;
}
(VB.NET here로 변환). DirectorySearcher의 빈/기본 생성자를 수행하면 자동으로 하나를 찾습니다. — 실제로는 the preferred method입니다.
어떤 웹 응용 프로그램 프레임 워크입니까? ASP.NET? 이것은 관련성이 있습니다. –