For educational purposes, I was looking at the User property of the Asp.Net MVC Controller class.
I saw a example , very interesting , that a base class for controllers has been implemented and it has the CurrentUser property:
public abstract class AppController : Controller
{
public AppUserPrincipal CurrentUser {
get { return new AppUserPrincipal(base.User as ClaimsPrincipal); }
}
}
This User property is apparently the same as that in Asp.Net Webforms , which I know nothing about.
The User property is of type IPrincipal and implements a property of type IIdentity and a bool IsInRole(string role)
method.
ClaimsPrincipal inherits from IPrincipal , implying why cast on the property > CurrentUser is possible. But the property even returns is an type