Skip to Content
Programming .NET Security
book

Programming .NET Security

by Adam Freeman, Allen Jones
June 2003
Intermediate to advanced
714 pages
22h 8m
English
O'Reilly Media, Inc.
Content preview from Programming .NET Security

Name

WindowsPrincipal

Synopsis

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.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

.NET Framework Security

.NET Framework Security

Brian A. LaMacchia, Sebastian Lange, Matthew Lyons, Rudi Martin, Kevin T. Price
.NET Security and Cryptography

.NET Security and Cryptography

Peter Thorsteinson, G. Gnana Arun Ganesh
ASP.NET Core Security

ASP.NET Core Security

Christian Wenz

Publisher Resources

ISBN: 0596004427Supplemental ContentErrata Page