A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/InspectorIT/MongoDB.AspNet.Identity below:

maxiomtech/MongoDB.AspNet.Identity: ASP.NET Identity provider that uses MongoDB for storage

ASP.NET Identity provider that users MongoDB for storage

ASP.NET MVC 5 shipped with a new Identity system (in the Microsoft.AspNet.Identity.Core package) in order to support both local login and remote logins via OpenID/OAuth, but only ships with an Entity Framework provider (Microsoft.AspNet.Identity.EntityFramework).

02-11-2014 - [http://blogs.msdn.com/b/webdev/archive/2014/02/11/announcing-preview-of-microsoft-aspnet-identity-2-0-0-beta1.aspx](Microsoft has released Microsoft.AspNet.Identity v2 Beta 1). I will be addressing these issues and introducing them into the MongoDB.AspNet.Identity provider.

These instructions assume you know how to set up MongoDB within an MVC application.

  1. Create a new ASP.NET MVC 5 project, choosing the Individual User Accounts authentication type.
  2. Remove the Entity Framework packages and replace with MongoDB Identity:
Uninstall-Package Microsoft.AspNet.Identity.EntityFramework
Uninstall-Package EntityFramework
Install-Package MongoDB.AspNet.Identity
  1. In ~/Models/IdentityModels.cs:
  2. In ~/Controllers/AccountController.cs
  3. In ~/App_Start/IdentityConfig.cs
  4. In ~/App_Start/Startup.Auth.cs
AccountController requires a parameterless constructor. 
You could instantiate the UserManager in this contructor using any the UserStore constructors.
public AccountController()
{
    //examples
    this.UserManager = 
    new ApplicationUserManager(new UserStore<ApplicationUser>("MyConnection"));
}

The UserStore has multiple constructors for handling connection strings. Here are some examples of the expected inputs and where the connection string should be located.

UserStore<TUser>(string connectionNameOrUrl)

UserStore("Mongo")

web.config

<add name="Mongo" connectionString="Server=localhost:27017;Database={YourDataBase}" />
UserStore<TUser>(string connectionNameOrUrl)

UserStore("Mongo")

web.config

<add name="Mongo" connectionString="mongodb://localhost/{YourDataBase}" />

OR

UserStore<TUser>(string connectionNameOrUrl)

UserStore("mongodb://localhost/{YourDataBase}")

Special thanks to David Boike whos RavenDB AspNet Identity project gave me the base for jumpstarting the MongoDB provider


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4