API Reference
IdentityResolver
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) #VoidAdds 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
- name System.String
public static Void AddKnownMappings(IEnumerable<ValueTuple<String, String>> mappings) #VoidAdds or overrides a batch of SID→Name mappings.
Parameters
- mappings System.Collections.Generic.IEnumerable{System.ValueTuple{System.String,System.String}}
public static Void ClearCache(Boolean resetMetrics = true) #VoidClears all cached entries and repopulates well-known mappings.
Parameters
- resetMetrics System.Boolean = true
- Set to false to preserve collected metrics.
public static Void LoadKnownMappingsFromEnvironment() #VoidLoads known mappings from the environment variable 'ADP_IDENTITY_KNOWN_MAPPINGS'. Format: SID=Name;SID=Name;...
public static Boolean Remove(SecurityIdentifier sid) #BooleanRemoves a cached entry by identity string.
Parameters
- identity System.String
- 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
- SID to remove.
Returns
true when the entry existed and was removed.
public static List<IdentityInfo> ResolveIdentities(IEnumerable<String> identities, Int32 maxConcurrency = 10) #List<IdentityInfo>Resolves a batch of identities concurrently using synchronous resolution.
Parameters
- identities System.Collections.Generic.IEnumerable{System.String}
- Collection of identity strings.
- maxConcurrency System.Int32 = 10
- Maximum number of concurrent resolutions.
Returns
List of identity information.
public static async Task<List<IdentityInfo>> ResolveIdentitiesAsync(IEnumerable<String> identities, Int32 maxConcurrency = 10) #Task<List<IdentityInfo>>Resolves a batch of identities concurrently with optional throttling.
Parameters
- identities System.Collections.Generic.IEnumerable{System.String}
- Collection of identity strings.
- maxConcurrency System.Int32 = 10
- Maximum number of concurrent resolutions.
Returns
List of identity information.
public static IdentityInfo ResolveIdentity(String identity) #IdentityInfoResolves any identity string to detailed information about the identity.
Parameters
- identity System.String
- Identity in SID, UPN, SAM or DN format.
Returns
Detailed resolution information.
public static Task<IdentityInfo> ResolveIdentityAsync(String identity) #Task<IdentityInfo>Asynchronously resolves any identity string to detailed information about the identity.
Parameters
- identity System.String
- Identity in SID, UPN, SAM or DN format.
Returns
Task returning detailed resolution information.
public static String ResolveName(SecurityIdentifier sid) #StringResolves a SecurityIdentifier to an account name.
Parameters
- sid System.Security.Principal.SecurityIdentifier
- SID to translate.
Returns
Account name or null when translation fails.
public static SecurityIdentifier ResolveSid(String identity) #SecurityIdentifierResolves an identity string to a SecurityIdentifier.
Parameters
- identity System.String
- 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) #SecurityIdentifierResolves an identity string and provides an error message when resolution fails.
Parameters
- identity System.String
- Identity in SID, UPN, SAM or DN format.
- errorMessage System.String@
- Populated with an error message on failure.
Returns
Resolved SecurityIdentifier or null.
public static Boolean TryGetNtAccount(SecurityIdentifier sid, out NTAccount account) #BooleanProvides 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
- Input security identifier.
- account System.Security.Principal.NTAccount@
- Resolved NT account when successful; otherwise null.
Returns
True on success.
public static Boolean TryGetSid(NTAccount account, out SecurityIdentifier sid) #BooleanAttempts to translate an NTAccount to a SecurityIdentifier.
Parameters
- account System.Security.Principal.NTAccount
- Input NT account.
- sid System.Security.Principal.SecurityIdentifier@
- Resolved SID when successful; otherwise null.
Returns
True on success.
Inherited Methods
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.