From 826ed7504bb146ab8179f12fc4bb5a8dc950b317 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 13 Aug 2019 08:53:41 +0200 Subject: [PATCH] [ApiAuthorization] Update to latest oidc-client and IdentityServer4 versions [ApiAuthorization] Updates dependency versions * Updates to the latest version of Identity Server. * Updates to the latest version of oidc-client. * Removes unncessary code from the templates. * Updates EF migrations. * Removes unnecessary ref assembly. --- eng/ProjectReferences.props | 2 +- eng/Versions.props | 10 +- ...ore.ApiAuthorization.IdentityServer.csproj | 18 -- ...horization.IdentityServer.netcoreapp3.0.cs | 160 ------------------ .../ApiAuthSample/ApiAuthSample.csproj | 5 + ...ore.ApiAuthorization.IdentityServer.csproj | 12 +- ...iAuthorization.IdentityServer.Tests.csproj | 6 + .../Angular-CSharp.csproj.in | 1 + ...oft.DotNet.Web.Spa.ProjectTemplates.csproj | 1 + .../React-CSharp.csproj.in | 1 + .../ClientApp/package-lock.json | 17 +- .../Angular-CSharp/ClientApp/package.json | 2 +- .../api-authorization/authorize.service.ts | 110 +++--------- .../login/login.component.ts | 4 - .../logout/logout.component.ts | 3 - ...000000000_CreateIdentitySchema.Designer.cs | 117 +++++++++---- .../00000000000000_CreateIdentitySchema.cs | 14 +- .../ApplicationDbContextModelSnapshot.cs | 115 +++++++++---- ...000000000_CreateIdentitySchema.Designer.cs | 119 +++++++++---- .../00000000000000_CreateIdentitySchema.cs | 9 +- .../ApplicationDbContextModelSnapshot.cs | 119 +++++++++---- .../content/Angular-CSharp/app.db | Bin 131072 -> 131072 bytes .../React-CSharp/ClientApp/package-lock.json | 21 ++- .../React-CSharp/ClientApp/package.json | 2 +- .../api-authorization/AuthorizeService.js | 95 +++-------- .../src/components/api-authorization/Login.js | 4 - .../components/api-authorization/Logout.js | 3 - ...000000000_CreateIdentitySchema.Designer.cs | 117 +++++++++---- .../00000000000000_CreateIdentitySchema.cs | 16 +- .../ApplicationDbContextModelSnapshot.cs | 115 +++++++++---- ...000000000_CreateIdentitySchema.Designer.cs | 119 +++++++++---- .../00000000000000_CreateIdentitySchema.cs | 9 +- .../ApplicationDbContextModelSnapshot.cs | 119 +++++++++---- .../content/React-CSharp/app.db | Bin 131072 -> 131072 bytes src/ProjectTemplates/test/Helpers/Project.cs | 3 + .../test/ProjectTemplates.Tests.csproj | 6 +- .../SpaTemplateTest/SpaTemplateTestBase.cs | 2 +- 37 files changed, 836 insertions(+), 640 deletions(-) delete mode 100644 src/Identity/ApiAuthorization.IdentityServer/ref/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj delete mode 100644 src/Identity/ApiAuthorization.IdentityServer/ref/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.netcoreapp3.0.cs diff --git a/eng/ProjectReferences.props b/eng/ProjectReferences.props index 1830293e0d..9bdbb3ec7b 100644 --- a/eng/ProjectReferences.props +++ b/eng/ProjectReferences.props @@ -5,6 +5,7 @@ --> + @@ -44,7 +45,6 @@ - diff --git a/eng/Versions.props b/eng/Versions.props index 71b66d08a9..648fe409f8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -222,11 +222,11 @@ 4.2.1 3.8.0 0.1.22-pre3 - 3.0.0-preview3.4 - 3.0.0-preview3.4 - 3.0.0-preview3.4 - 3.0.0-preview3.4 - 3.0.0-preview3.4 + 3.0.0-preview7.33 + 3.0.0-preview7.33 + 3.0.0-preview7.33 + 3.0.0-preview7.33 + 3.0.0-preview7.33 1.7.3.7 4.10.0 0.10.1 diff --git a/src/Identity/ApiAuthorization.IdentityServer/ref/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj b/src/Identity/ApiAuthorization.IdentityServer/ref/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj deleted file mode 100644 index ee37205aff..0000000000 --- a/src/Identity/ApiAuthorization.IdentityServer/ref/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - netcoreapp3.0 - - - - - - - - - - - - - - diff --git a/src/Identity/ApiAuthorization.IdentityServer/ref/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.netcoreapp3.0.cs b/src/Identity/ApiAuthorization.IdentityServer/ref/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.netcoreapp3.0.cs deleted file mode 100644 index 63439f559a..0000000000 --- a/src/Identity/ApiAuthorization.IdentityServer/ref/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.netcoreapp3.0.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer -{ - public partial class ApiAuthorizationDbContext : Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityDbContext, IdentityServer4.EntityFramework.Interfaces.IPersistedGrantDbContext, System.IDisposable where TUser : Microsoft.AspNetCore.Identity.IdentityUser - { - public ApiAuthorizationDbContext(Microsoft.EntityFrameworkCore.DbContextOptions options, Microsoft.Extensions.Options.IOptions operationalStoreOptions) { } - public Microsoft.EntityFrameworkCore.DbSet DeviceFlowCodes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.EntityFrameworkCore.DbSet PersistedGrants { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - System.Threading.Tasks.Task IdentityServer4.EntityFramework.Interfaces.IPersistedGrantDbContext.SaveChangesAsync() { throw null; } - protected override void OnModelCreating(Microsoft.EntityFrameworkCore.ModelBuilder builder) { } - } - public partial class ApiAuthorizationOptions - { - public ApiAuthorizationOptions() { } - public Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceCollection ApiResources { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection Clients { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceCollection IdentityResources { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.IdentityModel.Tokens.SigningCredentials SigningCredential { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public partial class ApiResourceBuilder - { - public ApiResourceBuilder() { } - public ApiResourceBuilder(IdentityServer4.Models.ApiResource resource) { } - public Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceBuilder AllowAllClients() { throw null; } - public static Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceBuilder ApiResource(string name) { throw null; } - public IdentityServer4.Models.ApiResource Build() { throw null; } - public static Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceBuilder IdentityServerJwt(string name) { throw null; } - public Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceBuilder ReplaceScopes(params string[] resourceScopes) { throw null; } - public Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceBuilder WithApplicationProfile(string profile) { throw null; } - public Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceBuilder WithScopes(params string[] resourceScopes) { throw null; } - } - public partial class ApiResourceCollection : System.Collections.ObjectModel.Collection - { - public ApiResourceCollection() { } - public ApiResourceCollection(System.Collections.Generic.IList list) { } - public IdentityServer4.Models.ApiResource this[string key] { get { throw null; } } - public void AddApiResource(string name, System.Action configure) { } - public void AddIdentityServerJwt(string name, System.Action configure) { } - public void AddRange(params IdentityServer4.Models.ApiResource[] resources) { } - } - public static partial class ApplicationProfiles - { - public const string API = "API"; - public const string IdentityServerJwt = "IdentityServerJwt"; - public const string IdentityServerSPA = "IdentityServerSPA"; - public const string NativeApp = "NativeApp"; - public const string SPA = "SPA"; - } - public static partial class ApplicationProfilesPropertyNames - { - public const string Clients = "Clients"; - public const string Profile = "Profile"; - public const string Source = "Source"; - } - public static partial class ApplicationProfilesPropertyValues - { - public const string AllowAllApplications = "*"; - public const string Configuration = "Configuration"; - public const string Default = "Default"; - } - public partial class ClientBuilder - { - public ClientBuilder() { } - public ClientBuilder(IdentityServer4.Models.Client client) { } - public IdentityServer4.Models.Client Build() { throw null; } - public static Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder IdentityServerSPA(string clientId) { throw null; } - public static Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder NativeApp(string clientId) { throw null; } - public static Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder SPA(string clientId) { throw null; } - public Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder WithApplicationProfile(string profile) { throw null; } - public Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder WithClientId(string clientId) { throw null; } - public Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder WithLogoutRedirectUri(string logoutUri) { throw null; } - public Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder WithoutClientSecrets() { throw null; } - public Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder WithRedirectUri(string redirectUri) { throw null; } - public Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder WithScopes(params string[] scopes) { throw null; } - } - public partial class ClientCollection : System.Collections.ObjectModel.Collection - { - public ClientCollection() { } - public ClientCollection(System.Collections.Generic.IList list) { } - public IdentityServer4.Models.Client this[string key] { get { throw null; } } - public void AddIdentityServerSPA(string clientId, System.Action configure) { } - public void AddNativeApp(string clientId, System.Action configure) { } - public void AddRange(params IdentityServer4.Models.Client[] clients) { } - public void AddSPA(string clientId, System.Action configure) { } - } - [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("*", Attributes="[asp-apiauth-parameters]")] - public partial class ClientParametersTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper - { - public ClientParametersTagHelper(Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IClientRequestParametersProvider clientRequestParametersProvider) { } - [Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute("asp-apiauth-parameters")] - public string ClientId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [Microsoft.AspNetCore.Mvc.ViewFeatures.ViewContextAttribute] - public Microsoft.AspNetCore.Mvc.Rendering.ViewContext ViewContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override void Process(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext context, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput output) { } - } - public partial interface IClientRequestParametersProvider - { - System.Collections.Generic.IDictionary GetClientParameters(Microsoft.AspNetCore.Http.HttpContext context, string clientId); - } - public partial class IdentityResourceBuilder - { - public IdentityResourceBuilder() { } - public IdentityResourceBuilder(IdentityServer4.Models.IdentityResource resource) { } - public static Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder Address() { throw null; } - public Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder AllowAllClients() { throw null; } - public IdentityServer4.Models.IdentityResource Build() { throw null; } - public static Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder Email() { throw null; } - public static Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder OpenId() { throw null; } - public static Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder Phone() { throw null; } - public static Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder Profile() { throw null; } - } - public partial class IdentityResourceCollection : System.Collections.ObjectModel.Collection - { - public IdentityResourceCollection() { } - public IdentityResourceCollection(System.Collections.Generic.IList list) { } - public IdentityServer4.Models.IdentityResource this[string key] { get { throw null; } } - public void AddAddress() { } - public void AddAddress(System.Action configure) { } - public void AddEmail() { } - public void AddEmail(System.Action configure) { } - public void AddOpenId() { } - public void AddOpenId(System.Action configure) { } - public void AddPhone() { } - public void AddPhone(System.Action configure) { } - public void AddProfile() { } - public void AddProfile(System.Action configure) { } - public void AddRange(params IdentityServer4.Models.IdentityResource[] identityResources) { } - } - public partial class IdentityServerJwtConstants - { - public const string IdentityServerJwtBearerScheme = "IdentityServerJwtBearer"; - public const string IdentityServerJwtScheme = "IdentityServerJwt"; - public IdentityServerJwtConstants() { } - } -} -namespace Microsoft.AspNetCore.Authentication -{ - public static partial class AuthenticationBuilderExtensions - { - public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddIdentityServerJwt(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder) { throw null; } - } -} -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class IdentityServerBuilderConfigurationExtensions - { - public static Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder AddApiAuthorization(this Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder builder) where TUser : class where TContext : Microsoft.EntityFrameworkCore.DbContext, IdentityServer4.EntityFramework.Interfaces.IPersistedGrantDbContext { throw null; } - public static Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder AddApiAuthorization(this Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder builder, System.Action configure) where TUser : class where TContext : Microsoft.EntityFrameworkCore.DbContext, IdentityServer4.EntityFramework.Interfaces.IPersistedGrantDbContext { throw null; } - public static Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder AddApiResources(this Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder builder) { throw null; } - public static Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder AddApiResources(this Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder builder, Microsoft.Extensions.Configuration.IConfiguration configuration) { throw null; } - public static Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder AddClients(this Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder builder) { throw null; } - public static Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder AddClients(this Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder builder, Microsoft.Extensions.Configuration.IConfiguration configuration) { throw null; } - public static Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder AddIdentityResources(this Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder builder) { throw null; } - public static Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder AddIdentityResources(this Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder builder, Microsoft.Extensions.Configuration.IConfiguration configuration) { throw null; } - public static Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder AddSigningCredentials(this Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder builder) { throw null; } - public static Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder AddSigningCredentials(this Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder builder, Microsoft.Extensions.Configuration.IConfiguration configuration) { throw null; } - } -} diff --git a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/ApiAuthSample.csproj b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/ApiAuthSample.csproj index df96819c67..c9883821b4 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/ApiAuthSample.csproj +++ b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/ApiAuthSample.csproj @@ -3,9 +3,14 @@ netcoreapp3.0 aspnet-ApiAuthSample-12ED8ECC-9EF1-4D31-87B4-1405B3198E5E + + false + + diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj b/src/Identity/ApiAuthorization.IdentityServer/src/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj index b6489a710a..7c09a6e368 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj @@ -5,19 +5,29 @@ ASP.NET Core API Authorization package powered by Identity Server. true aspnetcore;apiauth;identity + false true + false + + false + + - + + + + diff --git a/src/Identity/ApiAuthorization.IdentityServer/test/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Tests.csproj b/src/Identity/ApiAuthorization.IdentityServer/test/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Tests.csproj index 27c97dc746..e2030d5620 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/test/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Tests.csproj +++ b/src/Identity/ApiAuthorization.IdentityServer/test/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Tests.csproj @@ -2,9 +2,15 @@ netcoreapp3.0 + + false + + + diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/Angular-CSharp.csproj.in b/src/ProjectTemplates/Web.Spa.ProjectTemplates/Angular-CSharp.csproj.in index bd29440fcf..09d68a25ee 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/Angular-CSharp.csproj.in +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/Angular-CSharp.csproj.in @@ -20,6 +20,7 @@ + diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/Microsoft.DotNet.Web.Spa.ProjectTemplates.csproj b/src/ProjectTemplates/Web.Spa.ProjectTemplates/Microsoft.DotNet.Web.Spa.ProjectTemplates.csproj index 27759899a0..28df34bc4f 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/Microsoft.DotNet.Web.Spa.ProjectTemplates.csproj +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/Microsoft.DotNet.Web.Spa.ProjectTemplates.csproj @@ -12,6 +12,7 @@ MicrosoftEntityFrameworkCoreSqlitePackageVersion=$(MicrosoftEntityFrameworkCoreSqlitePackageVersion); + MicrosoftEntityFrameworkCoreRelationalPackageVersion=$(MicrosoftEntityFrameworkCoreRelationalPackageVersion); MicrosoftEntityFrameworkCoreSqlServerPackageVersion=$(MicrosoftEntityFrameworkCoreSqlServerPackageVersion); MicrosoftEntityFrameworkCoreToolsPackageVersion=$(MicrosoftEntityFrameworkCoreToolsPackageVersion); MicrosoftExtensionsHostingPackageVersion=$(MicrosoftExtensionsHostingPackageVersion); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/React-CSharp.csproj.in b/src/ProjectTemplates/Web.Spa.ProjectTemplates/React-CSharp.csproj.in index dc4897f498..8e4a8b80e4 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/React-CSharp.csproj.in +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/React-CSharp.csproj.in @@ -17,6 +17,7 @@ + diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package-lock.json b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package-lock.json index 80523dc4fd..1318c47924 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package-lock.json +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package-lock.json @@ -1701,8 +1701,7 @@ "base64-js": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", - "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", - "dev": true + "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==" }, "base64id": { "version": "1.0.0", @@ -2747,6 +2746,11 @@ "randomfill": "^1.0.3" } }, + "crypto-js": { + "version": "3.1.9-1", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.9-1.tgz", + "integrity": "sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg=" + }, "css-parse": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/css-parse/-/css-parse-1.7.0.tgz", @@ -7153,10 +7157,13 @@ "dev": true }, "oidc-client": { - "version": "1.9.0-beta.3", - "resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.9.0-beta.3.tgz", - "integrity": "sha512-8JqmesN7n7sQrdeEYiuWyWjNp/6cZGOHU5IaYrULm/qdYo6cAheeZl93bDkob6MdfbQMsQ2HGG/+EOHFdFQcSQ==", + "version": "1.9.0-beta.4", + "resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.9.0-beta.4.tgz", + "integrity": "sha512-BE6o220w9kDTicmsX324Z5t3Gg20G9NgQjCOFP6SUY7glJYBohyw9DVPt/khPmmg+wabufJq1tH2zyEadMf7Pw==", "requires": { + "base64-js": "^1.3.0", + "core-js": "^2.6.4", + "crypto-js": "^3.1.9-1", "uuid": "^3.3.2" } }, diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package.json b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package.json index c249e23305..c30b740221 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package.json +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package.json @@ -26,7 +26,7 @@ "bootstrap": "^4.3.1", "core-js": "^2.6.5", "jquery": "3.4.1", - "oidc-client": "^1.9.0-beta.1", + "oidc-client": "^1.9.0-beta.4", "popper.js": "^1.14.3", "rxjs": "^6.4.0", "zone.js": "~0.9.1" diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/authorize.service.ts b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/authorize.service.ts index 7c46a3e27b..ce9e28bfa3 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/authorize.service.ts +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/authorize.service.ts @@ -21,7 +21,6 @@ export interface FailureAuthenticationResult { export interface RedirectAuthenticationResult { status: AuthenticationResultStatus.Redirect; - redirectUrl: string; } export enum AuthenticationResultStatus { @@ -34,18 +33,6 @@ export interface IUser { name: string; } -// Private interfaces -enum LoginMode { - Silent, - PopUp, - Redirect -} - -interface IAuthenticationState { - mode: LoginMode; - userState?: any; -} - @Injectable({ providedIn: 'root' }) @@ -86,7 +73,7 @@ export class AuthorizeService { await this.ensureUserManagerInitialized(); let user: User = null; try { - user = await this.userManager.signinSilent(this.createArguments(LoginMode.Silent)); + user = await this.userManager.signinSilent(this.createArguments()); this.userSubject.next(user.profile); return this.success(state); } catch (silentError) { @@ -97,7 +84,7 @@ export class AuthorizeService { if (this.popUpDisabled) { throw new Error('Popup disabled. Change \'authorize.service.ts:AuthorizeService.popupDisabled\' to false to enable it.'); } - user = await this.userManager.signinPopup(this.createArguments(LoginMode.PopUp)); + user = await this.userManager.signinPopup(this.createArguments()); this.userSubject.next(user.profile); return this.success(state); } catch (popupError) { @@ -110,9 +97,8 @@ export class AuthorizeService { // PopUps might be blocked by the user, fallback to redirect try { - const signInRequest = await this.userManager.createSigninRequest( - this.createArguments(LoginMode.Redirect, state)); - return this.redirect(signInRequest.url); + await this.userManager.signinRedirect(this.createArguments(state)); + return this.redirect(); } catch (redirectError) { console.log('Redirect authentication error: ', redirectError); return this.error(redirectError); @@ -121,56 +107,29 @@ export class AuthorizeService { } } - // We are receiving a callback from the IdP. This code can be running in 3 situations: - // 1) As a hidden iframe started by a silent login on signIn (above). The code in the main - // browser window will close the iframe after returning from signInSilent. - // 2) As a PopUp window started by a pop-up login on signIn (above). The code in the main - // browser window will close the pop-up window after returning from signInPopUp - // 3) On the main browser window when the IdP redirects back to the app. We will process - // the response and redirect to the return url or display an error message. public async completeSignIn(url: string): Promise { - await this.ensureUserManagerInitialized(); try { - const { state } = await (this.userManager as any).readSigninResponseState(url, this.userManager.settings.stateStore); - if (state.request_type === 'si:r' || !state.request_type) { - const user = await this.userManager.signinRedirectCallback(url); - this.userSubject.next(user.profile); - return this.success(state.data.userState); - - } - if (state.request_type === 'si:p') { - await this.userManager.signinPopupCallback(url); - return this.success(undefined); - } - if (state.request_type === 'si:s') { - await this.userManager.signinSilentCallback(url); - return this.success(undefined); - } - - throw new Error(`Invalid login mode '${state.request_type}'.`); - } catch (signInResponseError) { - console.log('There was an error signing in', signInResponseError); - return this.error('Sing in callback authentication error.'); + await this.ensureUserManagerInitialized(); + const user = await this.userManager.signinCallback(url); + this.userSubject.next(user && user.profile); + return this.success(user && user.state); + } catch (error) { + console.log('There was an error signing in: ', error); + return this.error('There was an error signing in.'); } } - // We try to sign out the user in two different ways: - // 1) We try to do a sign-out using a PopUp Window. This might fail if there is a - // Pop-Up blocker or the user has disabled PopUps. - // 2) If the method above fails, we redirect the browser to the IdP to perform a traditional - // post logout redirect flow. public async signOut(state: any): Promise { - await this.ensureUserManagerInitialized(); try { - await this.userManager.signoutPopup(this.createArguments(LoginMode.PopUp)); + await this.ensureUserManagerInitialized(); + await this.userManager.signoutPopup(this.createArguments()); this.userSubject.next(null); return this.success(state); } catch (popupSignOutError) { console.log('Popup signout error: ', popupSignOutError); try { - const signInRequest = await this.userManager.createSignoutRequest( - this.createArguments(LoginMode.Redirect, state)); - return this.redirect(signInRequest.url); + await this.userManager.signoutRedirect(this.createArguments(state)); + return this.redirect(); } catch (redirectSignOutError) { console.log('Redirect signout error: ', popupSignOutError); return this.error(redirectSignOutError); @@ -178,39 +137,20 @@ export class AuthorizeService { } } - // We are receiving a callback from the IdP. This code can be running in 2 situations: - // 1) As a PopUp window started by a pop-up login on signOut (above). The code in the main - // browser window will close the pop-up window after returning from signOutPopUp - // 2) On the main browser window when the IdP redirects back to the app. We will process - // the response and redirect to the logged-out url or display an error message. public async completeSignOut(url: string): Promise { await this.ensureUserManagerInitialized(); try { - const { state } = await (this.userManager as any).readSignoutResponseState(url, this.userManager.settings.stateStore); - if (state) { - if (state.request_type === 'so:r') { - await this.userManager.signoutRedirectCallback(url); - this.userSubject.next(null); - return this.success(state.data.userState); - } - if (state.request_type === 'so:p') { - await this.userManager.signoutPopupCallback(url); - return this.success(state.data && state.data.userState); - } - throw new Error(`Invalid login mode '${state.request_type}'.`); - } - } catch (signInResponseError) { - console.log('There was an error signing out', signInResponseError); - return this.error('Sign out callback authentication error.'); + const state = await this.userManager.signoutCallback(url); + this.userSubject.next(null); + return this.success(state && state.data); + } catch (error) { + console.log(`There was an error trying to log out '${error}'.`); + return this.error(error); } } - private createArguments(mode: LoginMode, state?: any): any { - if (mode !== LoginMode.Silent) { - return { data: { mode, userState: state } }; - } else { - return { data: { mode, userState: state }, redirect_uri: this.userManager.settings.redirect_uri }; - } + private createArguments(state?: any): any { + return { useReplaceToNavigate: true, data: state }; } private error(message: string): IAuthenticationResult { @@ -221,8 +161,8 @@ export class AuthorizeService { return { status: AuthenticationResultStatus.Success, state }; } - private redirect(redirectUrl: string): IAuthenticationResult { - return { status: AuthenticationResultStatus.Redirect, redirectUrl }; + private redirect(): IAuthenticationResult { + return { status: AuthenticationResultStatus.Redirect }; } private async ensureUserManagerInitialized(): Promise { diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/login/login.component.ts b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/login/login.component.ts index b48738b645..f90d0df380 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/login/login.component.ts +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/login/login.component.ts @@ -52,10 +52,6 @@ export class LoginComponent implements OnInit { this.message.next(undefined); switch (result.status) { case AuthenticationResultStatus.Redirect: - // We replace the location here so that in case the user hits the back - // arrow from within the login page they don't get into an infinite - // redirect loop. - window.location.replace(result.redirectUrl); break; case AuthenticationResultStatus.Success: await this.navigateToReturnUrl(returnUrl); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/logout/logout.component.ts b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/logout/logout.component.ts index d9402f007e..78969d39bf 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/logout/logout.component.ts +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/logout/logout.component.ts @@ -53,9 +53,6 @@ export class LogoutComponent implements OnInit { const result = await this.authorizeService.signOut(state); switch (result.status) { case AuthenticationResultStatus.Redirect: - // We replace the location here so that in case the user hits the back - // arrow from within the IdP they don't get into an infinite redirect loop. - window.location.replace(result.redirectUrl); break; case AuthenticationResultStatus.Success: await this.navigateToReturnUrl(returnUrl); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs index 8901c5fea8..d79b0e6698 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs @@ -10,52 +10,67 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Company.WebApplication1.Data.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("00000000000000_CreateIdentitySchema")] + [Migration("20190808120446_CreateIdentitySchema")] partial class CreateIdentitySchema { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3") + .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("nvarchar(450)"); - b.Property("AccessFailedCount"); + b.Property("AccessFailedCount") + .HasColumnType("int"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); b.Property("Email") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("EmailConfirmed"); + b.Property("EmailConfirmed") + .HasColumnType("bit"); - b.Property("LockoutEnabled"); + b.Property("LockoutEnabled") + .HasColumnType("bit"); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); b.Property("NormalizedEmail") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedUserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("PasswordHash"); + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); - b.Property("PhoneNumber"); + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); - b.Property("PhoneNumberConfirmed"); + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); - b.Property("SecurityStamp"); + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); - b.Property("TwoFactorEnabled"); + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); b.Property("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -74,26 +89,33 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property("UserCode") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") .IsRequired() + .HasColumnType("nvarchar(max)") .HasMaxLength(50000); b.Property("DeviceCode") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Expiration") - .IsRequired(); + .IsRequired() + .HasColumnType("datetime2"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.HasKey("UserCode"); @@ -101,51 +123,64 @@ namespace Company.WebApplication1.Data.Migrations b.HasIndex("DeviceCode") .IsUnique(); + b.HasIndex("Expiration"); + b.ToTable("DeviceCodes"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => { b.Property("Key") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") .IsRequired() + .HasColumnType("nvarchar(max)") .HasMaxLength(50000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("nvarchar(50)") .HasMaxLength(50); b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); b.ToTable("PersistedGrants"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("nvarchar(450)"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); b.Property("Name") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -162,14 +197,18 @@ namespace Company.WebApplication1.Data.Migrations { b.Property("Id") .ValueGeneratedOnAdd() + .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); b.Property("RoleId") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(450)"); b.HasKey("Id"); @@ -182,14 +221,18 @@ namespace Company.WebApplication1.Data.Migrations { b.Property("Id") .ValueGeneratedOnAdd() + .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(450)"); b.HasKey("Id"); @@ -201,15 +244,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("ProviderDisplayName"); + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(450)"); b.HasKey("LoginProvider", "ProviderKey"); @@ -220,9 +267,11 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("nvarchar(450)"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); b.HasKey("UserId", "RoleId"); @@ -233,15 +282,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("nvarchar(450)"); b.Property("LoginProvider") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Name") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("Value"); + b.Property("Value") + .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs index b297cf37fb..151e8b2206 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs @@ -1,5 +1,4 @@ using System; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; namespace Company.WebApplication1.Data.Migrations @@ -86,7 +85,7 @@ namespace Company.WebApplication1.Data.Migrations columns: table => new { Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), + .Annotation("SqlServer:Identity", "1, 1"), RoleId = table.Column(nullable: false), ClaimType = table.Column(nullable: true), ClaimValue = table.Column(nullable: true) @@ -107,7 +106,7 @@ namespace Company.WebApplication1.Data.Migrations columns: table => new { Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), + .Annotation("SqlServer:Identity", "1, 1"), UserId = table.Column(nullable: false), ClaimType = table.Column(nullable: true), ClaimValue = table.Column(nullable: true) @@ -233,9 +232,14 @@ namespace Company.WebApplication1.Data.Migrations unique: true); migrationBuilder.CreateIndex( - name: "IX_PersistedGrants_SubjectId_ClientId_Type", + name: "IX_DeviceCodes_Expiration", + table: "DeviceCodes", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_SubjectId_ClientId_Type_Expiration", table: "PersistedGrants", - columns: new[] { "SubjectId", "ClientId", "Type" }); + columns: new[] { "SubjectId", "ClientId", "Type", "Expiration" }); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs index 40ca333c0c..6f19b5d805 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs @@ -15,45 +15,60 @@ namespace Company.WebApplication1.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3") + .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("nvarchar(450)"); - b.Property("AccessFailedCount"); + b.Property("AccessFailedCount") + .HasColumnType("int"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); b.Property("Email") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("EmailConfirmed"); + b.Property("EmailConfirmed") + .HasColumnType("bit"); - b.Property("LockoutEnabled"); + b.Property("LockoutEnabled") + .HasColumnType("bit"); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); b.Property("NormalizedEmail") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedUserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("PasswordHash"); + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); - b.Property("PhoneNumber"); + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); - b.Property("PhoneNumberConfirmed"); + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); - b.Property("SecurityStamp"); + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); - b.Property("TwoFactorEnabled"); + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); b.Property("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -72,26 +87,33 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property("UserCode") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") .IsRequired() + .HasColumnType("nvarchar(max)") .HasMaxLength(50000); b.Property("DeviceCode") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Expiration") - .IsRequired(); + .IsRequired() + .HasColumnType("datetime2"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.HasKey("UserCode"); @@ -99,51 +121,64 @@ namespace Company.WebApplication1.Data.Migrations b.HasIndex("DeviceCode") .IsUnique(); + b.HasIndex("Expiration"); + b.ToTable("DeviceCodes"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => { b.Property("Key") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") .IsRequired() + .HasColumnType("nvarchar(max)") .HasMaxLength(50000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("nvarchar(50)") .HasMaxLength(50); b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); b.ToTable("PersistedGrants"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("nvarchar(450)"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); b.Property("Name") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -160,14 +195,18 @@ namespace Company.WebApplication1.Data.Migrations { b.Property("Id") .ValueGeneratedOnAdd() + .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); b.Property("RoleId") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(450)"); b.HasKey("Id"); @@ -180,14 +219,18 @@ namespace Company.WebApplication1.Data.Migrations { b.Property("Id") .ValueGeneratedOnAdd() + .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(450)"); b.HasKey("Id"); @@ -199,15 +242,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("ProviderDisplayName"); + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(450)"); b.HasKey("LoginProvider", "ProviderKey"); @@ -218,9 +265,11 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("nvarchar(450)"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); b.HasKey("UserId", "RoleId"); @@ -231,15 +280,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("nvarchar(450)"); b.Property("LoginProvider") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Name") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("Value"); + b.Property("Value") + .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs index fb7b4f9ee3..445f3f946d 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs @@ -16,43 +16,58 @@ namespace Company.WebApplication1.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3"); + .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13"); modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("TEXT"); - b.Property("AccessFailedCount"); + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("TEXT"); b.Property("Email") + .HasColumnType("TEXT") .HasMaxLength(256); - b.Property("EmailConfirmed"); + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); - b.Property("LockoutEnabled"); + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("TEXT"); b.Property("NormalizedEmail") + .HasColumnType("TEXT") .HasMaxLength(256); b.Property("NormalizedUserName") + .HasColumnType("TEXT") .HasMaxLength(256); - b.Property("PasswordHash"); + b.Property("PasswordHash") + .HasColumnType("TEXT"); - b.Property("PhoneNumber"); + b.Property("PhoneNumber") + .HasColumnType("TEXT"); - b.Property("PhoneNumberConfirmed"); + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); - b.Property("SecurityStamp"); + b.Property("SecurityStamp") + .HasColumnType("TEXT"); - b.Property("TwoFactorEnabled"); + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); b.Property("UserName") + .HasColumnType("TEXT") .HasMaxLength(256); b.HasKey("Id"); @@ -70,26 +85,33 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property("UserCode") + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("TEXT"); b.Property("Data") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50000); b.Property("DeviceCode") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("Expiration") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.Property("SubjectId") + .HasColumnType("TEXT") .HasMaxLength(200); b.HasKey("UserCode"); @@ -97,51 +119,64 @@ namespace Company.WebApplication1.Data.Migrations b.HasIndex("DeviceCode") .IsUnique(); + b.HasIndex("Expiration"); + b.ToTable("DeviceCodes"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => { b.Property("Key") + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("TEXT"); b.Property("Data") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("TEXT"); b.Property("SubjectId") + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50); b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); b.ToTable("PersistedGrants"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("TEXT"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("TEXT"); b.Property("Name") + .HasColumnType("TEXT") .HasMaxLength(256); b.Property("NormalizedName") + .HasColumnType("TEXT") .HasMaxLength(256); b.HasKey("Id"); @@ -156,14 +191,18 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("TEXT"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("TEXT"); b.Property("RoleId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -175,14 +214,18 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("TEXT"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("TEXT"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -194,15 +237,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") + .HasColumnType("TEXT") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("TEXT") .HasMaxLength(128); - b.Property("ProviderDisplayName"); + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("LoginProvider", "ProviderKey"); @@ -213,9 +260,11 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("TEXT"); b.HasKey("UserId", "RoleId"); @@ -226,15 +275,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); b.Property("LoginProvider") + .HasColumnType("TEXT") .HasMaxLength(128); b.Property("Name") + .HasColumnType("TEXT") .HasMaxLength(128); - b.Property("Value"); + b.Property("Value") + .HasColumnType("TEXT"); b.HasKey("UserId", "LoginProvider", "Name"); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs index 20ae98cb06..19502e4c12 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs @@ -230,9 +230,14 @@ namespace Company.WebApplication1.Data.Migrations unique: true); migrationBuilder.CreateIndex( - name: "IX_PersistedGrants_SubjectId_ClientId_Type", + name: "IX_DeviceCodes_Expiration", + table: "DeviceCodes", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_SubjectId_ClientId_Type_Expiration", table: "PersistedGrants", - columns: new[] { "SubjectId", "ClientId", "Type" }); + columns: new[] { "SubjectId", "ClientId", "Type", "Expiration" }); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs index f037fed08a..00494952dd 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs @@ -14,43 +14,58 @@ namespace Company.WebApplication1.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3"); + .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13"); modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("TEXT"); - b.Property("AccessFailedCount"); + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("TEXT"); b.Property("Email") + .HasColumnType("TEXT") .HasMaxLength(256); - b.Property("EmailConfirmed"); + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); - b.Property("LockoutEnabled"); + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("TEXT"); b.Property("NormalizedEmail") + .HasColumnType("TEXT") .HasMaxLength(256); b.Property("NormalizedUserName") + .HasColumnType("TEXT") .HasMaxLength(256); - b.Property("PasswordHash"); + b.Property("PasswordHash") + .HasColumnType("TEXT"); - b.Property("PhoneNumber"); + b.Property("PhoneNumber") + .HasColumnType("TEXT"); - b.Property("PhoneNumberConfirmed"); + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); - b.Property("SecurityStamp"); + b.Property("SecurityStamp") + .HasColumnType("TEXT"); - b.Property("TwoFactorEnabled"); + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); b.Property("UserName") + .HasColumnType("TEXT") .HasMaxLength(256); b.HasKey("Id"); @@ -68,26 +83,33 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property("UserCode") + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("TEXT"); b.Property("Data") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50000); b.Property("DeviceCode") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("Expiration") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.Property("SubjectId") + .HasColumnType("TEXT") .HasMaxLength(200); b.HasKey("UserCode"); @@ -95,51 +117,64 @@ namespace Company.WebApplication1.Data.Migrations b.HasIndex("DeviceCode") .IsUnique(); + b.HasIndex("Expiration"); + b.ToTable("DeviceCodes"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => { b.Property("Key") + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("TEXT"); b.Property("Data") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("TEXT"); b.Property("SubjectId") + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50); b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); b.ToTable("PersistedGrants"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("TEXT"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("TEXT"); b.Property("Name") + .HasColumnType("TEXT") .HasMaxLength(256); b.Property("NormalizedName") + .HasColumnType("TEXT") .HasMaxLength(256); b.HasKey("Id"); @@ -154,14 +189,18 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("TEXT"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("TEXT"); b.Property("RoleId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -173,14 +212,18 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("TEXT"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("TEXT"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -192,15 +235,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") + .HasColumnType("TEXT") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("TEXT") .HasMaxLength(128); - b.Property("ProviderDisplayName"); + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("LoginProvider", "ProviderKey"); @@ -211,9 +258,11 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("TEXT"); b.HasKey("UserId", "RoleId"); @@ -224,15 +273,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); b.Property("LoginProvider") + .HasColumnType("TEXT") .HasMaxLength(128); b.Property("Name") + .HasColumnType("TEXT") .HasMaxLength(128); - b.Property("Value"); + b.Property("Value") + .HasColumnType("TEXT"); b.HasKey("UserId", "LoginProvider", "Name"); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/app.db b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/app.db index a401a042262528ef07722eaad454fd88c4b19705..d28dbed8379b1f0a5fa75a46ac181886511455f8 100644 GIT binary patch delta 281 zcmZo@;Am*zkO>a-$t+1#NXswEO)OC`W)NUtVq$PmP+(wSV4f)B%*xE5XQHq%Wf4Ei zK?eSVn*|lN^RwDAG6!2vzN@c1`L#SRm!+PerHO&5o}qD*!Zrm)HUmb<>FfcFO3dGw zB{vHSyk+8QjFM#+FV|*llArDt%&5;D?^;oiS(I3knV&bkG?>u?MPP3*qq)0|f)YZF zl4hk0ySTkFW20wNTTx2L9UJ=(>I1NN@yaPq~PzT UpoFAMNkIe2qV4%1j1yM_0Bep`4*&oF delta 216 zcmZo@;Am*zkO>a-$t+1#NXswEO)OC`W)NUtWMptqP+(wSV45i7%*w=|rxUO-Wf4Ei zVFv!gn*|ki^0QhqG6$PazN@c1`K3HBhn}IOfrWvdVUxl(1x7XlMw{vE0gOt_Uzu$- z3knD@^EaBwvWq8bGdAXC=B1=oOs@`R)S4a}%;+(FLolPck!F<)ySTM7W1})y+A|{F vCABOwIn_BoCABy{v^cd0#6l92pT0DNQH2F0GyQxBqa+7R&G!5d#)+!|XhT0v diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package-lock.json b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package-lock.json index c6fdc36537..d603279670 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package-lock.json +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package-lock.json @@ -3736,6 +3736,11 @@ "randomfill": "^1.0.3" } }, + "crypto-js": { + "version": "3.1.9-1", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.9-1.tgz", + "integrity": "sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg=" + }, "css-blank-pseudo": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/css-blank-pseudo/-/css-blank-pseudo-0.1.4.tgz", @@ -8560,11 +8565,21 @@ "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==" }, "oidc-client": { - "version": "1.9.0-beta.3", - "resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.9.0-beta.3.tgz", - "integrity": "sha512-8JqmesN7n7sQrdeEYiuWyWjNp/6cZGOHU5IaYrULm/qdYo6cAheeZl93bDkob6MdfbQMsQ2HGG/+EOHFdFQcSQ==", + "version": "1.9.0-beta.4", + "resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.9.0-beta.4.tgz", + "integrity": "sha512-BE6o220w9kDTicmsX324Z5t3Gg20G9NgQjCOFP6SUY7glJYBohyw9DVPt/khPmmg+wabufJq1tH2zyEadMf7Pw==", "requires": { + "base64-js": "^1.3.0", + "core-js": "^2.6.4", + "crypto-js": "^3.1.9-1", "uuid": "^3.3.2" + }, + "dependencies": { + "core-js": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz", + "integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==" + } } }, "on-finished": { diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package.json b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package.json index 580683fb1f..83352c75b3 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package.json +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package.json @@ -7,7 +7,7 @@ "bootstrap": "^4.1.3", "jquery": "^3.4.1", "merge": "^1.2.1", - "oidc-client": "^1.9.0-beta.1", + "oidc-client": "^1.9.0-beta.4", "react": "^16.0.0", "react-dom": "^16.0.0", "react-router-bootstrap": "^0.24.4", diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/AuthorizeService.js b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/AuthorizeService.js index b6215f4e8d..8987f3fa83 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/AuthorizeService.js +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/AuthorizeService.js @@ -43,7 +43,7 @@ export class AuthorizeService { async signIn(state) { await this.ensureUserManagerInitialized(); try { - const silentUser = await this.userManager.signinSilent(this.createArguments(LoginMode.Silent)); + const silentUser = await this.userManager.signinSilent(this.createArguments()); this.updateState(silentUser); return this.success(state); } catch (silentError) { @@ -55,7 +55,7 @@ export class AuthorizeService { throw new Error('Popup disabled. Change \'AuthorizeService.js:AuthorizeService._popupDisabled\' to false to enable it.') } - const popUpUser = await this.userManager.signinPopup(this.createArguments(LoginMode.PopUp)); + const popUpUser = await this.userManager.signinPopup(this.createArguments()); this.updateState(popUpUser); return this.success(state); } catch (popUpError) { @@ -68,9 +68,8 @@ export class AuthorizeService { // PopUps might be blocked by the user, fallback to redirect try { - const signInRequest = await this.userManager.createSigninRequest( - this.createArguments(LoginMode.Redirect, state)); - return this.redirect(signInRequest.url); + await this.userManager.signinRedirect(this.createArguments(state)); + return this.redirect(); } catch (redirectError) { console.log("Redirect authentication error: ", redirectError); return this.error(redirectError); @@ -79,35 +78,15 @@ export class AuthorizeService { } } - // We are receiving a callback from the IdP. This code can be running in 3 situations: - // 1) As a hidden iframe started by a silent login on signIn (above). The code in the main - // browser window will close the iframe after returning from signInSilent. - // 2) As a PopUp window started by a pop-up login on signIn (above). The code in the main - // browser window will close the pop-up window after returning from signInPopUp - // 3) On the main browser window when the IdP redirects back to the app. We will process - // the response and redirect to the return url or display an error message. async completeSignIn(url) { - await this.ensureUserManagerInitialized(); try { - const { state } = await this.userManager.readSigninResponseState(url, this.userManager.settings.stateStore); - if (state.request_type === 'si:r' || !state.request_type) { - let user = await this.userManager.signinRedirectCallback(url); - this.updateState(user); - return this.success(state.data.userState); - } - if (state.request_type === 'si:p') { - await this.userManager.signinSilentCallback(url); - return this.success(undefined); - } - if (state.request_type === 'si:s') { - await this.userManager.signinSilentCallback(url); - return this.success(undefined); - } - - throw new Error(`Invalid login mode '${state.request_type}'.`); - } catch (signInResponseError) { - console.log('There was an error signing in', signInResponseError); - return this.error('Sing in callback authentication error.'); + await this.ensureUserManagerInitialized(); + const user = await this.userManager.signinCallback(url); + this.updateState(user); + return this.success(user && user.state); + } catch (error) { + console.log('There was an error signing in: ', error); + return this.error('There was an error signing in.'); } } @@ -119,15 +98,14 @@ export class AuthorizeService { async signOut(state) { await this.ensureUserManagerInitialized(); try { - await this.userManager.signoutPopup(this.createArguments(LoginMode.PopUp)); + await this.userManager.signoutPopup(this.createArguments()); this.updateState(undefined); return this.success(state); } catch (popupSignOutError) { console.log("Popup signout error: ", popupSignOutError); try { - const signOutRequest = await this.userManager.createSignoutRequest( - this.createArguments(LoginMode.Redirect, state)); - return this.redirect(signOutRequest.url); + await this.userManager.signoutRedirect(this.createArguments(state)); + return this.redirect(); } catch (redirectSignOutError) { console.log("Redirect signout error: ", redirectSignOutError); return this.error(redirectSignOutError); @@ -135,30 +113,15 @@ export class AuthorizeService { } } - // We are receiving a callback from the IdP. This code can be running in 2 situations: - // 1) As a PopUp window started by a pop-up login on signOut (above). The code in the main - // browser window will close the pop-up window after returning from signOutPopUp - // 2) On the main browser window when the IdP redirects back to the app. We will process - // the response and redirect to the logged-out url or display an error message. async completeSignOut(url) { await this.ensureUserManagerInitialized(); try { - const { state } = await this.userManager.readSignoutResponseState(url, this.userManager.settings.stateStore); - if (state) { - if (state.request_type === 'so:r') { - await this.userManager.signoutRedirectCallback(url); - this.userSubject.next(null); - return this.success(state.data.userState); - } - if (state.request_type === 'so:p') { - await this.userManager.signoutPopupCallback(url); - return this.success(state.data && state.data.userState); - } - throw new Error(`Invalid login mode '${state.request_type}'.`); - } - } catch (signInResponseError) { - console.log('There was an error signing out', signInResponseError); - return this.error('Sign out callback authentication error.'); + const response = await this.userManager.signoutCallback(url); + this.updateState(null); + return this.success(response && response.data); + } catch (error) { + console.log(`There was an error trying to log out '${error}'.`); + return this.error(error); } } @@ -191,12 +154,8 @@ export class AuthorizeService { } } - createArguments(mode, state) { - if (mode !== LoginMode.Silent) { - return { data: { mode, userState: state } }; - } else { - return { data: { mode, userState: state }, redirect_uri: this.userManager.settings.redirect_uri }; - } + createArguments(state) { + return { useReplaceToNavigate: true, data: state }; } error(message) { @@ -207,8 +166,8 @@ export class AuthorizeService { return { status: AuthenticationResultStatus.Success, state }; } - redirect(redirectUrl) { - return { status: AuthenticationResultStatus.Redirect, redirectUrl }; + redirect() { + return { status: AuthenticationResultStatus.Redirect }; } async ensureUserManagerInitialized() { @@ -239,12 +198,6 @@ export class AuthorizeService { static get instance() { return authService } } -const LoginMode = { - Silent: 'silent', - PopUp: 'popup', - Redirect: 'redirect' -} - const authService = new AuthorizeService(); export default authService; diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/Login.js b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/Login.js index 1204fe33b4..7ef201c91c 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/Login.js +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/Login.js @@ -68,10 +68,6 @@ export class Login extends Component { const result = await authService.signIn(state); switch (result.status) { case AuthenticationResultStatus.Redirect: - // We replace the location here so that in case the user hits the back - // arrow from within the login page he doesn't get into an infinite - // redirect loop. - window.location.replace(result.redirectUrl); break; case AuthenticationResultStatus.Success: await this.navigateToReturnUrl(returnUrl); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/Logout.js b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/Logout.js index 4deb80f7bc..d53769cd8b 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/Logout.js +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/Logout.js @@ -71,9 +71,6 @@ export class Logout extends Component { const result = await authService.signOut(state); switch (result.status) { case AuthenticationResultStatus.Redirect: - // We replace the location here so that in case the user hits the back - // arrow from within the IdP he doesn't get into an infinite redirect loop. - window.location.replace(result.redirectUrl); break; case AuthenticationResultStatus.Success: await this.navigateToReturnUrl(returnUrl); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs index 8901c5fea8..d79b0e6698 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs @@ -10,52 +10,67 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Company.WebApplication1.Data.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("00000000000000_CreateIdentitySchema")] + [Migration("20190808120446_CreateIdentitySchema")] partial class CreateIdentitySchema { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3") + .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("nvarchar(450)"); - b.Property("AccessFailedCount"); + b.Property("AccessFailedCount") + .HasColumnType("int"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); b.Property("Email") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("EmailConfirmed"); + b.Property("EmailConfirmed") + .HasColumnType("bit"); - b.Property("LockoutEnabled"); + b.Property("LockoutEnabled") + .HasColumnType("bit"); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); b.Property("NormalizedEmail") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedUserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("PasswordHash"); + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); - b.Property("PhoneNumber"); + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); - b.Property("PhoneNumberConfirmed"); + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); - b.Property("SecurityStamp"); + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); - b.Property("TwoFactorEnabled"); + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); b.Property("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -74,26 +89,33 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property("UserCode") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") .IsRequired() + .HasColumnType("nvarchar(max)") .HasMaxLength(50000); b.Property("DeviceCode") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Expiration") - .IsRequired(); + .IsRequired() + .HasColumnType("datetime2"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.HasKey("UserCode"); @@ -101,51 +123,64 @@ namespace Company.WebApplication1.Data.Migrations b.HasIndex("DeviceCode") .IsUnique(); + b.HasIndex("Expiration"); + b.ToTable("DeviceCodes"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => { b.Property("Key") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") .IsRequired() + .HasColumnType("nvarchar(max)") .HasMaxLength(50000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("nvarchar(50)") .HasMaxLength(50); b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); b.ToTable("PersistedGrants"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("nvarchar(450)"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); b.Property("Name") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -162,14 +197,18 @@ namespace Company.WebApplication1.Data.Migrations { b.Property("Id") .ValueGeneratedOnAdd() + .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); b.Property("RoleId") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(450)"); b.HasKey("Id"); @@ -182,14 +221,18 @@ namespace Company.WebApplication1.Data.Migrations { b.Property("Id") .ValueGeneratedOnAdd() + .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(450)"); b.HasKey("Id"); @@ -201,15 +244,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("ProviderDisplayName"); + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(450)"); b.HasKey("LoginProvider", "ProviderKey"); @@ -220,9 +267,11 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("nvarchar(450)"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); b.HasKey("UserId", "RoleId"); @@ -233,15 +282,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("nvarchar(450)"); b.Property("LoginProvider") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Name") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("Value"); + b.Property("Value") + .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs index 4ca64cc6f6..151e8b2206 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; +using System; using Microsoft.EntityFrameworkCore.Migrations; namespace Company.WebApplication1.Data.Migrations @@ -86,7 +85,7 @@ namespace Company.WebApplication1.Data.Migrations columns: table => new { Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), + .Annotation("SqlServer:Identity", "1, 1"), RoleId = table.Column(nullable: false), ClaimType = table.Column(nullable: true), ClaimValue = table.Column(nullable: true) @@ -107,7 +106,7 @@ namespace Company.WebApplication1.Data.Migrations columns: table => new { Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), + .Annotation("SqlServer:Identity", "1, 1"), UserId = table.Column(nullable: false), ClaimType = table.Column(nullable: true), ClaimValue = table.Column(nullable: true) @@ -233,9 +232,14 @@ namespace Company.WebApplication1.Data.Migrations unique: true); migrationBuilder.CreateIndex( - name: "IX_PersistedGrants_SubjectId_ClientId_Type", + name: "IX_DeviceCodes_Expiration", + table: "DeviceCodes", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_SubjectId_ClientId_Type_Expiration", table: "PersistedGrants", - columns: new[] { "SubjectId", "ClientId", "Type" }); + columns: new[] { "SubjectId", "ClientId", "Type", "Expiration" }); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs index 40ca333c0c..6f19b5d805 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs @@ -15,45 +15,60 @@ namespace Company.WebApplication1.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3") + .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("nvarchar(450)"); - b.Property("AccessFailedCount"); + b.Property("AccessFailedCount") + .HasColumnType("int"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); b.Property("Email") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("EmailConfirmed"); + b.Property("EmailConfirmed") + .HasColumnType("bit"); - b.Property("LockoutEnabled"); + b.Property("LockoutEnabled") + .HasColumnType("bit"); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); b.Property("NormalizedEmail") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedUserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("PasswordHash"); + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); - b.Property("PhoneNumber"); + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); - b.Property("PhoneNumberConfirmed"); + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); - b.Property("SecurityStamp"); + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); - b.Property("TwoFactorEnabled"); + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); b.Property("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -72,26 +87,33 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property("UserCode") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") .IsRequired() + .HasColumnType("nvarchar(max)") .HasMaxLength(50000); b.Property("DeviceCode") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Expiration") - .IsRequired(); + .IsRequired() + .HasColumnType("datetime2"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.HasKey("UserCode"); @@ -99,51 +121,64 @@ namespace Company.WebApplication1.Data.Migrations b.HasIndex("DeviceCode") .IsUnique(); + b.HasIndex("Expiration"); + b.ToTable("DeviceCodes"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => { b.Property("Key") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") .IsRequired() + .HasColumnType("nvarchar(max)") .HasMaxLength(50000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("nvarchar(50)") .HasMaxLength(50); b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); b.ToTable("PersistedGrants"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("nvarchar(450)"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); b.Property("Name") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -160,14 +195,18 @@ namespace Company.WebApplication1.Data.Migrations { b.Property("Id") .ValueGeneratedOnAdd() + .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); b.Property("RoleId") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(450)"); b.HasKey("Id"); @@ -180,14 +219,18 @@ namespace Company.WebApplication1.Data.Migrations { b.Property("Id") .ValueGeneratedOnAdd() + .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(450)"); b.HasKey("Id"); @@ -199,15 +242,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("ProviderDisplayName"); + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(450)"); b.HasKey("LoginProvider", "ProviderKey"); @@ -218,9 +265,11 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("nvarchar(450)"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); b.HasKey("UserId", "RoleId"); @@ -231,15 +280,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("nvarchar(450)"); b.Property("LoginProvider") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Name") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("Value"); + b.Property("Value") + .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs index fb7b4f9ee3..445f3f946d 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs @@ -16,43 +16,58 @@ namespace Company.WebApplication1.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3"); + .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13"); modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("TEXT"); - b.Property("AccessFailedCount"); + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("TEXT"); b.Property("Email") + .HasColumnType("TEXT") .HasMaxLength(256); - b.Property("EmailConfirmed"); + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); - b.Property("LockoutEnabled"); + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("TEXT"); b.Property("NormalizedEmail") + .HasColumnType("TEXT") .HasMaxLength(256); b.Property("NormalizedUserName") + .HasColumnType("TEXT") .HasMaxLength(256); - b.Property("PasswordHash"); + b.Property("PasswordHash") + .HasColumnType("TEXT"); - b.Property("PhoneNumber"); + b.Property("PhoneNumber") + .HasColumnType("TEXT"); - b.Property("PhoneNumberConfirmed"); + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); - b.Property("SecurityStamp"); + b.Property("SecurityStamp") + .HasColumnType("TEXT"); - b.Property("TwoFactorEnabled"); + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); b.Property("UserName") + .HasColumnType("TEXT") .HasMaxLength(256); b.HasKey("Id"); @@ -70,26 +85,33 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property("UserCode") + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("TEXT"); b.Property("Data") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50000); b.Property("DeviceCode") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("Expiration") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.Property("SubjectId") + .HasColumnType("TEXT") .HasMaxLength(200); b.HasKey("UserCode"); @@ -97,51 +119,64 @@ namespace Company.WebApplication1.Data.Migrations b.HasIndex("DeviceCode") .IsUnique(); + b.HasIndex("Expiration"); + b.ToTable("DeviceCodes"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => { b.Property("Key") + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("TEXT"); b.Property("Data") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("TEXT"); b.Property("SubjectId") + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50); b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); b.ToTable("PersistedGrants"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("TEXT"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("TEXT"); b.Property("Name") + .HasColumnType("TEXT") .HasMaxLength(256); b.Property("NormalizedName") + .HasColumnType("TEXT") .HasMaxLength(256); b.HasKey("Id"); @@ -156,14 +191,18 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("TEXT"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("TEXT"); b.Property("RoleId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -175,14 +214,18 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("TEXT"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("TEXT"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -194,15 +237,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") + .HasColumnType("TEXT") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("TEXT") .HasMaxLength(128); - b.Property("ProviderDisplayName"); + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("LoginProvider", "ProviderKey"); @@ -213,9 +260,11 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("TEXT"); b.HasKey("UserId", "RoleId"); @@ -226,15 +275,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); b.Property("LoginProvider") + .HasColumnType("TEXT") .HasMaxLength(128); b.Property("Name") + .HasColumnType("TEXT") .HasMaxLength(128); - b.Property("Value"); + b.Property("Value") + .HasColumnType("TEXT"); b.HasKey("UserId", "LoginProvider", "Name"); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs index 20ae98cb06..19502e4c12 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs @@ -230,9 +230,14 @@ namespace Company.WebApplication1.Data.Migrations unique: true); migrationBuilder.CreateIndex( - name: "IX_PersistedGrants_SubjectId_ClientId_Type", + name: "IX_DeviceCodes_Expiration", + table: "DeviceCodes", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_SubjectId_ClientId_Type_Expiration", table: "PersistedGrants", - columns: new[] { "SubjectId", "ClientId", "Type" }); + columns: new[] { "SubjectId", "ClientId", "Type", "Expiration" }); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs index f037fed08a..00494952dd 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs @@ -14,43 +14,58 @@ namespace Company.WebApplication1.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3"); + .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13"); modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("TEXT"); - b.Property("AccessFailedCount"); + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("TEXT"); b.Property("Email") + .HasColumnType("TEXT") .HasMaxLength(256); - b.Property("EmailConfirmed"); + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); - b.Property("LockoutEnabled"); + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("TEXT"); b.Property("NormalizedEmail") + .HasColumnType("TEXT") .HasMaxLength(256); b.Property("NormalizedUserName") + .HasColumnType("TEXT") .HasMaxLength(256); - b.Property("PasswordHash"); + b.Property("PasswordHash") + .HasColumnType("TEXT"); - b.Property("PhoneNumber"); + b.Property("PhoneNumber") + .HasColumnType("TEXT"); - b.Property("PhoneNumberConfirmed"); + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); - b.Property("SecurityStamp"); + b.Property("SecurityStamp") + .HasColumnType("TEXT"); - b.Property("TwoFactorEnabled"); + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); b.Property("UserName") + .HasColumnType("TEXT") .HasMaxLength(256); b.HasKey("Id"); @@ -68,26 +83,33 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property("UserCode") + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("TEXT"); b.Property("Data") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50000); b.Property("DeviceCode") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("Expiration") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.Property("SubjectId") + .HasColumnType("TEXT") .HasMaxLength(200); b.HasKey("UserCode"); @@ -95,51 +117,64 @@ namespace Company.WebApplication1.Data.Migrations b.HasIndex("DeviceCode") .IsUnique(); + b.HasIndex("Expiration"); + b.ToTable("DeviceCodes"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => { b.Property("Key") + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(200); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("TEXT"); b.Property("Data") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("TEXT"); b.Property("SubjectId") + .HasColumnType("TEXT") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50); b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); b.ToTable("PersistedGrants"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { - b.Property("Id"); + b.Property("Id") + .HasColumnType("TEXT"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("TEXT"); b.Property("Name") + .HasColumnType("TEXT") .HasMaxLength(256); b.Property("NormalizedName") + .HasColumnType("TEXT") .HasMaxLength(256); b.HasKey("Id"); @@ -154,14 +189,18 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("TEXT"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("TEXT"); b.Property("RoleId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -173,14 +212,18 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("TEXT"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("TEXT"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -192,15 +235,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") + .HasColumnType("TEXT") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("TEXT") .HasMaxLength(128); - b.Property("ProviderDisplayName"); + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("LoginProvider", "ProviderKey"); @@ -211,9 +258,11 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("TEXT"); b.HasKey("UserId", "RoleId"); @@ -224,15 +273,19 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); b.Property("LoginProvider") + .HasColumnType("TEXT") .HasMaxLength(128); b.Property("Name") + .HasColumnType("TEXT") .HasMaxLength(128); - b.Property("Value"); + b.Property("Value") + .HasColumnType("TEXT"); b.HasKey("UserId", "LoginProvider", "Name"); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/app.db b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/app.db index a401a042262528ef07722eaad454fd88c4b19705..d28dbed8379b1f0a5fa75a46ac181886511455f8 100644 GIT binary patch delta 281 zcmZo@;Am*zkO>a-$t+1#NXswEO)OC`W)NUtVq$PmP+(wSV4f)B%*xE5XQHq%Wf4Ei zK?eSVn*|lN^RwDAG6!2vzN@c1`L#SRm!+PerHO&5o}qD*!Zrm)HUmb<>FfcFO3dGw zB{vHSyk+8QjFM#+FV|*llArDt%&5;D?^;oiS(I3knV&bkG?>u?MPP3*qq)0|f)YZF zl4hk0ySTkFW20wNTTx2L9UJ=(>I1NN@yaPq~PzT UpoFAMNkIe2qV4%1j1yM_0Bep`4*&oF delta 216 zcmZo@;Am*zkO>a-$t+1#NXswEO)OC`W)NUtWMptqP+(wSV45i7%*w=|rxUO-Wf4Ei zVFv!gn*|ki^0QhqG6$PazN@c1`K3HBhn}IOfrWvdVUxl(1x7XlMw{vE0gOt_Uzu$- z3knD@^EaBwvWq8bGdAXC=B1=oOs@`R)S4a}%;+(FLolPck!F<)ySTM7W1})y+A|{F vCABOwIn_BoCABy{v^cd0#6l92pT0DNQH2F0GyQxBqa+7R&G!5d#)+!|XhT0v diff --git a/src/ProjectTemplates/test/Helpers/Project.cs b/src/ProjectTemplates/test/Helpers/Project.cs index 5d2ffcc237..8331772bf3 100644 --- a/src/ProjectTemplates/test/Helpers/Project.cs +++ b/src/ProjectTemplates/test/Helpers/Project.cs @@ -24,6 +24,9 @@ namespace Templates.Test.Helpers public const string DefaultFramework = "netcoreapp3.0"; + public static bool IsCIEnvironment => typeof(Project).Assembly.GetCustomAttributes() + .Any(a => a.Key == "ContinuousIntegrationBuild"); + public SemaphoreSlim DotNetNewLock { get; set; } public SemaphoreSlim NodeLock { get; set; } public string ProjectName { get; set; } diff --git a/src/ProjectTemplates/test/ProjectTemplates.Tests.csproj b/src/ProjectTemplates/test/ProjectTemplates.Tests.csproj index b0bfda0a57..7b26d044d2 100644 --- a/src/ProjectTemplates/test/ProjectTemplates.Tests.csproj +++ b/src/ProjectTemplates/test/ProjectTemplates.Tests.csproj @@ -57,8 +57,12 @@ <_Parameter1>TestPackageRestorePath <_Parameter2>$(TestPackageRestorePath) + + <_Parameter1>ContinuousIntegrationBuild + <_Parameter2>true + - + $([MSBuild]::NormalizePath('$(OutputPath)$(TestTemplateCreationFolder)')) diff --git a/src/ProjectTemplates/test/SpaTemplateTest/SpaTemplateTestBase.cs b/src/ProjectTemplates/test/SpaTemplateTest/SpaTemplateTestBase.cs index c019aad9c7..0c0b37a4b8 100644 --- a/src/ProjectTemplates/test/SpaTemplateTest/SpaTemplateTestBase.cs +++ b/src/ProjectTemplates/test/SpaTemplateTest/SpaTemplateTestBase.cs @@ -84,7 +84,7 @@ namespace Templates.Test.SpaTemplateTest Assert.True(0 == buildResult.ExitCode, ErrorMessages.GetFailedProcessMessage("build", Project, buildResult)); // localdb is not installed on the CI machines, so skip it. - var shouldVisitFetchData = !useLocalDb; + var shouldVisitFetchData = !(useLocalDb && Project.IsCIEnvironment); if (usesAuth) {