This project is read-only.

If You Need to Perform Fine-Grained Authorization Based on Business Logic, Use Imperative Authorization

- J.D. Meier, Carlos Farre, Jason Taylor, Prashant Bansode, Steve Gregersen, Madhu Sundararajan, Rob Boucher

Use imperative role-based authorization when you need to make fine-grained authorization choices based upon business logic or when finer-grained access control beyond the level of a code method is required.

Imperative check using a windows principal:
WindowsPrincipal myPrincipal = new WindowsPrincipal(ServiceSecurityContext.Current.WindowsIdentity);
if(myPrincipal.IsInRole(@"domain\Accounting"))
{
//authorized
}
else
{
//not authorized
}

Imperative check using the ASP.NET role provider:
if (Roles.IsUserInRole(@"accounting"))
{
//authorized
}
else
{
//authorization failed
}

Additional Resources

Last edited Jun 12, 2008 at 10:09 PM by prashantbansode, version 1

Comments

No comments yet.