TestimoX

API Reference

Class

LdapToolContextHelper

Namespace ADPlayground.Helpers
Assembly ADPlayground
Modifiers static

Reusable LDAP context/attribute resolution helpers for tool and wrapper layers.

Inheritance

  • Object
  • LdapToolContextHelper

Remarks

These helpers keep context and attribute-selection policy in ADPlayground so wrappers can stay thin.

Methods

public static IReadOnlyList<String> ResolveAttributeList(IEnumerable<String> requestedAttributes, IEnumerable<String> allowedAttributes, IEnumerable<String> defaultAttributes, IEnumerable<String> requiredAttributes, Nullable<Int32> maxAttributeCount = null) #
Returns: IReadOnlyList<String>

Resolves an attribute list in stable order using: requested + defaults + required (with optional allowlist and optional max cap).

Parameters

requestedAttributes System.Collections.Generic.IEnumerable{System.String} requiredposition: 0
User-requested attributes (first precedence in output order).
allowedAttributes System.Collections.Generic.IEnumerable{System.String} requiredposition: 1
Optional allowlist; when provided, requested/default attributes outside this set are ignored.
defaultAttributes System.Collections.Generic.IEnumerable{System.String} requiredposition: 2
Default attributes appended after requested attributes.
requiredAttributes System.Collections.Generic.IEnumerable{System.String} requiredposition: 3
Required attributes always appended at the end if missing.
maxAttributeCount System.Nullable{System.Int32} = null optionalposition: 4
Optional cap applied to non-required attributes only. Clamped to MaxAttributesCap.

Returns

Ordered, deduplicated attribute list.

public static LdapSearchContext ResolveSearchContext(String explicitDomainController, String explicitBaseDn, String defaultDomainController, String defaultBaseDn, CancellationToken cancellationToken = null) #
Returns: LdapSearchContext

Resolves effective domain controller and base DN using: explicit arguments -> tool defaults -> RootDSE defaultNamingContext.

Parameters

explicitDomainController System.String requiredposition: 0
Explicit domain controller argument.
explicitBaseDn System.String requiredposition: 1
Explicit base DN argument.
defaultDomainController System.String requiredposition: 2
Tool default domain controller.
defaultBaseDn System.String requiredposition: 3
Tool default base DN.
cancellationToken System.Threading.CancellationToken = null optionalposition: 4
Cancellation token used during RootDSE reads.

Returns

Resolved LDAP search context.

Exceptions

  • InvalidOperationException – Thrown when neither explicit nor default base DN is provided and RootDSE does not return defaultNamingContext.