FrameworkExtKit.DirectoryService 4.2.1

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

// Install FrameworkExtKit.DirectoryService as a Cake Tool
#tool nuget:?package=FrameworkExtKit.DirectoryService&version=4.2.1

Summary

This library aims to provide an easy solution to read LDAP/AD data. It is not designed to support full LDAP functions.

It allows developers to query LDAP/AD directory using Linq queries without learning LDAP filter syntax. You will be able to master LDAP search within few minutes.

You can also use this library to fetch user/group/policy etc. information from a flat database table without re-work the solution.

Package Dependencies

  1. Novell.Directory.Ldap.NETStandard

Usage

1. Configuration

.net framework 4.5

<appSettings>
    
    <add key="DirectoryAccountService.RootEntryPath" value="LDAP://ldap.company.com/o=company,c=an" />
    
    <add key="DirectoryAccountService.RootEntryPath" value="LDAP://activedirectory.sample.com" />
    
    <add key="DirectoryAccountService.RootEntryPath" value="DB://DBDirectoryService" />

</appSettings>
  <connectionStrings>
    <add name="DBDirectoryService" connectionString="data source=(localdb)\MSSQLLocalDB;integrated security=true;initial catalog=DBDirectoryService;" providerName="System.Data.SqlClient" />
  </connectionStrings>

.netcore, appsettings.json

{
  "LdapSettings": {
    "ServerName": "ldap.company.com",
    "ServerPort": 389,
    "UseSSL": false,
    "Bind": {
      "BindDn": "",
      "BindCredentials": ""
    },
    "SearchBase": "o=company,c=an"
  }
}

2. Create Entity Class

Create an entity class to represent the LDAP data structure needed

public partial class DirectoryRole : DirectoryEntity {
        [DirectoryProperty("mail")]
        public virtual string Mail { get; set; }
        [DirectoryProperty("street")]
        public virtual string Street { get; set; }
        [DirectoryProperty("st")]
        public virtual string State { get; set; }
        [DirectoryProperty("postalcode")]
        public virtual string PostalCode { get; set; }
        [DirectoryProperty("manager")]
        public virtual string Manager { get; set; }

        public virtual string[] Proxies { 
	        get {
		        return this.Proxy.Split(";");
	        }
        }
        [DirectoryProperty("proxy")]
        public virtual string Proxy { get; set; }
        [DirectoryProperty("description")]
        public virtual string Description { get; set; }
    }
3. Create DirectoryService

.net core

public void CreateDirectoryService(IConfiguration configuration) {
    var section = configuration.GetSection("LdapSettings");
    LdapSettings settings = new LdapSettings();
    section.Bind(settings);
    service = new LdapDirectoryService<DirectoryRole>(settings);
}

4. Search LDAP

service.FindByIdentifier("user-name");
// linq query
service.First(role => role.Mail == "me@company.com");
service.Where(role => role.manager=="manager1" && role.Mail.Contains("@company.com"))
        .ToList();
// ldap filter
service.Query("(&(mail=*@company.com*)(manager=*manager1*))")
Product 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 was computed.  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. 
.NET Core netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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
4.2.1 437 9/26/2020
4.2.0 383 9/26/2020