src/NuGetGallery.Services/Extensions/PrincipalExtensions.cs
/// <summary>
/// Get the tenant ID from the claims, if available. If no such claim exists, null is returned.
/// </summary>
/// <param name="identity">The identity to look for claims in.</param>
/// <returns>The tenant ID or null.</returns>
Get the tenant ID from the claims, if available. If no such claim exists, null is returned.
Get the tenant ID from the claims if available . If no such claim exists null is returned .
public static string GetTenantIdOrNull(this IIdentity identity)
        {
            var claimsIdentity = identity as ClaimsIdentity;
            return claimsIdentity?.FindFirst(MicrosoftClaims.TenantId)?.Value;
        }
public static string GetTenantIdOrNull ( this IIdentity identity ) { var claimsIdentity = identity as ClaimsIdentity ; return claimsIdentity ? . FindFirst ( MicrosoftClaims . TenantId ) ? . Value ; }
Get the tenant ID from the claims, if available.
Get the tenant ID from the claims if available .
The tenant ID or null.
The tenant ID or null .
IIdentity
this
identity
The identity to look for claims in.
The identity to look for claims in .