การกำหนดค่า Identity ให้กับโครงการที่มีอยู่ไม่ใช่เรื่องยาก คุณต้องติดตั้งแพคเกจ NuGet และทำการกำหนดค่าเล็กน้อย
ก่อนติดตั้งแพ็คเกจ NuGet เหล่านี้ด้วย Package Manager Console:
PM> Install-Package Microsoft.AspNet.Identity.Owin 
PM> Install-Package Microsoft.AspNet.Identity.EntityFramework
PM> Install-Package Microsoft.Owin.Host.SystemWeb 
เพิ่มคลาสผู้ใช้และด้วยการIdentityUserสืบทอด:
public class AppUser : IdentityUser
{
    //add your custom properties which have not included in IdentityUser before
    public string MyExtraProperty { get; set; }  
}
ทำสิ่งเดียวกันสำหรับบทบาท:
public class AppRole : IdentityRole
{
    public AppRole() : base() { }
    public AppRole(string name) : base(name) { }
    // extra properties here 
}
เปลี่ยนDbContextผู้ปกครองของคุณจากDbContextเป็นIdentityDbContext<AppUser>เช่นนี้:
public class MyDbContext : IdentityDbContext<AppUser>
{
    // Other part of codes still same 
    // You don't need to add AppUser and AppRole 
    // since automatically added by inheriting form IdentityDbContext<AppUser>
}
หากคุณใช้สตริงการเชื่อมต่อเดียวกันและการย้ายข้อมูลที่เปิดใช้งาน EF จะสร้างตารางที่จำเป็นสำหรับคุณ
คุณสามารถขยายUserManagerเพื่อเพิ่มการกำหนดค่าและการปรับแต่งที่คุณต้องการ:
public class AppUserManager : UserManager<AppUser>
{
    public AppUserManager(IUserStore<AppUser> store)
        : base(store)
    {
    }
    // this method is called by Owin therefore this is the best place to configure your User Manager
    public static AppUserManager Create(
        IdentityFactoryOptions<AppUserManager> options, IOwinContext context)
    {
        var manager = new AppUserManager(
            new UserStore<AppUser>(context.Get<MyDbContext>()));
        // optionally configure your manager
        // ...
        return manager;
    }
}
เนื่องจาก Identity นั้นใช้ OWIN คุณจึงต้องทำการกำหนดค่า OWIN ด้วย:
เพิ่มคลาสไปยังApp_Startโฟลเดอร์ (หรือที่อื่นถ้าคุณต้องการ) คลาสนี้ถูกใช้โดย OWIN นี่จะเป็นคลาสเริ่มต้นของคุณ
namespace MyAppNamespace
{
    public class IdentityConfig
    {
        public void Configuration(IAppBuilder app)
        {
            app.CreatePerOwinContext(() => new MyDbContext());
            app.CreatePerOwinContext<AppUserManager>(AppUserManager.Create);
            app.CreatePerOwinContext<RoleManager<AppRole>>((options, context) =>
                new RoleManager<AppRole>(
                    new RoleStore<AppRole>(context.Get<MyDbContext>())));
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Home/Login"),
            });
        }
    }
}
เกือบเสร็จแล้วเพียงเพิ่มรหัสบรรทัดนี้ลงในweb.configไฟล์ของคุณเพื่อให้ OWIN สามารถหาคลาสเริ่มต้นของคุณได้
<appSettings>
    <!-- other setting here -->
    <add key="owin:AppStartup" value="MyAppNamespace.IdentityConfig" />
</appSettings>
ตอนนี้ในโครงการทั้งหมดคุณสามารถใช้ Identity เช่นเดียวกับโครงการใหม่ใด ๆ ที่ติดตั้งแล้วโดย VS พิจารณาการดำเนินการเข้าสู่ระบบเช่น
[HttpPost]
public ActionResult Login(LoginViewModel login)
{
    if (ModelState.IsValid)
    {
        var userManager = HttpContext.GetOwinContext().GetUserManager<AppUserManager>();
        var authManager = HttpContext.GetOwinContext().Authentication;
        AppUser user = userManager.Find(login.UserName, login.Password);
        if (user != null)
        {
            var ident = userManager.CreateIdentity(user, 
                DefaultAuthenticationTypes.ApplicationCookie);
            //use the instance that has been created. 
            authManager.SignIn(
                new AuthenticationProperties { IsPersistent = false }, ident);
            return Redirect(login.ReturnUrl ?? Url.Action("Index", "Home"));
        }
    }
    ModelState.AddModelError("", "Invalid username or password");
    return View(login);
}
คุณสามารถสร้างบทบาทและเพิ่มให้กับผู้ใช้ของคุณ:
public ActionResult CreateRole(string roleName)
{
    var roleManager=HttpContext.GetOwinContext().GetUserManager<RoleManager<AppRole>>();
    if (!roleManager.RoleExists(roleName))
        roleManager.Create(new AppRole(roleName));
    // rest of code
} 
คุณสามารถเพิ่มบทบาทให้กับผู้ใช้เช่นนี้:
UserManager.AddToRole(UserManager.FindByName("username").Id, "roleName");
โดยการใช้Authorizeคุณสามารถป้องกันการกระทำหรือตัวควบคุมของคุณ:
[Authorize]
public ActionResult MySecretAction() {}
หรือ 
[Authorize(Roles = "Admin")]]
public ActionResult MySecretAction() {}
คุณยังสามารถติดตั้งแพ็คเกจเพิ่มเติมและกำหนดค่าให้ตรงกับความต้องการของคุณเช่นMicrosoft.Owin.Security.Facebookหรืออะไรก็ได้ที่คุณต้องการ  
หมายเหตุ:อย่าลืมเพิ่มเนมสเปซที่เกี่ยวข้องลงในไฟล์ของคุณ:
using Microsoft.AspNet.Identity;
using Microsoft.Owin.Security;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Owin;
คุณสามารถเห็นคำตอบอื่น ๆ ของฉันเช่นนี้และสิ่งนี้สำหรับการใช้ Identity ขั้นสูง