Authorization: What Are You Allowed to Do?
Depending on who you are, a system grants you more or fewer privileges to access certain areas.
Think about the highly secured headquarters of a national security agency in an action movie, for
example. Even if the main character is allowed to enter the building, he is often not allowed to enter
specifi c areas because he lacks the proper authorization (the fact that the hero eventually gains
access in those movies using a two-minute hack in the system is beside the point here).
To determine what a user is allowed to do, a system needs to know two things: the permissions for
the current user and the authorization rules for the resource a user is trying to access.
The permissions for the user are based on her username (the identity it represents) and the roles (or
security groups) the user is optionally assigned to. Similarly, resources can be opened up or blocked
for specifi c users or roles. When there is a match between the current user and the access rules for
the resource a user is trying to access, the user is granted access. If the user is blocked specifi cally,
access is denied. Imagine a fi le that is only accessible to the user Tom and the group Developers. The
user Tom can access that fi le, regardless of whether he is in the Developers role. At the same time,
the user Charlotte must be in the Developers role in order to access the fi le.
You see how to work with these concepts in the remainder of this chapter.
A large part of these security concepts in ASP.NET are implemented with the so-called application
services, discussed next.