Name
WindowsPrincipal
Synopsis
public class WindowsPrincipal : IPrincipal { // Public Constructors public WindowsPrincipal(WindowsIdentityntIdentity); // Public Instance Properties public virtual IIdentity Identity{get; } // implements IPrincipal // Public Instance Methods public virtual bool IsInRole(intrid); public virtual bool IsInRole(stringrole); // implements IPrincipal public virtual bool IsInRole(WindowsBuiltInRolerole); }
The WindowsPrincipal class provides a
Windows-specific implementation of the IPrincipal
interface that contains a WindowsIdentity object
representing a Windows user. The WindowsPrincipal
constructor takes only a WindowsIdentity object;
the roles to which the user belongs are determined from the
user’s Windows access token.
WindowsPrincipal allows code to check the Windows
groups to which the represented user belongs through its
implementation of the IPrincipal.IsInRole( )
method, which performs a case-insensitive comparison of the
user’s Windows groups with the specified role name.
WindowsPrincipal also includes two additional
overloads of the IsInRole( ) method. The first
takes an integer specifying the Windows RID for
the role. The second overload takes a member of the
WindowsBuiltInRole enumeration.