Share via


UserManager<TUser>.GetUserName(ClaimsPrincipal) Method

Definition

Returns the Name claim value if present otherwise returns null.

public:
 virtual System::String ^ GetUserName(System::Security::Claims::ClaimsPrincipal ^ principal);
public virtual string GetUserName (System.Security.Claims.ClaimsPrincipal principal);
public virtual string? GetUserName (System.Security.Claims.ClaimsPrincipal principal);
abstract member GetUserName : System.Security.Claims.ClaimsPrincipal -> string
override this.GetUserName : System.Security.Claims.ClaimsPrincipal -> string
Public Overridable Function GetUserName (principal As ClaimsPrincipal) As String

Parameters

principal
ClaimsPrincipal

The ClaimsPrincipal instance.

Returns

The Name claim value, or null if the claim is not present.

Remarks

The Name claim is identified by DefaultNameClaimType.

Applies to