TestimoX

API Reference

Class

IdentityResolver

Namespace ADPlayground.Identity
Assembly ADPlayground
Modifiers static

Lightweight resolver providing cached SID↔Name translation and convenience helpers. Prefer IdentityLookup for enriched directory data; use this when you need minimal, fast translation.

Inheritance

  • Object
  • IdentityResolver

Methods

public static Void AddKnownMapping(String sidValue, String name) #
Returns: Void

Adds or overrides a direct SID→Name mapping (and reverse) in the resolver cache. Useful for preloading known service identities or custom principals.

Parameters

sidValue System.String requiredposition: 0
name System.String requiredposition: 1
public static Void AddKnownMappings(IEnumerable<ValueTuple<String, String>> mappings) #
Returns: Void

Adds or overrides a batch of SID→Name mappings.

Parameters

mappings System.Collections.Generic.IEnumerable{System.ValueTuple{System.String,System.String}} requiredposition: 0
public static Void ClearCache(Boolean resetMetrics = true) #
Returns: Void

Clears all cached entries and repopulates well-known mappings.

Parameters

resetMetrics System.Boolean = true optionalposition: 0
Set to false to preserve collected metrics.
public static CacheMetrics GetMetrics() #
Returns: CacheMetrics

Retrieves current cache metrics.

public static Void LoadKnownMappingsFromEnvironment() #
Returns: Void

Loads known mappings from the environment variable 'ADP_IDENTITY_KNOWN_MAPPINGS'. Format: SID=Name;SID=Name;...

Remove 2 overloads
public static Boolean Remove(SecurityIdentifier sid) #
Returns: Boolean

Removes a cached entry by identity string.

Parameters

identity System.String requiredposition: 0
Identity string to remove.

Returns

true when the entry existed and was removed.

Remove(System.Security.Principal.SecurityIdentifier sid) #

Removes a cached entry by SID.

Parameters

sid System.Security.Principal.SecurityIdentifier required
SID to remove.

Returns

true when the entry existed and was removed.

public static List<IdentityInfo> ResolveIdentities(IEnumerable<String> identities, Int32 maxConcurrency = 10) #
Returns: List<IdentityInfo>

Resolves a batch of identities concurrently using synchronous resolution.

Parameters

identities System.Collections.Generic.IEnumerable{System.String} requiredposition: 0
Collection of identity strings.
maxConcurrency System.Int32 = 10 optionalposition: 1
Maximum number of concurrent resolutions.

Returns

List of identity information.

public static async Task<List<IdentityInfo>> ResolveIdentitiesAsync(IEnumerable<String> identities, Int32 maxConcurrency = 10) #
Returns: Task<List<IdentityInfo>>

Resolves a batch of identities concurrently with optional throttling.

Parameters

identities System.Collections.Generic.IEnumerable{System.String} requiredposition: 0
Collection of identity strings.
maxConcurrency System.Int32 = 10 optionalposition: 1
Maximum number of concurrent resolutions.

Returns

List of identity information.

public static IdentityInfo ResolveIdentity(String identity) #
Returns: IdentityInfo

Resolves any identity string to detailed information about the identity.

Parameters

identity System.String requiredposition: 0
Identity in SID, UPN, SAM or DN format.

Returns

Detailed resolution information.

public static Task<IdentityInfo> ResolveIdentityAsync(String identity) #
Returns: Task<IdentityInfo>

Asynchronously resolves any identity string to detailed information about the identity.

Parameters

identity System.String requiredposition: 0
Identity in SID, UPN, SAM or DN format.

Returns

Task returning detailed resolution information.

public static String ResolveName(SecurityIdentifier sid) #
Returns: String

Resolves a SecurityIdentifier to an account name.

Parameters

sid System.Security.Principal.SecurityIdentifier requiredposition: 0
SID to translate.

Returns

Account name or null when translation fails.

ResolveSid 2 overloads
public static SecurityIdentifier ResolveSid(String identity) #
Returns: SecurityIdentifier

Resolves an identity string to a SecurityIdentifier.

Parameters

identity System.String requiredposition: 0
Identity in SID, UPN, SAM or DN format.

Returns

Resolved SecurityIdentifier or null when resolution fails.

public static SecurityIdentifier ResolveSid(String identity, out String errorMessage) #
Returns: SecurityIdentifier

Resolves an identity string and provides an error message when resolution fails.

Parameters

identity System.String requiredposition: 0
Identity in SID, UPN, SAM or DN format.
errorMessage System.String@ requiredposition: 1
Populated with an error message on failure.

Returns

Resolved SecurityIdentifier or null.

public static Boolean TryGetNtAccount(SecurityIdentifier sid, out NTAccount account) #
Returns: Boolean

Provides Try-style translations when callers need typed handles rather than strings. Attempts to translate a SID to an NTAccount.

Parameters

sid System.Security.Principal.SecurityIdentifier requiredposition: 0
Input security identifier.
account System.Security.Principal.NTAccount@ requiredposition: 1
Resolved NT account when successful; otherwise null.

Returns

True on success.

public static Boolean TryGetSid(NTAccount account, out SecurityIdentifier sid) #
Returns: Boolean

Attempts to translate an NTAccount to a SecurityIdentifier.

Parameters

account System.Security.Principal.NTAccount requiredposition: 0
Input NT account.
sid System.Security.Principal.SecurityIdentifier@ requiredposition: 1
Resolved SID when successful; otherwise null.

Returns

True on success.

Properties

public static Int32 CacheSizeLimit { get; set; } #

Gets or sets the maximum number of cached entries. Reducing the limit trims existing caches immediately. Defaults to 1000 entries.