UserManager<TUser>.GetUserAsync(ClaimsPrincipal) 方法

定义

返回与主体中的 IdentityOptions.ClaimsIdentity.UserIdClaimType 声明对应的用户或 null。

public:
 virtual System::Threading::Tasks::Task<TUser> ^ GetUserAsync(System::Security::Claims::ClaimsPrincipal ^ principal);
public virtual System.Threading.Tasks.Task<TUser> GetUserAsync (System.Security.Claims.ClaimsPrincipal principal);
public virtual System.Threading.Tasks.Task<TUser?> GetUserAsync (System.Security.Claims.ClaimsPrincipal principal);
abstract member GetUserAsync : System.Security.Claims.ClaimsPrincipal -> System.Threading.Tasks.Task<'User (requires 'User : null)>
override this.GetUserAsync : System.Security.Claims.ClaimsPrincipal -> System.Threading.Tasks.Task<'User (requires 'User : null)>
Public Overridable Function GetUserAsync (principal As ClaimsPrincipal) As Task(Of TUser)

参数

principal
ClaimsPrincipal

包含用户 ID 声明的主体。

返回

Task<TUser>

与主体中的 IdentityOptions.ClaimsIdentity.UserIdClaimType 声明对应的用户或 null

适用于