Role-Based Security

The .NET framework includes a suite of classes specialized for traditional role-based security. These classes permit code to grant and restrict access to specified agents and users to support a security policy. The primary object in role-based security is the Principal object. It contains both a user identity and a role.

The .NET framework contains two methods of managing role-based security: Windows and Generic. The first is through the native Windows security system, and the other is a more general and independent mechanism. Listing 38.3 shows how to find a given role using the native Windows security system.

Listing 38.3. Role-Based Security with WindowsPrincipal
 using System; using System.Threading; using System.Security.Principal; ...

Get C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.