Demo site: http://rolemanager.neohe.com/RoleManager#/
This project provides a functionality that can authorize roles to controllers/actions dynamically via a web page.
It is using Asp.net MVC, Identity framework, OAuth security, Token/Claims based authentication/authorization, Owin, Web Api2 and Angular.js.
Asp.net mvc provides an authorization featuers based on roles/users for controllers and actions. But the roles/actions are hard coded in the code. For example:
[Authorize(Roles = "Admin")] public Class MyController : Controller {
}
Only Admin role is authorized to use this controller. It's hardcoded.
The project will provide a generic function with a web page that authorize roles/uers for controllers and actions. These setinggs will be saved to database or a file.
- Angular.js, bootstrap, angular ui bootstrap, angular schema form. Try to avoid jquery.
- ASP.NET mvc, web api 2, entityframe work 6, identity framework
- SQL server. Mysql and more types of databases later.
- Add config.Filters.Add(new ApiAuthoraiztionFilter()); to App_Start\WebApiConfig.cs file to enable web api authorization;
- Add filters.Add(new HandleErrorAttribute()); to App_Start\FilterConfig.cs to enable MVC web page authorization;
- Copy Areas/RoleManager folder to the root of your project. MvcRoleManager resides only in this folder .
- The project will create two new tables, Action and ActionRoles. Action stores actions of controllers that need to be authorized; ActionRoles have the links between Actions and Roles.
- Configuration page locates at http://yourproject/RoleManager/ .
SCREENSHOT SCREENSHOT1
- Download the code and open in Visual Studio.
- Restore dependency files and change the database connection string in web.config.
- Build the solution and you are good for a test ride.
Any questions, create an issue or email: popman.he@gmail.com.