TestimoX

API Reference

Class

IdentityExtensions

Namespace ADPlayground.Identity
Assembly ADPlayground
Modifiers static

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

ToDisplayName 2 overloads
public static String ToDisplayName(SecurityIdentifier sid) #
Returns: String

Returns 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 requiredposition: 0
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 required
The SID to resolve.

Returns

Display name; never throws.

ToIdentityInfo 2 overloads
public static IdentityInfo ToIdentityInfo(IdentityReference identity) #
Returns: IdentityInfo

Resolves an identity reference to a rich IdentityInfo using the centralized lookup.

Parameters

identity System.Security.Principal.IdentityReference requiredposition: 0
The identity reference.

Returns

An IdentityInfo object backed by the global cache.

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

Converts an identity string (SID/UPN/SAM/DN) to IdentityInfo via the centralized lookup.

Parameters

identity System.String requiredposition: 0
Identity as SID, UPN, SAM, or distinguished name.

Returns

An IdentityInfo object backed by the global cache.

ToSidAndDisplayName 2 overloads
public static ValueTuple<String, String> ToSidAndDisplayName(SecurityIdentifier sid) #
Returns: ValueTuple<String, String>

Returns both SID string and display name for an identity reference.

Parameters

identity System.Security.Principal.IdentityReference requiredposition: 0
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 required
The SID to resolve.

Returns

A tuple of (Sid, Name).