I'm working an a ASP.NET application (not using MVC) and need a User-Role-Permission based authorization scheeme, where pages and/or methods can demand the specific permission they require (instead of which role the user has). Is there a way to extend Forms Authentication (or building something) to solve this?
If possible I would like to be able to use attributes:
[RequirePermission("UserEdit")]
public partial class EditUser : System.Web.UI.Page
{
}
Perhaps even for methods:
public class MyClass
{
...
[RequirePermission("UserEdit")]
public void Save()
{
...
}
}
Is this possible?
I found this page, that suggested using Roles for permissions:
[Authorize(Roles = "UserEdit")]
public partial class EditUser : System.Web.UI.Page
{
}
I am not very fond of this solution, but that would also be a possible way to solve things, but what do I need to do to get it working?