FrameworkExtKit.DirectoryService
4.2.1
dotnet add package FrameworkExtKit.DirectoryService --version 4.2.1
NuGet\Install-Package FrameworkExtKit.DirectoryService -Version 4.2.1
<PackageReference Include="FrameworkExtKit.DirectoryService" Version="4.2.1" />
paket add FrameworkExtKit.DirectoryService --version 4.2.1
#r "nuget: FrameworkExtKit.DirectoryService, 4.2.1"
// 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
- 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 | 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 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. |
-
.NETCoreApp 2.1
- Microsoft.EntityFrameworkCore (>= 2.1.11)
- Microsoft.EntityFrameworkCore.SqlServer (>= 2.1.11)
- Microsoft.Extensions.Configuration (>= 2.1.1)
- Microsoft.Extensions.Configuration.Binder (>= 2.1.10)
- Microsoft.Extensions.Configuration.Json (>= 2.1.1)
- Microsoft.Extensions.Logging (>= 2.1.1)
- Novell.Directory.Ldap.NETStandard (>= 3.1.0)
-
.NETCoreApp 3.1
- Microsoft.EntityFrameworkCore (>= 3.1.7)
- Microsoft.EntityFrameworkCore.SqlServer (>= 3.1.7)
- Microsoft.Extensions.Configuration (>= 3.1.7)
- Microsoft.Extensions.Configuration.Binder (>= 3.1.7)
- Microsoft.Extensions.Configuration.Json (>= 3.1.7)
- Microsoft.Extensions.Logging (>= 3.1.7)
- Novell.Directory.Ldap.NETStandard (>= 3.3.0)
-
.NETFramework 4.5.2
- EntityFramework (>= 6.2.0)
- Newtonsoft.Json (>= 12.0.2)
- Z.EntityFramework.Plus.EF6 (>= 1.12.34)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.