diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponent.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponent.cs index 0084aa222a..f9352d8d25 100644 --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponent.cs +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponent.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Security.Claims; using System.Security.Principal; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.ModelBinding; @@ -60,6 +61,11 @@ namespace Microsoft.AspNetCore.Mvc } } + /// + /// Gets the for the current user. + /// + public ClaimsPrincipal UserClaimsPrincipal => ViewContext?.HttpContext?.User; + /// /// Gets the for the current request. ///