Understanding the System.Security. Principal Namespace


Understanding the System.Security. Principal Namespace

The .NET Framework is a study of contrasts. Some of the classes discussed work specifically with code access security, some with user security, and some with both. The System.Security.Principal namespace is the one that you need to remember when working with user-level security. This is actually a very small class for the purpose, but it does the job.

Tip

You can find a complete description of the System.Security.Principle namespace at http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemSecurityPrincipal.asp. Even though the number of classes in this namespace is few, you’ll find that you use some of them in almost every program. For example, the WindowsPrincipal class is exceptionally important when you want to verify the identity and rights of a user.

When working with this class, you’re working with implementations of two interfaces. The IIdentity interface represents an identity—the essential elements that define the person or other entity. For example, your name is part of your identity. The IPrincipal interface is a listing of rights that the person has to some system resource or the ability to perform a task. For example, being a member of the Administrator group gives you complete access to the local machine. See Listing 1.1 for an example of how to use this namespace. Of course, this namespace is discussed several times throughout the book.




.Net Development Security Solutions
.NET Development Security Solutions
ISBN: 0782142664
EAN: 2147483647
Year: 2003
Pages: 168

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net