API Reference
IdentityExtensions
Convenience extensions for rendering and converting identities using the centralized lookup. These helpers never throw and are safe to use in UI/logging code paths.
Inheritance
- Object
- IdentityExtensions
Methods
public static String ToDisplayName(SecurityIdentifier sid) #StringReturns a friendly display name for an IdentityReference. If the reference is a SecurityIdentifier, the name is resolved via IdentityInfo>) (global cache + bounded directory lookup). Otherwise the raw Value is returned. This method never throws and always returns a non-null string (possibly empty).
Parameters
- identity System.Security.Principal.IdentityReference
- The identity reference (SID or NTAccount).
Returns
Friendly display name suitable for UI/logging.
ToDisplayName(System.Security.Principal.SecurityIdentifier sid) #Returns a friendly display name for a SecurityIdentifier using the centralized lookup.
Parameters
- sid System.Security.Principal.SecurityIdentifier
- The SID to resolve.
Returns
Display name; never throws.
public static IdentityInfo ToIdentityInfo(IdentityReference identity) #IdentityInfoResolves an identity reference to a rich IdentityInfo using the centralized lookup.
Parameters
- identity System.Security.Principal.IdentityReference
- The identity reference.
Returns
An IdentityInfo object backed by the global cache.
public static IdentityInfo ToIdentityInfo(String identity) #IdentityInfoConverts an identity string (SID/UPN/SAM/DN) to IdentityInfo via the centralized lookup.
Parameters
- identity System.String
- Identity as SID, UPN, SAM, or distinguished name.
Returns
An IdentityInfo object backed by the global cache.
public static ValueTuple<String, String> ToSidAndDisplayName(SecurityIdentifier sid) #ValueTuple<String, String>Returns both SID string and display name for an identity reference.
Parameters
- identity System.Security.Principal.IdentityReference
- The identity reference (SID or NTAccount).
Returns
A tuple of (Sid, Name). When identity is not a SecurityIdentifier, both values equal Value.
ToSidAndDisplayName(System.Security.Principal.SecurityIdentifier sid) #Returns both SID string and display name for a SecurityIdentifier.
Parameters
- sid System.Security.Principal.SecurityIdentifier
- The SID to resolve.
Returns
A tuple of (Sid, Name).