IPrincipal 接口
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
定义主体对象的基本功能。
public interface class IPrincipalpublic interface IPrincipal[System.Runtime.InteropServices.ComVisible(true)]
public interface IPrincipaltype IPrincipal = interface[<System.Runtime.InteropServices.ComVisible(true)>]
type IPrincipal = interfacePublic Interface IPrincipal- 派生
- 属性
注解
主体对象表示运行代码的用户的安全上下文,包括该用户的标识 (IIdentity) 及其所属的任何角色。
实现 接口需要 IPrincipal 所有主体对象。 有关实现的详细信息 IPrincipal ,请参阅 ClaimsPrincipal 类。
属性
| Identity | 获取当前用户的标识。 | 
方法
| IsInRole(String) | 确定当前用户是否属于指定的角色。 |