[ Team LiB ] Previous Section Next Section

WindowsPrincipalserializable

System.Security.Principal (mscorlib.dll)class
public class WindowsPrincipal : IPrincipal {
// Public Constructors
   public WindowsPrincipal(WindowsIdentity ntIdentity);
// Public Instance Properties
   public virtual IIdentity Identity{get; }   
// implements IPrincipal
// Public Instance Methods
   public virtual bool IsInRole(int rid);
   public virtual bool IsInRole(string role);
// implements IPrincipal
   public virtual bool IsInRole(WindowsBuiltInRole role);
}

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.

    [ Team LiB ] Previous Section Next Section