From e0676292fcc8537fb6a7d3709b36b5963881a981 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Mon, 23 May 2016 13:23:32 -0700 Subject: [PATCH] Add Interop 45 Compat package Initial samples fixes (more coming to make things work) --- Identity.sln | 32 +++- NuGet.config | 2 +- .../Models/ApplicationDbContext.cs | 2 + samples/IdentitySample.Mvc/Program.cs | 24 +++ .../Properties/launchSettings.json | 6 + samples/IdentitySample.Mvc/Startup.cs | 15 +- .../Views/Shared/_Layout.cshtml | 2 +- samples/IdentitySample.Mvc/appsettings.json | 2 +- samples/IdentitySample.Mvc/project.json | 3 +- samples/IdentitySample.Mvc/web.Debug.config | 30 ++++ samples/IdentitySample.Mvc/web.Release.config | 31 ++++ .../App_Start/BundleConfig.cs | 2 +- .../App_Start/FilterConfig.cs | 2 +- .../App_Start/IdentityConfig.cs | 15 +- .../App_Start/RouteConfig.cs | 2 +- .../App_Start/Startup.Auth.cs | 40 +++-- .../Content/Site.css | 0 .../Content/bootstrap.css | 0 .../Content/bootstrap.min.css | 0 .../Controllers/AccountController.cs | 10 +- .../Controllers/HomeController.cs | 2 +- .../Controllers/ManageController.cs | 12 +- samples/{Interop45 => Interop4.5}/Global.asax | 2 +- .../{Interop45 => Interop4.5}/Global.asax.cs | 2 +- .../Interop4.5.csproj} | 149 +++++++----------- .../Models/AccountViewModels.cs | 2 +- .../Models/IdentityModels.cs | 9 +- .../Models/ManageViewModels.cs | 6 +- .../Project_Readme.html | 0 .../Properties/AssemblyInfo.cs | 8 +- .../Scripts/_references.js | Bin .../Scripts/bootstrap.js | 0 .../Scripts/bootstrap.min.js | 0 .../Scripts/jquery-1.10.2.intellisense.js | 16 +- .../Scripts/jquery-1.10.2.js | 0 .../Scripts/jquery-1.10.2.min.js | 0 .../Scripts/jquery-1.10.2.min.map | 0 .../Scripts/jquery.validate-vsdoc.js | 0 .../Scripts/jquery.validate.js | 0 .../Scripts/jquery.validate.min.js | 0 .../Scripts/jquery.validate.unobtrusive.js | 0 .../jquery.validate.unobtrusive.min.js | 0 .../Scripts/modernizr-2.6.2.js | 0 .../Scripts/respond.js | 0 .../Scripts/respond.min.js | 0 samples/{Interop45 => Interop4.5}/Startup.cs | 4 +- .../Views/Account/ConfirmEmail.cshtml | 0 .../Account/ExternalLoginConfirmation.cshtml | 2 +- .../Views/Account/ExternalLoginFailure.cshtml | 0 .../Views/Account/ForgotPassword.cshtml | 2 +- .../Account/ForgotPasswordConfirmation.cshtml | 0 .../Views/Account/Login.cshtml | 2 +- .../Views/Account/Register.cshtml | 2 +- .../Views/Account/ResetPassword.cshtml | 2 +- .../Account/ResetPasswordConfirmation.cshtml | 0 .../Views/Account/SendCode.cshtml | 2 +- .../Views/Account/VerifyCode.cshtml | 2 +- .../Account/_ExternalLoginsListPartial.cshtml | 2 +- .../Views/Home/About.cshtml | 0 .../Views/Home/Contact.cshtml | 0 .../Views/Home/Index.cshtml | 0 .../Views/Manage/AddPhoneNumber.cshtml | 2 +- .../Views/Manage/ChangePassword.cshtml | 2 +- .../Views/Manage/Index.cshtml | 4 +- .../Views/Manage/ManageLogins.cshtml | 2 +- .../Views/Manage/SetPassword.cshtml | 2 +- .../Views/Manage/VerifyPhoneNumber.cshtml | 2 +- .../Views/Shared/Error.cshtml | 0 .../Views/Shared/Lockout.cshtml | 0 .../Views/Shared/_Layout.cshtml | 0 .../Views/Shared/_LoginPartial.cshtml | 2 +- .../Views/Web.config | 2 +- .../Views/_ViewStart.cshtml | 0 .../Web.Debug.config | 0 .../Web.Release.config | 0 samples/{Interop45 => Interop4.5}/Web.config | 16 +- samples/{Interop45 => Interop4.5}/favicon.ico | Bin .../fonts/glyphicons-halflings-regular.eot | Bin .../fonts/glyphicons-halflings-regular.svg | 0 .../fonts/glyphicons-halflings-regular.ttf | Bin .../fonts/glyphicons-halflings-regular.woff | Bin samples/Interop4.5/packages.config | 58 +++++++ samples/Interop45/Migrations/Configuration.cs | 32 ---- samples/Interop45/PostMigration.sql | 6 - samples/Interop45/packages.config | 47 ------ .../CookieInterop.cs | 21 +++ .../IdentityDbContext.cs | 22 ++- .../IdentityRole.cs | 6 +- .../IdentityRoleClaim.cs | 2 +- .../IdentityUser.cs | 22 ++- .../IdentityUserLogin.cs | 6 +- ...Microsoft.AspNet.Identity.CoreCompat.xproj | 19 +++ .../UserStore.cs | 18 +-- .../project.json | 35 ++++ 94 files changed, 460 insertions(+), 316 deletions(-) create mode 100644 samples/IdentitySample.Mvc/Program.cs create mode 100644 samples/IdentitySample.Mvc/web.Debug.config create mode 100644 samples/IdentitySample.Mvc/web.Release.config rename samples/{Interop45 => Interop4.5}/App_Start/BundleConfig.cs (98%) rename samples/{Interop45 => Interop4.5}/App_Start/FilterConfig.cs (91%) rename samples/{Interop45 => Interop4.5}/App_Start/IdentityConfig.cs (91%) rename samples/{Interop45 => Interop4.5}/App_Start/RouteConfig.cs (96%) rename samples/{Interop45 => Interop4.5}/App_Start/Startup.Auth.cs (74%) rename samples/{Interop45 => Interop4.5}/Content/Site.css (100%) rename samples/{Interop45 => Interop4.5}/Content/bootstrap.css (100%) rename samples/{Interop45 => Interop4.5}/Content/bootstrap.min.css (100%) rename samples/{Interop45 => Interop4.5}/Controllers/AccountController.cs (99%) rename samples/{Interop45 => Interop4.5}/Controllers/HomeController.cs (93%) rename samples/{Interop45 => Interop4.5}/Controllers/ManageController.cs (98%) rename samples/{Interop45 => Interop4.5}/Global.asax (62%) rename samples/{Interop45 => Interop4.5}/Global.asax.cs (96%) rename samples/{Interop45/Interop45.csproj => Interop4.5/Interop4.5.csproj} (70%) rename samples/{Interop45 => Interop4.5}/Models/AccountViewModels.cs (99%) rename samples/{Interop45 => Interop4.5}/Models/IdentityModels.cs (83%) rename samples/{Interop45 => Interop4.5}/Models/ManageViewModels.cs (96%) rename samples/{Interop45 => Interop4.5}/Project_Readme.html (100%) rename samples/{Interop45 => Interop4.5}/Properties/AssemblyInfo.cs (85%) rename samples/{Interop45 => Interop4.5}/Scripts/_references.js (100%) rename samples/{Interop45 => Interop4.5}/Scripts/bootstrap.js (100%) rename samples/{Interop45 => Interop4.5}/Scripts/bootstrap.min.js (100%) rename samples/{Interop45 => Interop4.5}/Scripts/jquery-1.10.2.intellisense.js (99%) rename samples/{Interop45 => Interop4.5}/Scripts/jquery-1.10.2.js (100%) rename samples/{Interop45 => Interop4.5}/Scripts/jquery-1.10.2.min.js (100%) rename samples/{Interop45 => Interop4.5}/Scripts/jquery-1.10.2.min.map (100%) rename samples/{Interop45 => Interop4.5}/Scripts/jquery.validate-vsdoc.js (100%) rename samples/{Interop45 => Interop4.5}/Scripts/jquery.validate.js (100%) rename samples/{Interop45 => Interop4.5}/Scripts/jquery.validate.min.js (100%) rename samples/{Interop45 => Interop4.5}/Scripts/jquery.validate.unobtrusive.js (100%) rename samples/{Interop45 => Interop4.5}/Scripts/jquery.validate.unobtrusive.min.js (100%) rename samples/{Interop45 => Interop4.5}/Scripts/modernizr-2.6.2.js (100%) rename samples/{Interop45 => Interop4.5}/Scripts/respond.js (100%) rename samples/{Interop45 => Interop4.5}/Scripts/respond.min.js (100%) rename samples/{Interop45 => Interop4.5}/Startup.cs (69%) rename samples/{Interop45 => Interop4.5}/Views/Account/ConfirmEmail.cshtml (100%) rename samples/{Interop45 => Interop4.5}/Views/Account/ExternalLoginConfirmation.cshtml (95%) rename samples/{Interop45 => Interop4.5}/Views/Account/ExternalLoginFailure.cshtml (100%) rename samples/{Interop45 => Interop4.5}/Views/Account/ForgotPassword.cshtml (93%) rename samples/{Interop45 => Interop4.5}/Views/Account/ForgotPasswordConfirmation.cshtml (100%) rename samples/{Interop45 => Interop4.5}/Views/Account/Login.cshtml (98%) rename samples/{Interop45 => Interop4.5}/Views/Account/Register.cshtml (96%) rename samples/{Interop45 => Interop4.5}/Views/Account/ResetPassword.cshtml (96%) rename samples/{Interop45 => Interop4.5}/Views/Account/ResetPasswordConfirmation.cshtml (100%) rename samples/{Interop45 => Interop4.5}/Views/Account/SendCode.cshtml (93%) rename samples/{Interop45 => Interop4.5}/Views/Account/VerifyCode.cshtml (96%) rename samples/{Interop45 => Interop4.5}/Views/Account/_ExternalLoginsListPartial.cshtml (95%) rename samples/{Interop45 => Interop4.5}/Views/Home/About.cshtml (100%) rename samples/{Interop45 => Interop4.5}/Views/Home/Contact.cshtml (100%) rename samples/{Interop45 => Interop4.5}/Views/Home/Index.cshtml (100%) rename samples/{Interop45 => Interop4.5}/Views/Manage/AddPhoneNumber.cshtml (93%) rename samples/{Interop45 => Interop4.5}/Views/Manage/ChangePassword.cshtml (96%) rename samples/{Interop45 => Interop4.5}/Views/Manage/Index.cshtml (97%) rename samples/{Interop45 => Interop4.5}/Views/Manage/ManageLogins.cshtml (98%) rename samples/{Interop45 => Interop4.5}/Views/Manage/SetPassword.cshtml (96%) rename samples/{Interop45 => Interop4.5}/Views/Manage/VerifyPhoneNumber.cshtml (94%) rename samples/{Interop45 => Interop4.5}/Views/Shared/Error.cshtml (100%) rename samples/{Interop45 => Interop4.5}/Views/Shared/Lockout.cshtml (100%) rename samples/{Interop45 => Interop4.5}/Views/Shared/_Layout.cshtml (100%) rename samples/{Interop45 => Interop4.5}/Views/Shared/_LoginPartial.cshtml (95%) rename samples/{Interop45 => Interop4.5}/Views/Web.config (97%) rename samples/{Interop45 => Interop4.5}/Views/_ViewStart.cshtml (100%) rename samples/{Interop45 => Interop4.5}/Web.Debug.config (100%) rename samples/{Interop45 => Interop4.5}/Web.Release.config (100%) rename samples/{Interop45 => Interop4.5}/Web.config (82%) rename samples/{Interop45 => Interop4.5}/favicon.ico (100%) rename samples/{Interop45 => Interop4.5}/fonts/glyphicons-halflings-regular.eot (100%) rename samples/{Interop45 => Interop4.5}/fonts/glyphicons-halflings-regular.svg (100%) rename samples/{Interop45 => Interop4.5}/fonts/glyphicons-halflings-regular.ttf (100%) rename samples/{Interop45 => Interop4.5}/fonts/glyphicons-halflings-regular.woff (100%) create mode 100644 samples/Interop4.5/packages.config delete mode 100644 samples/Interop45/Migrations/Configuration.cs delete mode 100644 samples/Interop45/PostMigration.sql delete mode 100644 samples/Interop45/packages.config create mode 100644 src/Microsoft.AspNet.Identity.CoreCompat/CookieInterop.cs rename samples/Interop45/Compat/CompatDbContext.cs => src/Microsoft.AspNet.Identity.CoreCompat/IdentityDbContext.cs (82%) rename samples/Interop45/Compat/CompatRole.cs => src/Microsoft.AspNet.Identity.CoreCompat/IdentityRole.cs (85%) rename samples/Interop45/Compat/CompatRoleClaim.cs => src/Microsoft.AspNet.Identity.CoreCompat/IdentityRoleClaim.cs (95%) rename samples/Interop45/Compat/CompatUser.cs => src/Microsoft.AspNet.Identity.CoreCompat/IdentityUser.cs (71%) rename samples/Interop45/Compat/CompatUserLogin.cs => src/Microsoft.AspNet.Identity.CoreCompat/IdentityUserLogin.cs (80%) create mode 100644 src/Microsoft.AspNet.Identity.CoreCompat/Microsoft.AspNet.Identity.CoreCompat.xproj rename samples/Interop45/Compat/CompatUserStore.cs => src/Microsoft.AspNet.Identity.CoreCompat/UserStore.cs (65%) create mode 100644 src/Microsoft.AspNet.Identity.CoreCompat/project.json diff --git a/Identity.sln b/Identity.sln index 1eac0bdf30..0cb74460ed 100644 --- a/Identity.sln +++ b/Identity.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 +VisualStudioVersion = 14.0.25123.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0F647068-6602-4E24-B1DC-8ED91481A50A}" EndProject @@ -27,6 +27,10 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Identi EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Identity.EntityFrameworkCore", "src\Microsoft.AspNetCore.Identity.EntityFrameworkCore\Microsoft.AspNetCore.Identity.EntityFrameworkCore.xproj", "{4490894C-3572-4E63-86F1-EE5105CE8A06}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Interop4.5", "samples\Interop4.5\Interop4.5.csproj", "{4D30B14B-20FC-4DDA-97C5-B32D13FE2578}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Identity.CoreCompat", "src\Microsoft.AspNet.Identity.CoreCompat\Microsoft.AspNet.Identity.CoreCompat.xproj", "{6A74C6EA-B241-4D6B-BCE4-BF89EC1D2475}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -107,6 +111,30 @@ Global {4490894C-3572-4E63-86F1-EE5105CE8A06}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {4490894C-3572-4E63-86F1-EE5105CE8A06}.Release|Mixed Platforms.Build.0 = Release|Any CPU {4490894C-3572-4E63-86F1-EE5105CE8A06}.Release|x86.ActiveCfg = Release|Any CPU + {4D30B14B-20FC-4DDA-97C5-B32D13FE2578}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4D30B14B-20FC-4DDA-97C5-B32D13FE2578}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4D30B14B-20FC-4DDA-97C5-B32D13FE2578}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {4D30B14B-20FC-4DDA-97C5-B32D13FE2578}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {4D30B14B-20FC-4DDA-97C5-B32D13FE2578}.Debug|x86.ActiveCfg = Debug|Any CPU + {4D30B14B-20FC-4DDA-97C5-B32D13FE2578}.Debug|x86.Build.0 = Debug|Any CPU + {4D30B14B-20FC-4DDA-97C5-B32D13FE2578}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4D30B14B-20FC-4DDA-97C5-B32D13FE2578}.Release|Any CPU.Build.0 = Release|Any CPU + {4D30B14B-20FC-4DDA-97C5-B32D13FE2578}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {4D30B14B-20FC-4DDA-97C5-B32D13FE2578}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {4D30B14B-20FC-4DDA-97C5-B32D13FE2578}.Release|x86.ActiveCfg = Release|Any CPU + {4D30B14B-20FC-4DDA-97C5-B32D13FE2578}.Release|x86.Build.0 = Release|Any CPU + {6A74C6EA-B241-4D6B-BCE4-BF89EC1D2475}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6A74C6EA-B241-4D6B-BCE4-BF89EC1D2475}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6A74C6EA-B241-4D6B-BCE4-BF89EC1D2475}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {6A74C6EA-B241-4D6B-BCE4-BF89EC1D2475}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {6A74C6EA-B241-4D6B-BCE4-BF89EC1D2475}.Debug|x86.ActiveCfg = Debug|Any CPU + {6A74C6EA-B241-4D6B-BCE4-BF89EC1D2475}.Debug|x86.Build.0 = Debug|Any CPU + {6A74C6EA-B241-4D6B-BCE4-BF89EC1D2475}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6A74C6EA-B241-4D6B-BCE4-BF89EC1D2475}.Release|Any CPU.Build.0 = Release|Any CPU + {6A74C6EA-B241-4D6B-BCE4-BF89EC1D2475}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {6A74C6EA-B241-4D6B-BCE4-BF89EC1D2475}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {6A74C6EA-B241-4D6B-BCE4-BF89EC1D2475}.Release|x86.ActiveCfg = Release|Any CPU + {6A74C6EA-B241-4D6B-BCE4-BF89EC1D2475}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -119,5 +147,7 @@ Global {37236EA3-915D-46D5-997C-DF513C500E4B} = {52D59F18-62D2-4D17-8CF2-BE192445AF8E} {EA7EB28F-53B8-4009-9C6B-74DB090CA8DD} = {52D59F18-62D2-4D17-8CF2-BE192445AF8E} {4490894C-3572-4E63-86F1-EE5105CE8A06} = {0F647068-6602-4E24-B1DC-8ED91481A50A} + {4D30B14B-20FC-4DDA-97C5-B32D13FE2578} = {58D94A0E-C2B7-43A7-8826-99ECBB1E0A50} + {6A74C6EA-B241-4D6B-BCE4-BF89EC1D2475} = {0F647068-6602-4E24-B1DC-8ED91481A50A} EndGlobalSection EndGlobal diff --git a/NuGet.config b/NuGet.config index 52bf414192..5500f6d507 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,4 +1,4 @@ - + diff --git a/samples/IdentitySample.Mvc/Models/ApplicationDbContext.cs b/samples/IdentitySample.Mvc/Models/ApplicationDbContext.cs index 50a6911a74..902414c46c 100644 --- a/samples/IdentitySample.Mvc/Models/ApplicationDbContext.cs +++ b/samples/IdentitySample.Mvc/Models/ApplicationDbContext.cs @@ -9,6 +9,8 @@ namespace IdentitySample.Models { public class ApplicationDbContext : IdentityDbContext { + public ApplicationDbContext(DbContextOptions options) : base(options) { } + protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); diff --git a/samples/IdentitySample.Mvc/Program.cs b/samples/IdentitySample.Mvc/Program.cs new file mode 100644 index 0000000000..b186e6812d --- /dev/null +++ b/samples/IdentitySample.Mvc/Program.cs @@ -0,0 +1,24 @@ +using System.IO; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; + +namespace IdentitySample +{ + public static class Program + { + public static void Main(string[] args) + { + var config = new ConfigurationBuilder().AddEnvironmentVariables("ASPNETCORE_").Build(); + + var host = new WebHostBuilder() + .UseKestrel() + .UseConfiguration(config) + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseIISIntegration() + .UseStartup() + .Build(); + + host.Run(); + } + } +} \ No newline at end of file diff --git a/samples/IdentitySample.Mvc/Properties/launchSettings.json b/samples/IdentitySample.Mvc/Properties/launchSettings.json index cf11afc04f..485fe8532f 100644 --- a/samples/IdentitySample.Mvc/Properties/launchSettings.json +++ b/samples/IdentitySample.Mvc/Properties/launchSettings.json @@ -14,6 +14,12 @@ "environmentVariables": { "ASPNET_ENVIRONMENT": "Development" } + }, + "web": { + "commandName": "web", + "environmentVariables": { + "ASPNET_ENVIRONMENT": "Development" + } } } } \ No newline at end of file diff --git a/samples/IdentitySample.Mvc/Startup.cs b/samples/IdentitySample.Mvc/Startup.cs index 8d0a690e0f..91a0a774e4 100644 --- a/samples/IdentitySample.Mvc/Startup.cs +++ b/samples/IdentitySample.Mvc/Startup.cs @@ -23,6 +23,7 @@ namespace IdentitySample { // Set up configuration sources. var builder = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); @@ -47,8 +48,8 @@ namespace IdentitySample services.AddIdentity(options => { options.Cookies.ApplicationCookie.AuthenticationScheme = "ApplicationCookie"; - options.Cookies.ApplicationCookie.DataProtectionProvider = DataProtectionProvider.Create(new DirectoryInfo("C:\\Github\\Identity\\artifacts")); options.Cookies.ApplicationCookie.CookieName = "Interop"; + options.Cookies.ApplicationCookie.DataProtectionProvider = DataProtectionProvider.Create(new DirectoryInfo("C:\\Github\\Identity\\artifacts")); }) .AddEntityFrameworkStores() .AddDefaultTokenProviders(); @@ -114,18 +115,6 @@ namespace IdentitySample template: "{controller=Home}/{action=Index}/{id?}"); }); } - - // Entry point for the application. - public static void Main(string[] args) - { - var host = new WebHostBuilder() - .UseKestrel() - .UseIISIntegration() - .UseStartup() - .Build(); - - host.Run(); - } } } diff --git a/samples/IdentitySample.Mvc/Views/Shared/_Layout.cshtml b/samples/IdentitySample.Mvc/Views/Shared/_Layout.cshtml index f5869ac96a..912a38b7a3 100644 --- a/samples/IdentitySample.Mvc/Views/Shared/_Layout.cshtml +++ b/samples/IdentitySample.Mvc/Views/Shared/_Layout.cshtml @@ -17,7 +17,7 @@ - $safeprojectname$ + Identity Sample