Linger.Ldap.ActiveDirectory
1.1.0
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
dotnet add package Linger.Ldap.ActiveDirectory --version 1.1.0
NuGet\Install-Package Linger.Ldap.ActiveDirectory -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Linger.Ldap.ActiveDirectory" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Linger.Ldap.ActiveDirectory" Version="1.1.0" />
<PackageReference Include="Linger.Ldap.ActiveDirectory" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Linger.Ldap.ActiveDirectory --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Linger.Ldap.ActiveDirectory, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Linger.Ldap.ActiveDirectory@1.1.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Linger.Ldap.ActiveDirectory&version=1.1.0
#tool nuget:?package=Linger.Ldap.ActiveDirectory&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Linger.Ldap.ActiveDirectory
A comprehensive .NET library for Active Directory LDAP operations, providing simplified access to AD user information and authentication.
Features
User Management
- User authentication and validation
- Detailed user information retrieval
- User search capabilities
- Group membership information
User Information Categories
- Basic identification (username, display name, UPN)
- Personal information (first name, last name, initials)
- Contact details (email, phone numbers, addresses)
- Organization info (department, title, employee ID)
- System attributes (workstations, profile paths)
- Security settings (account status, password info)
Supported Frameworks
- .NET 10.0
- .NET 9.0
- .NET 8.0
- .NET 6.0
- .NET Standard 2.0
Installation
From Visual Studio
- Open the
Solution Explorer. - Right-click on a project within your solution.
- Click on
Manage NuGet Packages.... - Click on the
Browsetab and search for "Linger.Ldap.ActiveDirectory". - Click on the
Linger.Ldap.ActiveDirectorypackage, select the appropriate version and click Install.
Package Manager Console
PM> Install-Package Linger.Ldap.ActiveDirectory
.NET CLI Console
> dotnet add package Linger.Ldap.ActiveDirectory
Usage Examples
Basic Configuration
var config = new LdapConfig
{
Url = "ldap.company.com",
Domain = "COMPANY",
SearchBase = "DC=company,DC=com",
Security = true,
Credentials = new LdapCredentials { BindDn = "serviceAccount", BindCredentials = "password" }
};
User Authentication
using var ldap = new Ldap(config);
// Authenticate with default SearchBase
var (isValid, userInfo) = await ldap.ValidateUserAsync("username", "password");
if (isValid && userInfo != null)
{
Console.WriteLine($"User authenticated: {userInfo.DisplayName}");
Console.WriteLine($"Email: {userInfo.Email}");
Console.WriteLine($"Department: {userInfo.Department}");
}
// Authenticate in specific OU
var (isValid2, userInfo2) = await ldap.ValidateUserAsync(
"username",
"password",
searchBase: "OU=Sales,DC=company,DC=com"
);
Finding Users
using var ldap = new Ldap(config);
// Find specific user in default SearchBase
var user = await ldap.FindUserAsync("username");
if (user != null)
{
Console.WriteLine($"Name: {user.DisplayName}");
Console.WriteLine($"Email: {user.Email}");
Console.WriteLine($"Title: {user.Title}");
}
// Find user in specific OU
var salesUser = await ldap.FindUserAsync(
"username",
searchBase: "OU=Sales,DC=company,DC=com"
);
// Search users with pattern
var users = await ldap.GetUsersAsync("john*");
foreach (var foundUser in users)
{
Console.WriteLine($"Found: {foundUser.DisplayName}");
Console.WriteLine($"Groups: {string.Join(", ", foundUser.MemberOf ?? Array.Empty<string>())}");
}
// Search users in specific OU
var itUsers = await ldap.GetUsersAsync(
"john*",
searchBase: "OU=IT,DC=company,DC=com"
);
Flexible OU Search (New in v1.0)
// Search across multiple OUs
string[] organizationalUnits =
{
"OU=Sales,DC=company,DC=com",
"OU=IT,DC=company,DC=com",
"OU=HR,DC=company,DC=com"
};
AdUserInfo? foundUser = null;
foreach (var ou in organizationalUnits)
{
foundUser = await ldap.FindUserAsync("john.doe", searchBase: ou);
if (foundUser != null)
{
Console.WriteLine($"User found in: {ou}");
break;
}
}
// Check user existence in specific OU
bool exists = await ldap.UserExistsAsync(
"username",
searchBase: "OU=Contractors,DC=company,DC=com"
);
Available User Properties
Identification
- DisplayName
- SamAccountName
- UserPrincipalName (UPN)
- DistinguishedName (DN)
Personal Information
- FirstName
- LastName
- Description
- Initials
Contact Information
- TelephoneNumber
- Mobile
- HomePhone
- Fax
- IpPhone
- WebPage
Organization Details
- Company
- Department
- Title
- Manager
- EmployeeId
- EmployeeNumber
Address Information
- Street
- City
- State
- PostalCode
- Country
- PostOfficeBox
System Information
- UserWorkstations
- ProfilePath
- HomeDrive
- HomeDirectory
- WhenCreated
Security Information
- Status (Enabled/Disabled/Locked/Expired)
- AccountExpires
- PwdLastSet
- PwdExpirationLeftDays
- MemberOf (Group memberships)
Requirements
- Windows operating system (uses System.DirectoryServices.AccountManagement)
- Appropriate Active Directory permissions
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a Pull Request
License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Linger.Ldap.Contracts (>= 1.1.0)
- Linger.Utils (>= 1.1.0)
- Microsoft.Extensions.Options (>= 10.0.2)
- System.DirectoryServices (>= 10.0.2)
- System.DirectoryServices.AccountManagement (>= 10.0.2)
-
net10.0
- Linger.Ldap.Contracts (>= 1.1.0)
- Linger.Utils (>= 1.1.0)
- Microsoft.Extensions.Options (>= 10.0.2)
- System.DirectoryServices (>= 10.0.2)
- System.DirectoryServices.AccountManagement (>= 10.0.2)
-
net8.0
- Linger.Ldap.Contracts (>= 1.1.0)
- Linger.Utils (>= 1.1.0)
- Microsoft.Extensions.Options (>= 10.0.2)
- System.DirectoryServices (>= 10.0.2)
- System.DirectoryServices.AccountManagement (>= 10.0.2)
-
net9.0
- Linger.Ldap.Contracts (>= 1.1.0)
- Linger.Utils (>= 1.1.0)
- Microsoft.Extensions.Options (>= 10.0.2)
- System.DirectoryServices (>= 10.0.2)
- System.DirectoryServices.AccountManagement (>= 10.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.0 | 102 | 2/4/2026 |
| 1.0.3-preview | 105 | 1/9/2026 |
| 1.0.2-preview | 98 | 1/8/2026 |
| 1.0.0 | 300 | 11/12/2025 |
| 1.0.0-preview2 | 171 | 11/6/2025 |
| 1.0.0-preview1 | 171 | 11/5/2025 |
| 0.9.9 | 159 | 10/16/2025 |
| 0.9.8 | 163 | 10/14/2025 |
| 0.9.7-preview | 153 | 10/13/2025 |
| 0.9.6-preview | 140 | 10/12/2025 |
| 0.9.5 | 138 | 9/28/2025 |
| 0.9.4-preview | 157 | 9/25/2025 |
| 0.9.3-preview | 183 | 9/22/2025 |
| 0.9.1-preview | 289 | 9/16/2025 |
| 0.9.0-preview | 121 | 9/12/2025 |
| 0.8.5-preview | 223 | 8/31/2025 |
| 0.8.4-preview | 333 | 8/25/2025 |
| 0.8.3-preview | 198 | 8/20/2025 |
| 0.8.2-preview | 227 | 8/4/2025 |
| 0.8.1-preview | 176 | 7/30/2025 |
Loading failed