Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Membership systems for MVC4 that support RavenDB

I create a lot of quick "proof of concept" MVC apps and I actually found the SimpleMembership provider that shipped with the MVC4 templates to be very handy since it gets me up and running with user registration & OAuth in a matter of minutes.

But...I've started to use RavenDb (on RavenHQ for a lot for my projects). So, I starting trying to implement my own "custom membership provider" based on the ExtendedMembershipProvider and while doing that I realized that didn't make much sense. I later stumbled upon 2 interesting projects that try to solve this exact problem:

  • WorldDomination.Web.Auth: https://github.com/PureKrome/WorldDomination.Web.Authentication
  • MemFlex: https://github.com/OdeToCode/Memflex

Both are pretty interesting recent efforts and was wondering if these are the only ones being built right now. I'm essentially looking for nuget pkg that I can drop into a MVC4 app, connect to my RavenDb and be done. I'm willing to build this thing but don't want to duplicate any efforts that are already in motion. Thx!

like image 625
brad oyler Avatar asked Dec 02 '12 03:12

brad oyler


1 Answers

There are several ASP.Net membership providers for RavenDB. None of them are official, and they all have slightly different implementations. Google for "ravendb membership provider" and you will find many.

There is a good article here comparing a few of them with Raven's own authorization and authentication bundles.

I agree with you that it should be easier to swap out SQL for Raven on the various MVC4 templates. However, in addition to relying on the membership provider, they tend to have models that are designed to work with Entity Framework. If you were to write the sample templates from scratch with RavenDB in mind, you'd probably have a very different final product.

Update

I didn't realize you were talking about the new SimpleMembershipProvider. I wasn't aware this existed. I found Jon Galloway's article describing it in detail - a great read. He points out two key points that are relevant here. I quote:

Note that SimpleMembership still requires some flavor of SQL Server - it won't work with MySQL, NoSQL databases, etc. You can take a look at the code in WebMatrix.WebData.dll using a tool like ILSpy if you'd like to see why - there are places where SQL Server specific SQL statements are being executed, especially when creating and initializing tables. It seems like you might be able to work with another database if you created the tables separately, but I haven't tried it and it's not supported at this point.

...

The important thing to take away here is that a SimpleMembershipProvider is a MembershipProvider, but a MembershipProvider is not a SimpleMembershipProvider. This distinction is important in practice: you cannot use an existing MembershipProvider (including the Universal Providers found in System.Web.Providers) with an API that requires a SimpleMembershipProvider, including any of the calls in WebMatrix.WebData.WebSecurity or Microsoft.Web.WebPages.OAuth.OAuthWebSecurity.

I would gather then that writing a SimpleMembershipProvider for RavenDB would not be possible.

like image 116
Matt Johnson-Pint Avatar answered Sep 27 '22 20:09

Matt Johnson-Pint