I am looking for NuGet package that provides similar functionality as the CanCan gem in rails ( https://github.com/ryanb/cancan ).
Does anyone know a plugin that provides a similar functionality? Or a simple way to implement this?
Thanks
CanCanCan is an authorization library for Ruby and Ruby on Rails which restricts what resources a given user is allowed to access.
ASP.NET MVC is a web application framework developed by Microsoft that implements the model–view–controller (MVC) pattern. It is no longer in active development. It is open-source software, apart from the ASP.NET Web Forms component, which is proprietary.
CanCan is an authorization library for Ruby on Rails which restricts what resources a given user is allowed to access. All permissions are defined in a single location (the Ability class) and not duplicated across controllers, views, and database queries.
ASP.NET is a free web framework for building websites and web applications on . NET Framework using HTML, CSS, and JavaScript. ASP.NET MVC 5 is a web framework based on Model-View-Controller (MVC) architecture.
I ended up looking at http://www.develop.com/wifclaimsbasedauthorizationone it does very much as CanCan does.
For example
ClaimsPrincipalPermission.CheckAccess("Customer","Add");
Would check whether the user had permission to add customers.
We are testing http://thinktecture.github.com/Thinktecture.IdentityModel.45/
Basically claims based Authorization for .Net
With MVC5 and One ASP.Net Claims is baked right into the core of .Net
After a long long search I found these essays useful:
http://msdn.microsoft.com/en-us/library/ff359101.aspx
http://www.codeproject.com/Articles/639458/Claims-Based-Authentication-and-Authorization
http://www.codetails.com/punitganshani/using-claims-identity-with-simplemembership-in-asp-net-mvc/20130525
http://leastprivilege.com/
http://www.postsharp.net/aspects/examples/security
UPDATE
latest from Microsoft introduced in 2013 release: http://blogs.msdn.com/b/webdev/archive/2013/06/27/introducing-asp-net-identity-membership-system-for-asp-net-applications.aspx
Samples:
https://stackoverflow.com/a/18751036/316343
https://github.com/rustd/AspnetIdentitySample
http://msdn.microsoft.com/en-us/library/hh377151.aspx
I prefer the one used in CodeProject tutorial which is based on frameworks from Thinktecture guys, source code is available at:
https://github.com/brockallen/BrockAllen.MembershipReboot
https://github.com/thinktecture/Thinktecture.IdentityModel.45
Just remember that the CodeProject article is outdated from the persistence point of view.
Now MembershipReboot support EntityFramework, MongoDB and RavenDB as data store.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With