Git Product home page Git Product logo

mysqlidentity's Introduction

MySql.AspNet.Identity

An ASP.NET Identity 2.1 provider for MySql

Purpose

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).

Features

  • Supports ASP.NET Identity 2.1

  • Contains the same IdentityUser class used by the EntityFramework provider in the MVC 5 project template.

  • Contains the same IdentityRole class used by the EntityFramework provider in the MVC 5 project template.

  • Supports additional profile properties on your application's user model.

  • Provides MySqlUserStore implementation that implements the same interfaces as the EntityFramework version:

    • IUserStore,
    • IUserLoginStore,
    • IUserClaimStore,
    • IUserRoleStore,
    • IUserPasswordStore,
    • IUserSecurityStampStore,
    • IUserEmailStore,
    • IUserLockoutStore<TUser, string>,
    • IUserTwoFactorStore<TUser, string>,
    • IUserPhoneNumberStore

Instructions

For more detailed instructions read this blog post : ASP.NET Identity 2.1 implementation for MySQL

You will need to execute create script on your MySQL database which will create the tables required for the ASP.NET Identity provider.

  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 MySql.AspNet.Identity.

    • Uninstall-Package Microsoft.AspNet.Identity.EntityFramework
    • Uninstall-Package EntityFramework
  3. Install-Package MySql.AspNet.Identity

  4. In ~/Models/IdentityModels.cs:

    • Remove the namespaces:
      • Microsoft.AspNet.Identity.EntityFramework
      • System.Data.Entity
  5. Install NuGet Package called MySql.AspNet.Identity

    • Add the namespace: MySql.AspNet.Identity This way ApplicationUser will inherit from another IdentityUser which resides in MySql.Asp.Net.Identity namespace
    • Remove the entire ApplicationDbContext class. You don't need that!
  6. In ~/App_Start/Startup.Auth.cs

    • Remove app.CreatePerOwinContext(ApplicationDbContext.Create);
  7. In ~/App_Start/IdentityConfig.cs

    • Remove the namespaces:
      • Microsoft.AspNet.Identity.EntityFramework
      • System.Data.Entity
    • In method public static ApplicationUserManager Create(IdentityFactoryOptions options, IOwinContext context) replace ApplicationUserManager with another which accepts MySqlUserStore like this:
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context) 
{
     // var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(context.Get<ApplicationDbContext>()));
     var manager = new ApplicationUserManager(new MySqlUserStore<ApplicationUser>());
	 

mysqlidentity's People

Contributors

radenkozec avatar vkoppaka avatar ajxcodes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.