Linger.Ldap.AspNetCore 0.2.0-alpha

This is a prerelease version of Linger.Ldap.AspNetCore.
dotnet add package Linger.Ldap.AspNetCore --version 0.2.0-alpha                
NuGet\Install-Package Linger.Ldap.AspNetCore -Version 0.2.0-alpha                
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.AspNetCore" Version="0.2.0-alpha" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Linger.Ldap.AspNetCore --version 0.2.0-alpha                
#r "nuget: Linger.Ldap.AspNetCore, 0.2.0-alpha"                
#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.
// Install Linger.Ldap.AspNetCore as a Cake Addin
#addin nuget:?package=Linger.Ldap.AspNetCore&version=0.2.0-alpha&prerelease

// Install Linger.Ldap.AspNetCore as a Cake Tool
#tool nuget:?package=Linger.Ldap.AspNetCore&version=0.2.0-alpha&prerelease                

Linger.Ldap.AspNetCore

Linger.Ldap.AspNetCore is a C# helper library designed to simplify LDAP operations in ASP.NET Core applications.

Features

  • Easy integration with ASP.NET Core
  • Simplified LDAP operations
  • Configuration options via Microsoft.Extensions.Options.ConfigurationExtensions

Getting Started

Prerequisites

  • .NET 8.0 SDK or later

Installation

From Visual Studio
  1. Open the Solution Explorer.
  2. Right-click on a project within your solution.
  3. Click on Manage NuGet Packages....
  4. Click on the Browse tab and search for "Linger.Ldap.AspNetCore".
  5. Click on the Linger.Ldap.AspNetCore package, select the appropriate version and click Install.
Package Manager Console
PM> Install-Package Linger.Ldap.AspNetCore
.NET CLI Console
> dotnet add package Linger.Ldap.AspNetCore

Usage

  1. Add the necessary configuration in your appsettings.json:

    "LdapConfig": {
        "Url": "ldap://your-ldap-server",
        "Security": false,
        "Domain": "your-domain",
        "Credentials": {
            "BindDn": "your-bind-dn",
            "BindCredentials": "your-bind-password"
        },
        "SearchBase": "DC=example,DC=com",
        "SearchFilter": "(&(objectClass=user)(objectClass=person)(sAMAccountName={0}))",
        "Attributes": [
            "memberOf",
            "displayName",
            "sAMAccountName",
            "userPrincipalName"
        ]
    }
    
  2. Register the LDAP services in your Program.cs:

    using Linger.Ldap.AspNetCore;
    builder.Services.AddLdapService(builder.Configuration);
    
  3. Inject and use the ILdapService in your controllers or services:

    public class HomeController : Controller
    {
        private readonly ILdapService _ldapService;
    
        public HomeController(ILdapService ldapService)
        {
            _ldapService = ldapService;
        }
    
        public IActionResult Index()
        {
            var ldapCredentials = new LdapCredentials { BindDn = userName, BindCredentials = password };
            var users = _ldapService.FindUser(userName,ldapCredentials);
            return View(users);
        }
    }
    

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.2.0-alpha 39 2/9/2025
0.1.2-alpha 54 12/17/2024
0.1.1-alpha 49 12/17/2024
0.1.0-alpha 55 12/6/2024
0.0.4-alpha 49 12/6/2024
0.0.3-alpha 55 11/27/2024
0.0.2-alpha 54 10/3/2024