LdifDotNet.Schema
0.8.0
dotnet add package LdifDotNet.Schema --version 0.8.0
NuGet\Install-Package LdifDotNet.Schema -Version 0.8.0
<PackageReference Include="LdifDotNet.Schema" Version="0.8.0" />
<PackageVersion Include="LdifDotNet.Schema" Version="0.8.0" />
<PackageReference Include="LdifDotNet.Schema" />
paket add LdifDotNet.Schema --version 0.8.0
#r "nuget: LdifDotNet.Schema, 0.8.0"
#:package LdifDotNet.Schema@0.8.0
#addin nuget:?package=LdifDotNet.Schema&version=0.8.0
#tool nuget:?package=LdifDotNet.Schema&version=0.8.0
LdifDotNet.Schema
Parser for LDAP schema definitions: RFC 4512 attributetype / objectclass
descriptions in slapd.conf schema-file format, including objectidentifier
OID macros — and the bare definition values a live server publishes in its
subschema subentry. Dependency-free.
using LdifDotNet.Schema;
var schema = LdapSchema.Load("core.schema", "cosine.schema", "inetorgperson.schema");
var person = schema.FindObjectClass("inetOrgPerson");
var required = schema.RequiredAttributeNames(person); // MUST, inherited through SUP chain
var optional = schema.OptionalAttributeNames(person); // MAY, inherited through SUP chain
var sn = schema.FindAttributeType("surname"); // lookup by any name or OID
Console.WriteLine(sn.Syntax); // 1.3.6.1.4.1.1466.115.121.1.15
Schema read from a live server's cn=Subschema entry parses leniently — the
consumer cannot fix a server's schema, so a definition that fails to parse is
preserved raw in UnparsedDefinitions instead of failing the whole schema:
// attributeTypes / objectClasses / ldapSyntaxes values from the subschema subentry
var schema = LdapSchema.ParseSubschema(attributeTypeValues, objectClassValues, ldapSyntaxValues);
foreach (var bad in schema.UnparsedDefinitions)
Console.WriteLine($"unparsed {bad.Kind}: {bad.Error}");
// A live server publishes cn as "SUP name" with no SYNTAX; resolution walks the chain:
var cn = schema.FindAttributeType("cn");
string? syntaxOid = schema.ResolveSyntaxOid(cn); // 1.3.6.1.4.1.1466.115.121.1.15
var syntax = schema.FindSyntax(syntaxOid); // bounds like {32768} strip automatically
bool octets = syntax.NotHumanReadable; // OpenLDAP's X-NOT-HUMAN-READABLE 'TRUE'
// Strict single-definition parsing is also available:
var sn = LdapAttributeType.Parse("( 2.5.4.4 NAME ( 'sn' 'surname' ) SUP name )");
Proven against OpenLDAP's complete shipped schema set plus eduPerson,
rfc2307bis, sudo, and openssh-lpk — and, for subschema input, against the
cn=Subschema entry a real OpenLDAP 2.6 server publishes.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on LdifDotNet.Schema:
| Package | Downloads |
|---|---|
|
LdifDotNet.Generator
Fake LDAP directory data generator for LdifDotNet, powered by Bogus. |
GitHub repositories
This package is not used by any popular GitHub repositories.