0

I currently have a site that is using a handrolled authentication system of usernames and passwords - I do not have the ability to change the current database tables which store the usernames and passwords (the system has been in place for a long time).

Is it possible to use the new asp.net Identity system with existing data? Mapping the columns somehow? I have not seen anything like that in the documentation.

Steve French
  • 961
  • 3
  • 13
  • 38
  • If you're using SQL Membership database, there's a tutorial on this: http://www.asp.net/identity/overview/migrations/migrating-an-existing-website-from-sql-membership-to-aspnet-identity. Otherwise you may be required to implement your own provider, which might be overkill. – Brendan Green May 05 '14 at 13:13
  • It is not asp.net membership, sadly - it is not a bad handmade memberhsip system, but it is eight years old and the author is no longer with the company. – Steve French May 05 '14 at 15:12

1 Answers1

0

Mapping to the table is the easy part. Its the password encryption/decryption that will be difficult.

You might have to do a permissions migration over to claims or roles.

You simply create a user class with all the fields that match your current db table, and you'll have to add the new ones required by identity 2.0.

var mgr = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>());

public class ApplicationUser : IdentityUser
{
      public string allMyNewFields {get; set;}
}

you will have to implement IPasswordHasher to get the passwords stuff.

Microsoft.AspNet.Identity.PasswordHasher : IPasswordHasher

checkout Asp.net Identity password hashing

good luck

Community
  • 1
  • 1
William
  • 1,375
  • 12
  • 27