[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.
This commit is contained in:
Javier Calvarro Nelson 2019-08-13 08:53:41 +02:00 committed by GitHub
parent eb966eb605
commit 826ed7504b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 836 additions and 640 deletions

View File

@ -5,6 +5,7 @@
--> -->
<Project> <Project>
<ItemGroup> <ItemGroup>
<ProjectReferenceProvider Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" ProjectPath="$(RepoRoot)src\Identity\ApiAuthorization.IdentityServer\src\Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity.Specification.Tests" ProjectPath="$(RepoRoot)src\Identity\Specification.Tests\src\Microsoft.AspNetCore.Identity.Specification.Tests.csproj" /> <ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity.Specification.Tests" ProjectPath="$(RepoRoot)src\Identity\Specification.Tests\src\Microsoft.AspNetCore.Identity.Specification.Tests.csproj" />
<ProjectReferenceProvider Include="Microsoft.Web.Xdt.Extensions" ProjectPath="$(RepoRoot)src\SiteExtensions\Microsoft.Web.Xdt.Extensions\src\Microsoft.Web.Xdt.Extensions.csproj" /> <ProjectReferenceProvider Include="Microsoft.Web.Xdt.Extensions" ProjectPath="$(RepoRoot)src\SiteExtensions\Microsoft.Web.Xdt.Extensions\src\Microsoft.Web.Xdt.Extensions.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.DeveloperCertificates.XPlat" ProjectPath="$(RepoRoot)src\Tools\FirstRunCertGenerator\src\Microsoft.AspNetCore.DeveloperCertificates.XPlat.csproj" /> <ProjectReferenceProvider Include="Microsoft.AspNetCore.DeveloperCertificates.XPlat" ProjectPath="$(RepoRoot)src\Tools\FirstRunCertGenerator\src\Microsoft.AspNetCore.DeveloperCertificates.XPlat.csproj" />
@ -44,7 +45,6 @@
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Routing" ProjectPath="$(RepoRoot)src\Http\Routing\src\Microsoft.AspNetCore.Routing.csproj" RefProjectPath="$(RepoRoot)src\Http\Routing\ref\Microsoft.AspNetCore.Routing.csproj" /> <ProjectReferenceProvider Include="Microsoft.AspNetCore.Routing" ProjectPath="$(RepoRoot)src\Http\Routing\src\Microsoft.AspNetCore.Routing.csproj" RefProjectPath="$(RepoRoot)src\Http\Routing\ref\Microsoft.AspNetCore.Routing.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.WebUtilities" ProjectPath="$(RepoRoot)src\Http\WebUtilities\src\Microsoft.AspNetCore.WebUtilities.csproj" RefProjectPath="$(RepoRoot)src\Http\WebUtilities\ref\Microsoft.AspNetCore.WebUtilities.csproj" /> <ProjectReferenceProvider Include="Microsoft.AspNetCore.WebUtilities" ProjectPath="$(RepoRoot)src\Http\WebUtilities\src\Microsoft.AspNetCore.WebUtilities.csproj" RefProjectPath="$(RepoRoot)src\Http\WebUtilities\ref\Microsoft.AspNetCore.WebUtilities.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Html.Abstractions" ProjectPath="$(RepoRoot)src\Html\Abstractions\src\Microsoft.AspNetCore.Html.Abstractions.csproj" RefProjectPath="$(RepoRoot)src\Html\Abstractions\ref\Microsoft.AspNetCore.Html.Abstractions.csproj" /> <ProjectReferenceProvider Include="Microsoft.AspNetCore.Html.Abstractions" ProjectPath="$(RepoRoot)src\Html\Abstractions\src\Microsoft.AspNetCore.Html.Abstractions.csproj" RefProjectPath="$(RepoRoot)src\Html\Abstractions\ref\Microsoft.AspNetCore.Html.Abstractions.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" ProjectPath="$(RepoRoot)src\Identity\ApiAuthorization.IdentityServer\src\Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj" RefProjectPath="$(RepoRoot)src\Identity\ApiAuthorization.IdentityServer\ref\Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity" ProjectPath="$(RepoRoot)src\Identity\Core\src\Microsoft.AspNetCore.Identity.csproj" RefProjectPath="$(RepoRoot)src\Identity\Core\ref\Microsoft.AspNetCore.Identity.csproj" /> <ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity" ProjectPath="$(RepoRoot)src\Identity\Core\src\Microsoft.AspNetCore.Identity.csproj" RefProjectPath="$(RepoRoot)src\Identity\Core\ref\Microsoft.AspNetCore.Identity.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" ProjectPath="$(RepoRoot)src\Identity\EntityFrameworkCore\src\Microsoft.AspNetCore.Identity.EntityFrameworkCore.csproj" RefProjectPath="$(RepoRoot)src\Identity\EntityFrameworkCore\ref\Microsoft.AspNetCore.Identity.EntityFrameworkCore.csproj" /> <ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" ProjectPath="$(RepoRoot)src\Identity\EntityFrameworkCore\src\Microsoft.AspNetCore.Identity.EntityFrameworkCore.csproj" RefProjectPath="$(RepoRoot)src\Identity\EntityFrameworkCore\ref\Microsoft.AspNetCore.Identity.EntityFrameworkCore.csproj" />
<ProjectReferenceProvider Include="Microsoft.Extensions.Identity.Core" ProjectPath="$(RepoRoot)src\Identity\Extensions.Core\src\Microsoft.Extensions.Identity.Core.csproj" RefProjectPath="$(RepoRoot)src\Identity\Extensions.Core\ref\Microsoft.Extensions.Identity.Core.csproj" /> <ProjectReferenceProvider Include="Microsoft.Extensions.Identity.Core" ProjectPath="$(RepoRoot)src\Identity\Extensions.Core\src\Microsoft.Extensions.Identity.Core.csproj" RefProjectPath="$(RepoRoot)src\Identity\Extensions.Core\ref\Microsoft.Extensions.Identity.Core.csproj" />

View File

@ -222,11 +222,11 @@
<FSharpCorePackageVersion>4.2.1</FSharpCorePackageVersion> <FSharpCorePackageVersion>4.2.1</FSharpCorePackageVersion>
<GoogleProtobufPackageVersion>3.8.0</GoogleProtobufPackageVersion> <GoogleProtobufPackageVersion>3.8.0</GoogleProtobufPackageVersion>
<GrpcAspNetCorePackageVersion>0.1.22-pre3</GrpcAspNetCorePackageVersion> <GrpcAspNetCorePackageVersion>0.1.22-pre3</GrpcAspNetCorePackageVersion>
<IdentityServer4AspNetIdentityPackageVersion>3.0.0-preview3.4</IdentityServer4AspNetIdentityPackageVersion> <IdentityServer4AspNetIdentityPackageVersion>3.0.0-preview7.33</IdentityServer4AspNetIdentityPackageVersion>
<IdentityServer4EntityFrameworkPackageVersion>3.0.0-preview3.4</IdentityServer4EntityFrameworkPackageVersion> <IdentityServer4EntityFrameworkPackageVersion>3.0.0-preview7.33</IdentityServer4EntityFrameworkPackageVersion>
<IdentityServer4PackageVersion>3.0.0-preview3.4</IdentityServer4PackageVersion> <IdentityServer4PackageVersion>3.0.0-preview7.33</IdentityServer4PackageVersion>
<IdentityServer4StoragePackageVersion>3.0.0-preview3.4</IdentityServer4StoragePackageVersion> <IdentityServer4StoragePackageVersion>3.0.0-preview7.33</IdentityServer4StoragePackageVersion>
<IdentityServer4EntityFrameworkStoragePackageVersion>3.0.0-preview3.4</IdentityServer4EntityFrameworkStoragePackageVersion> <IdentityServer4EntityFrameworkStoragePackageVersion>3.0.0-preview7.33</IdentityServer4EntityFrameworkStoragePackageVersion>
<MessagePackPackageVersion>1.7.3.7</MessagePackPackageVersion> <MessagePackPackageVersion>1.7.3.7</MessagePackPackageVersion>
<MoqPackageVersion>4.10.0</MoqPackageVersion> <MoqPackageVersion>4.10.0</MoqPackageVersion>
<MonoCecilPackageVersion>0.10.1</MonoCecilPackageVersion> <MonoCecilPackageVersion>0.10.1</MonoCecilPackageVersion>

View File

@ -1,18 +0,0 @@
<!-- This file is automatically generated. -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<Compile Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer.netcoreapp3.0.cs" />
<Reference Include="IdentityServer4.AspNetIdentity" />
<Reference Include="IdentityServer4.EntityFramework" />
<Reference Include="IdentityServer4.EntityFramework.Storage" />
<Reference Include="IdentityServer4" />
<Reference Include="IdentityServer4.Storage" />
<Reference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<Reference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<Reference Include="Microsoft.AspNetCore.Identity.UI" />
<Reference Include="Microsoft.AspNetCore.Mvc" />
</ItemGroup>
</Project>

View File

@ -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<TUser> : Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityDbContext<TUser>, IdentityServer4.EntityFramework.Interfaces.IPersistedGrantDbContext, System.IDisposable where TUser : Microsoft.AspNetCore.Identity.IdentityUser
{
public ApiAuthorizationDbContext(Microsoft.EntityFrameworkCore.DbContextOptions options, Microsoft.Extensions.Options.IOptions<IdentityServer4.EntityFramework.Options.OperationalStoreOptions> operationalStoreOptions) { }
public Microsoft.EntityFrameworkCore.DbSet<IdentityServer4.EntityFramework.Entities.DeviceFlowCodes> DeviceFlowCodes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public Microsoft.EntityFrameworkCore.DbSet<IdentityServer4.EntityFramework.Entities.PersistedGrant> PersistedGrants { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
System.Threading.Tasks.Task<int> 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<IdentityServer4.Models.ApiResource>
{
public ApiResourceCollection() { }
public ApiResourceCollection(System.Collections.Generic.IList<IdentityServer4.Models.ApiResource> list) { }
public IdentityServer4.Models.ApiResource this[string key] { get { throw null; } }
public void AddApiResource(string name, System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceBuilder> configure) { }
public void AddIdentityServerJwt(string name, System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceBuilder> 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<IdentityServer4.Models.Client>
{
public ClientCollection() { }
public ClientCollection(System.Collections.Generic.IList<IdentityServer4.Models.Client> list) { }
public IdentityServer4.Models.Client this[string key] { get { throw null; } }
public void AddIdentityServerSPA(string clientId, System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder> configure) { }
public void AddNativeApp(string clientId, System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder> configure) { }
public void AddRange(params IdentityServer4.Models.Client[] clients) { }
public void AddSPA(string clientId, System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder> 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<string, string> 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<IdentityServer4.Models.IdentityResource>
{
public IdentityResourceCollection() { }
public IdentityResourceCollection(System.Collections.Generic.IList<IdentityServer4.Models.IdentityResource> list) { }
public IdentityServer4.Models.IdentityResource this[string key] { get { throw null; } }
public void AddAddress() { }
public void AddAddress(System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder> configure) { }
public void AddEmail() { }
public void AddEmail(System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder> configure) { }
public void AddOpenId() { }
public void AddOpenId(System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder> configure) { }
public void AddPhone() { }
public void AddPhone(System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder> configure) { }
public void AddProfile() { }
public void AddProfile(System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder> 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<TUser, TContext>(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<TUser, TContext>(this Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder builder, System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiAuthorizationOptions> 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; }
}
}

View File

@ -3,9 +3,14 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<UserSecretsId>aspnet-ApiAuthSample-12ED8ECC-9EF1-4D31-87B4-1405B3198E5E</UserSecretsId> <UserSecretsId>aspnet-ApiAuthSample-12ED8ECC-9EF1-4D31-87B4-1405B3198E5E</UserSecretsId>
<!-- We are a package that depends on the shared framework, this allows us to
avoid errors during restore -->
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<!-- Remove the reference to Microsoft.AspNetCore.App from IdentityServer4 -->
<FrameworkReference Remove="Microsoft.AspNetCore.App" />
<Reference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" /> <Reference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" />
<Reference Include="Microsoft.AspNetCore.CookiePolicy" /> <Reference Include="Microsoft.AspNetCore.CookiePolicy" />
<Reference Include="Microsoft.AspNetCore.DataProtection.Extensions" /> <Reference Include="Microsoft.AspNetCore.DataProtection.Extensions" />

View File

@ -5,19 +5,29 @@
<Description>ASP.NET Core API Authorization package powered by Identity Server.</Description> <Description>ASP.NET Core API Authorization package powered by Identity Server.</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;apiauth;identity</PackageTags> <PackageTags>aspnetcore;apiauth;identity</PackageTags>
<HasReferenceAssembly>false</HasReferenceAssembly>
<IsShippingPackage>true</IsShippingPackage> <IsShippingPackage>true</IsShippingPackage>
<HasReferenceAssembly>false</HasReferenceAssembly>
<!-- We are a package that depends on the shared framework, this allows us to
avoid errors during restore -->
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<!-- Remove the reference to Microsoft.AspNetCore.App from IdentityServer4 -->
<FrameworkReference Remove="Microsoft.AspNetCore.App" />
<Reference Include="IdentityServer4.AspNetIdentity" /> <Reference Include="IdentityServer4.AspNetIdentity" />
<Reference Include="IdentityServer4.EntityFramework" /> <Reference Include="IdentityServer4.EntityFramework" />
<Reference Include="IdentityServer4.EntityFramework.Storage" /> <Reference Include="IdentityServer4.EntityFramework.Storage" />
<Reference Include="IdentityServer4" /> <Reference Include="IdentityServer4" />
<Reference Include="IdentityServer4.Storage" /> <Reference Include="IdentityServer4.Storage" />
<Reference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<Reference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" /> <Reference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<Reference Include="Microsoft.AspNetCore.Identity.UI" /> <Reference Include="Microsoft.AspNetCore.Identity.UI" />
<!-- These references don't matter as they'll be replaced by the shared framework reference -->
<Reference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<Reference Include="Microsoft.AspNetCore.Mvc" /> <Reference Include="Microsoft.AspNetCore.Mvc" />
<Reference Include="Microsoft.Extensions.Http" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -2,9 +2,15 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<!-- We are a package that depends on the shared framework, this allows us to
avoid errors during restore -->
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<!-- Remove the reference to Microsoft.AspNetCore.App from IdentityServer4 -->
<FrameworkReference Remove="Microsoft.AspNetCore.App" />
<Reference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" /> <Reference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" />
<Compile Include="$(SharedSourceRoot)test\SkipOnHelixAttribute.cs" /> <Compile Include="$(SharedSourceRoot)test\SkipOnHelixAttribute.cs" />
</ItemGroup> </ItemGroup>

View File

@ -20,6 +20,7 @@
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="${MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="${MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="${MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="${MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="${MicrosoftAspNetCoreIdentityUIPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " /> <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="${MicrosoftAspNetCoreIdentityUIPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="${MicrosoftEntityFrameworkCoreRelationalPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="${MicrosoftEntityFrameworkCoreSqlServerPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' == 'True'" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="${MicrosoftEntityFrameworkCoreSqlServerPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' == 'True'" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="${MicrosoftEntityFrameworkCoreSqlitePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' != 'True'" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="${MicrosoftEntityFrameworkCoreSqlitePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' != 'True'" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="${MicrosoftEntityFrameworkCoreToolsPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="${MicrosoftEntityFrameworkCoreToolsPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />

View File

@ -12,6 +12,7 @@
<!-- Lists the versions of dependencies not built in this repo. Packages produced from this repo should be listed as a PackageVersionVariableReference. --> <!-- Lists the versions of dependencies not built in this repo. Packages produced from this repo should be listed as a PackageVersionVariableReference. -->
<GeneratedContentProperties> <GeneratedContentProperties>
MicrosoftEntityFrameworkCoreSqlitePackageVersion=$(MicrosoftEntityFrameworkCoreSqlitePackageVersion); MicrosoftEntityFrameworkCoreSqlitePackageVersion=$(MicrosoftEntityFrameworkCoreSqlitePackageVersion);
MicrosoftEntityFrameworkCoreRelationalPackageVersion=$(MicrosoftEntityFrameworkCoreRelationalPackageVersion);
MicrosoftEntityFrameworkCoreSqlServerPackageVersion=$(MicrosoftEntityFrameworkCoreSqlServerPackageVersion); MicrosoftEntityFrameworkCoreSqlServerPackageVersion=$(MicrosoftEntityFrameworkCoreSqlServerPackageVersion);
MicrosoftEntityFrameworkCoreToolsPackageVersion=$(MicrosoftEntityFrameworkCoreToolsPackageVersion); MicrosoftEntityFrameworkCoreToolsPackageVersion=$(MicrosoftEntityFrameworkCoreToolsPackageVersion);
MicrosoftExtensionsHostingPackageVersion=$(MicrosoftExtensionsHostingPackageVersion); MicrosoftExtensionsHostingPackageVersion=$(MicrosoftExtensionsHostingPackageVersion);

View File

@ -17,6 +17,7 @@
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="${MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="${MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="${MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="${MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="${MicrosoftAspNetCoreIdentityUIPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " /> <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="${MicrosoftAspNetCoreIdentityUIPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="${MicrosoftEntityFrameworkCoreRelationalPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="${MicrosoftEntityFrameworkCoreSqlServerPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' == 'True'" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="${MicrosoftEntityFrameworkCoreSqlServerPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' == 'True'" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="${MicrosoftEntityFrameworkCoreSqlitePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' != 'True'" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="${MicrosoftEntityFrameworkCoreSqlitePackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' AND '$(UseLocalDB)' != 'True'" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="${MicrosoftEntityFrameworkCoreToolsPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="${MicrosoftEntityFrameworkCoreToolsPackageVersion}" Condition=" '$(IndividualLocalAuth)' == 'True' " />

View File

@ -1701,8 +1701,7 @@
"base64-js": { "base64-js": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz",
"integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw=="
"dev": true
}, },
"base64id": { "base64id": {
"version": "1.0.0", "version": "1.0.0",
@ -2747,6 +2746,11 @@
"randomfill": "^1.0.3" "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": { "css-parse": {
"version": "1.7.0", "version": "1.7.0",
"resolved": "https://registry.npmjs.org/css-parse/-/css-parse-1.7.0.tgz", "resolved": "https://registry.npmjs.org/css-parse/-/css-parse-1.7.0.tgz",
@ -7153,10 +7157,13 @@
"dev": true "dev": true
}, },
"oidc-client": { "oidc-client": {
"version": "1.9.0-beta.3", "version": "1.9.0-beta.4",
"resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.9.0-beta.3.tgz", "resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.9.0-beta.4.tgz",
"integrity": "sha512-8JqmesN7n7sQrdeEYiuWyWjNp/6cZGOHU5IaYrULm/qdYo6cAheeZl93bDkob6MdfbQMsQ2HGG/+EOHFdFQcSQ==", "integrity": "sha512-BE6o220w9kDTicmsX324Z5t3Gg20G9NgQjCOFP6SUY7glJYBohyw9DVPt/khPmmg+wabufJq1tH2zyEadMf7Pw==",
"requires": { "requires": {
"base64-js": "^1.3.0",
"core-js": "^2.6.4",
"crypto-js": "^3.1.9-1",
"uuid": "^3.3.2" "uuid": "^3.3.2"
} }
}, },

View File

@ -26,7 +26,7 @@
"bootstrap": "^4.3.1", "bootstrap": "^4.3.1",
"core-js": "^2.6.5", "core-js": "^2.6.5",
"jquery": "3.4.1", "jquery": "3.4.1",
"oidc-client": "^1.9.0-beta.1", "oidc-client": "^1.9.0-beta.4",
"popper.js": "^1.14.3", "popper.js": "^1.14.3",
"rxjs": "^6.4.0", "rxjs": "^6.4.0",
"zone.js": "~0.9.1" "zone.js": "~0.9.1"

View File

@ -21,7 +21,6 @@ export interface FailureAuthenticationResult {
export interface RedirectAuthenticationResult { export interface RedirectAuthenticationResult {
status: AuthenticationResultStatus.Redirect; status: AuthenticationResultStatus.Redirect;
redirectUrl: string;
} }
export enum AuthenticationResultStatus { export enum AuthenticationResultStatus {
@ -34,18 +33,6 @@ export interface IUser {
name: string; name: string;
} }
// Private interfaces
enum LoginMode {
Silent,
PopUp,
Redirect
}
interface IAuthenticationState {
mode: LoginMode;
userState?: any;
}
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
@ -86,7 +73,7 @@ export class AuthorizeService {
await this.ensureUserManagerInitialized(); await this.ensureUserManagerInitialized();
let user: User = null; let user: User = null;
try { try {
user = await this.userManager.signinSilent(this.createArguments(LoginMode.Silent)); user = await this.userManager.signinSilent(this.createArguments());
this.userSubject.next(user.profile); this.userSubject.next(user.profile);
return this.success(state); return this.success(state);
} catch (silentError) { } catch (silentError) {
@ -97,7 +84,7 @@ export class AuthorizeService {
if (this.popUpDisabled) { if (this.popUpDisabled) {
throw new Error('Popup disabled. Change \'authorize.service.ts:AuthorizeService.popupDisabled\' to false to enable it.'); 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); this.userSubject.next(user.profile);
return this.success(state); return this.success(state);
} catch (popupError) { } catch (popupError) {
@ -110,9 +97,8 @@ export class AuthorizeService {
// PopUps might be blocked by the user, fallback to redirect // PopUps might be blocked by the user, fallback to redirect
try { try {
const signInRequest = await this.userManager.createSigninRequest( await this.userManager.signinRedirect(this.createArguments(state));
this.createArguments(LoginMode.Redirect, state)); return this.redirect();
return this.redirect(signInRequest.url);
} catch (redirectError) { } catch (redirectError) {
console.log('Redirect authentication error: ', redirectError); console.log('Redirect authentication error: ', redirectError);
return this.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<IAuthenticationResult> { public async completeSignIn(url: string): Promise<IAuthenticationResult> {
await this.ensureUserManagerInitialized();
try { try {
const { state } = await (this.userManager as any).readSigninResponseState(url, this.userManager.settings.stateStore); await this.ensureUserManagerInitialized();
if (state.request_type === 'si:r' || !state.request_type) { const user = await this.userManager.signinCallback(url);
const user = await this.userManager.signinRedirectCallback(url); this.userSubject.next(user && user.profile);
this.userSubject.next(user.profile); return this.success(user && user.state);
return this.success(state.data.userState); } catch (error) {
console.log('There was an error signing in: ', error);
} return this.error('There was an error signing in.');
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.');
} }
} }
// 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<IAuthenticationResult> { public async signOut(state: any): Promise<IAuthenticationResult> {
await this.ensureUserManagerInitialized();
try { try {
await this.userManager.signoutPopup(this.createArguments(LoginMode.PopUp)); await this.ensureUserManagerInitialized();
await this.userManager.signoutPopup(this.createArguments());
this.userSubject.next(null); this.userSubject.next(null);
return this.success(state); return this.success(state);
} catch (popupSignOutError) { } catch (popupSignOutError) {
console.log('Popup signout error: ', popupSignOutError); console.log('Popup signout error: ', popupSignOutError);
try { try {
const signInRequest = await this.userManager.createSignoutRequest( await this.userManager.signoutRedirect(this.createArguments(state));
this.createArguments(LoginMode.Redirect, state)); return this.redirect();
return this.redirect(signInRequest.url);
} catch (redirectSignOutError) { } catch (redirectSignOutError) {
console.log('Redirect signout error: ', popupSignOutError); console.log('Redirect signout error: ', popupSignOutError);
return this.error(redirectSignOutError); 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<IAuthenticationResult> { public async completeSignOut(url: string): Promise<IAuthenticationResult> {
await this.ensureUserManagerInitialized(); await this.ensureUserManagerInitialized();
try { try {
const { state } = await (this.userManager as any).readSignoutResponseState(url, this.userManager.settings.stateStore); const state = await this.userManager.signoutCallback(url);
if (state) { this.userSubject.next(null);
if (state.request_type === 'so:r') { return this.success(state && state.data);
await this.userManager.signoutRedirectCallback(url); } catch (error) {
this.userSubject.next(null); console.log(`There was an error trying to log out '${error}'.`);
return this.success(state.data.userState); return this.error(error);
}
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.');
} }
} }
private createArguments(mode: LoginMode, state?: any): any { private createArguments(state?: any): any {
if (mode !== LoginMode.Silent) { return { useReplaceToNavigate: true, data: state };
return { data: { mode, userState: state } };
} else {
return { data: { mode, userState: state }, redirect_uri: this.userManager.settings.redirect_uri };
}
} }
private error(message: string): IAuthenticationResult { private error(message: string): IAuthenticationResult {
@ -221,8 +161,8 @@ export class AuthorizeService {
return { status: AuthenticationResultStatus.Success, state }; return { status: AuthenticationResultStatus.Success, state };
} }
private redirect(redirectUrl: string): IAuthenticationResult { private redirect(): IAuthenticationResult {
return { status: AuthenticationResultStatus.Redirect, redirectUrl }; return { status: AuthenticationResultStatus.Redirect };
} }
private async ensureUserManagerInitialized(): Promise<void> { private async ensureUserManagerInitialized(): Promise<void> {

View File

@ -52,10 +52,6 @@ export class LoginComponent implements OnInit {
this.message.next(undefined); this.message.next(undefined);
switch (result.status) { switch (result.status) {
case AuthenticationResultStatus.Redirect: 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; break;
case AuthenticationResultStatus.Success: case AuthenticationResultStatus.Success:
await this.navigateToReturnUrl(returnUrl); await this.navigateToReturnUrl(returnUrl);

View File

@ -53,9 +53,6 @@ export class LogoutComponent implements OnInit {
const result = await this.authorizeService.signOut(state); const result = await this.authorizeService.signOut(state);
switch (result.status) { switch (result.status) {
case AuthenticationResultStatus.Redirect: 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; break;
case AuthenticationResultStatus.Success: case AuthenticationResultStatus.Success:
await this.navigateToReturnUrl(returnUrl); await this.navigateToReturnUrl(returnUrl);

View File

@ -10,52 +10,67 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Company.WebApplication1.Data.Migrations namespace Company.WebApplication1.Data.Migrations
{ {
[DbContext(typeof(ApplicationDbContext))] [DbContext(typeof(ApplicationDbContext))]
[Migration("00000000000000_CreateIdentitySchema")] [Migration("20190808120446_CreateIdentitySchema")]
partial class CreateIdentitySchema partial class CreateIdentitySchema
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3") .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13")
.HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<bool>("EmailConfirmed"); b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled"); b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd"); b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedUserName") b.Property<string>("NormalizedUserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("PasswordHash"); b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber"); b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed"); b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp"); b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled"); b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -74,26 +89,33 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
{ {
b.Property<string>("UserCode") b.Property<string>("UserCode")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<string>("DeviceCode") b.Property<string>("DeviceCode")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime?>("Expiration") b.Property<DateTime?>("Expiration")
.IsRequired(); .IsRequired()
.HasColumnType("datetime2");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.HasKey("UserCode"); b.HasKey("UserCode");
@ -101,51 +123,64 @@ namespace Company.WebApplication1.Data.Migrations
b.HasIndex("DeviceCode") b.HasIndex("DeviceCode")
.IsUnique(); .IsUnique();
b.HasIndex("Expiration");
b.ToTable("DeviceCodes"); b.ToTable("DeviceCodes");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
{ {
b.Property<string>("Key") b.Property<string>("Key")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<DateTime?>("Expiration"); b.Property<DateTime?>("Expiration")
.HasColumnType("datetime2");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(50)")
.HasMaxLength(50); .HasMaxLength(50);
b.HasKey("Key"); b.HasKey("Key");
b.HasIndex("SubjectId", "ClientId", "Type"); b.HasIndex("SubjectId", "ClientId", "Type", "Expiration");
b.ToTable("PersistedGrants"); b.ToTable("PersistedGrants");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -162,14 +197,18 @@ namespace Company.WebApplication1.Data.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.IsRequired(); .IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id"); b.HasKey("Id");
@ -182,14 +221,18 @@ namespace Company.WebApplication1.Data.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id"); b.HasKey("Id");
@ -201,15 +244,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderDisplayName"); b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey"); b.HasKey("LoginProvider", "ProviderKey");
@ -220,9 +267,11 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId"); b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId"); b.HasKey("UserId", "RoleId");
@ -233,15 +282,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Value"); b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name"); b.HasKey("UserId", "LoginProvider", "Name");

View File

@ -1,5 +1,4 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
namespace Company.WebApplication1.Data.Migrations namespace Company.WebApplication1.Data.Migrations
@ -86,7 +85,7 @@ namespace Company.WebApplication1.Data.Migrations
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:Identity", "1, 1"),
RoleId = table.Column<string>(nullable: false), RoleId = table.Column<string>(nullable: false),
ClaimType = table.Column<string>(nullable: true), ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true) ClaimValue = table.Column<string>(nullable: true)
@ -107,7 +106,7 @@ namespace Company.WebApplication1.Data.Migrations
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:Identity", "1, 1"),
UserId = table.Column<string>(nullable: false), UserId = table.Column<string>(nullable: false),
ClaimType = table.Column<string>(nullable: true), ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true) ClaimValue = table.Column<string>(nullable: true)
@ -233,9 +232,14 @@ namespace Company.WebApplication1.Data.Migrations
unique: true); unique: true);
migrationBuilder.CreateIndex( 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", table: "PersistedGrants",
columns: new[] { "SubjectId", "ClientId", "Type" }); columns: new[] { "SubjectId", "ClientId", "Type", "Expiration" });
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)

View File

@ -15,45 +15,60 @@ namespace Company.WebApplication1.Data.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3") .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13")
.HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<bool>("EmailConfirmed"); b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled"); b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd"); b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedUserName") b.Property<string>("NormalizedUserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("PasswordHash"); b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber"); b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed"); b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp"); b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled"); b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -72,26 +87,33 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
{ {
b.Property<string>("UserCode") b.Property<string>("UserCode")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<string>("DeviceCode") b.Property<string>("DeviceCode")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime?>("Expiration") b.Property<DateTime?>("Expiration")
.IsRequired(); .IsRequired()
.HasColumnType("datetime2");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.HasKey("UserCode"); b.HasKey("UserCode");
@ -99,51 +121,64 @@ namespace Company.WebApplication1.Data.Migrations
b.HasIndex("DeviceCode") b.HasIndex("DeviceCode")
.IsUnique(); .IsUnique();
b.HasIndex("Expiration");
b.ToTable("DeviceCodes"); b.ToTable("DeviceCodes");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
{ {
b.Property<string>("Key") b.Property<string>("Key")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<DateTime?>("Expiration"); b.Property<DateTime?>("Expiration")
.HasColumnType("datetime2");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(50)")
.HasMaxLength(50); .HasMaxLength(50);
b.HasKey("Key"); b.HasKey("Key");
b.HasIndex("SubjectId", "ClientId", "Type"); b.HasIndex("SubjectId", "ClientId", "Type", "Expiration");
b.ToTable("PersistedGrants"); b.ToTable("PersistedGrants");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -160,14 +195,18 @@ namespace Company.WebApplication1.Data.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.IsRequired(); .IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id"); b.HasKey("Id");
@ -180,14 +219,18 @@ namespace Company.WebApplication1.Data.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id"); b.HasKey("Id");
@ -199,15 +242,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderDisplayName"); b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey"); b.HasKey("LoginProvider", "ProviderKey");
@ -218,9 +265,11 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId"); b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId"); b.HasKey("UserId", "RoleId");
@ -231,15 +280,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Value"); b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name"); b.HasKey("UserId", "LoginProvider", "Name");

View File

@ -16,43 +16,58 @@ namespace Company.WebApplication1.Data.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3"); .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13");
modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<bool>("EmailConfirmed"); b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled"); b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd"); b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedUserName") b.Property<string>("NormalizedUserName")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("PasswordHash"); b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber"); b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed"); b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp"); b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled"); b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -70,26 +85,33 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
{ {
b.Property<string>("UserCode") b.Property<string>("UserCode")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<string>("DeviceCode") b.Property<string>("DeviceCode")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime?>("Expiration") b.Property<DateTime?>("Expiration")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.HasKey("UserCode"); b.HasKey("UserCode");
@ -97,51 +119,64 @@ namespace Company.WebApplication1.Data.Migrations
b.HasIndex("DeviceCode") b.HasIndex("DeviceCode")
.IsUnique(); .IsUnique();
b.HasIndex("Expiration");
b.ToTable("DeviceCodes"); b.ToTable("DeviceCodes");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
{ {
b.Property<string>("Key") b.Property<string>("Key")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<DateTime?>("Expiration"); b.Property<DateTime?>("Expiration")
.HasColumnType("TEXT");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(50); .HasMaxLength(50);
b.HasKey("Key"); b.HasKey("Key");
b.HasIndex("SubjectId", "ClientId", "Type"); b.HasIndex("SubjectId", "ClientId", "Type", "Expiration");
b.ToTable("PersistedGrants"); b.ToTable("PersistedGrants");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -156,14 +191,18 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -175,14 +214,18 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -194,15 +237,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderDisplayName"); b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey"); b.HasKey("LoginProvider", "ProviderKey");
@ -213,9 +260,11 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId"); b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId"); b.HasKey("UserId", "RoleId");
@ -226,15 +275,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Value"); b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name"); b.HasKey("UserId", "LoginProvider", "Name");

View File

@ -230,9 +230,14 @@ namespace Company.WebApplication1.Data.Migrations
unique: true); unique: true);
migrationBuilder.CreateIndex( 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", table: "PersistedGrants",
columns: new[] { "SubjectId", "ClientId", "Type" }); columns: new[] { "SubjectId", "ClientId", "Type", "Expiration" });
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)

View File

@ -14,43 +14,58 @@ namespace Company.WebApplication1.Data.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3"); .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13");
modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<bool>("EmailConfirmed"); b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled"); b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd"); b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedUserName") b.Property<string>("NormalizedUserName")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("PasswordHash"); b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber"); b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed"); b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp"); b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled"); b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -68,26 +83,33 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
{ {
b.Property<string>("UserCode") b.Property<string>("UserCode")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<string>("DeviceCode") b.Property<string>("DeviceCode")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime?>("Expiration") b.Property<DateTime?>("Expiration")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.HasKey("UserCode"); b.HasKey("UserCode");
@ -95,51 +117,64 @@ namespace Company.WebApplication1.Data.Migrations
b.HasIndex("DeviceCode") b.HasIndex("DeviceCode")
.IsUnique(); .IsUnique();
b.HasIndex("Expiration");
b.ToTable("DeviceCodes"); b.ToTable("DeviceCodes");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
{ {
b.Property<string>("Key") b.Property<string>("Key")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<DateTime?>("Expiration"); b.Property<DateTime?>("Expiration")
.HasColumnType("TEXT");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(50); .HasMaxLength(50);
b.HasKey("Key"); b.HasKey("Key");
b.HasIndex("SubjectId", "ClientId", "Type"); b.HasIndex("SubjectId", "ClientId", "Type", "Expiration");
b.ToTable("PersistedGrants"); b.ToTable("PersistedGrants");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -154,14 +189,18 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -173,14 +212,18 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -192,15 +235,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderDisplayName"); b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey"); b.HasKey("LoginProvider", "ProviderKey");
@ -211,9 +258,11 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId"); b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId"); b.HasKey("UserId", "RoleId");
@ -224,15 +273,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Value"); b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name"); b.HasKey("UserId", "LoginProvider", "Name");

View File

@ -3736,6 +3736,11 @@
"randomfill": "^1.0.3" "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": { "css-blank-pseudo": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/css-blank-pseudo/-/css-blank-pseudo-0.1.4.tgz", "resolved": "https://registry.npmjs.org/css-blank-pseudo/-/css-blank-pseudo-0.1.4.tgz",
@ -8560,11 +8565,21 @@
"integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==" "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg=="
}, },
"oidc-client": { "oidc-client": {
"version": "1.9.0-beta.3", "version": "1.9.0-beta.4",
"resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.9.0-beta.3.tgz", "resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.9.0-beta.4.tgz",
"integrity": "sha512-8JqmesN7n7sQrdeEYiuWyWjNp/6cZGOHU5IaYrULm/qdYo6cAheeZl93bDkob6MdfbQMsQ2HGG/+EOHFdFQcSQ==", "integrity": "sha512-BE6o220w9kDTicmsX324Z5t3Gg20G9NgQjCOFP6SUY7glJYBohyw9DVPt/khPmmg+wabufJq1tH2zyEadMf7Pw==",
"requires": { "requires": {
"base64-js": "^1.3.0",
"core-js": "^2.6.4",
"crypto-js": "^3.1.9-1",
"uuid": "^3.3.2" "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": { "on-finished": {

View File

@ -7,7 +7,7 @@
"bootstrap": "^4.1.3", "bootstrap": "^4.1.3",
"jquery": "^3.4.1", "jquery": "^3.4.1",
"merge": "^1.2.1", "merge": "^1.2.1",
"oidc-client": "^1.9.0-beta.1", "oidc-client": "^1.9.0-beta.4",
"react": "^16.0.0", "react": "^16.0.0",
"react-dom": "^16.0.0", "react-dom": "^16.0.0",
"react-router-bootstrap": "^0.24.4", "react-router-bootstrap": "^0.24.4",

View File

@ -43,7 +43,7 @@ export class AuthorizeService {
async signIn(state) { async signIn(state) {
await this.ensureUserManagerInitialized(); await this.ensureUserManagerInitialized();
try { try {
const silentUser = await this.userManager.signinSilent(this.createArguments(LoginMode.Silent)); const silentUser = await this.userManager.signinSilent(this.createArguments());
this.updateState(silentUser); this.updateState(silentUser);
return this.success(state); return this.success(state);
} catch (silentError) { } catch (silentError) {
@ -55,7 +55,7 @@ export class AuthorizeService {
throw new Error('Popup disabled. Change \'AuthorizeService.js:AuthorizeService._popupDisabled\' to false to enable it.') 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); this.updateState(popUpUser);
return this.success(state); return this.success(state);
} catch (popUpError) { } catch (popUpError) {
@ -68,9 +68,8 @@ export class AuthorizeService {
// PopUps might be blocked by the user, fallback to redirect // PopUps might be blocked by the user, fallback to redirect
try { try {
const signInRequest = await this.userManager.createSigninRequest( await this.userManager.signinRedirect(this.createArguments(state));
this.createArguments(LoginMode.Redirect, state)); return this.redirect();
return this.redirect(signInRequest.url);
} catch (redirectError) { } catch (redirectError) {
console.log("Redirect authentication error: ", redirectError); console.log("Redirect authentication error: ", redirectError);
return this.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) { async completeSignIn(url) {
await this.ensureUserManagerInitialized();
try { try {
const { state } = await this.userManager.readSigninResponseState(url, this.userManager.settings.stateStore); await this.ensureUserManagerInitialized();
if (state.request_type === 'si:r' || !state.request_type) { const user = await this.userManager.signinCallback(url);
let user = await this.userManager.signinRedirectCallback(url); this.updateState(user);
this.updateState(user); return this.success(user && user.state);
return this.success(state.data.userState); } catch (error) {
} console.log('There was an error signing in: ', error);
if (state.request_type === 'si:p') { return this.error('There was an error signing in.');
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.');
} }
} }
@ -119,15 +98,14 @@ export class AuthorizeService {
async signOut(state) { async signOut(state) {
await this.ensureUserManagerInitialized(); await this.ensureUserManagerInitialized();
try { try {
await this.userManager.signoutPopup(this.createArguments(LoginMode.PopUp)); await this.userManager.signoutPopup(this.createArguments());
this.updateState(undefined); this.updateState(undefined);
return this.success(state); return this.success(state);
} catch (popupSignOutError) { } catch (popupSignOutError) {
console.log("Popup signout error: ", popupSignOutError); console.log("Popup signout error: ", popupSignOutError);
try { try {
const signOutRequest = await this.userManager.createSignoutRequest( await this.userManager.signoutRedirect(this.createArguments(state));
this.createArguments(LoginMode.Redirect, state)); return this.redirect();
return this.redirect(signOutRequest.url);
} catch (redirectSignOutError) { } catch (redirectSignOutError) {
console.log("Redirect signout error: ", redirectSignOutError); console.log("Redirect signout error: ", redirectSignOutError);
return this.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) { async completeSignOut(url) {
await this.ensureUserManagerInitialized(); await this.ensureUserManagerInitialized();
try { try {
const { state } = await this.userManager.readSignoutResponseState(url, this.userManager.settings.stateStore); const response = await this.userManager.signoutCallback(url);
if (state) { this.updateState(null);
if (state.request_type === 'so:r') { return this.success(response && response.data);
await this.userManager.signoutRedirectCallback(url); } catch (error) {
this.userSubject.next(null); console.log(`There was an error trying to log out '${error}'.`);
return this.success(state.data.userState); return this.error(error);
}
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.');
} }
} }
@ -191,12 +154,8 @@ export class AuthorizeService {
} }
} }
createArguments(mode, state) { createArguments(state) {
if (mode !== LoginMode.Silent) { return { useReplaceToNavigate: true, data: state };
return { data: { mode, userState: state } };
} else {
return { data: { mode, userState: state }, redirect_uri: this.userManager.settings.redirect_uri };
}
} }
error(message) { error(message) {
@ -207,8 +166,8 @@ export class AuthorizeService {
return { status: AuthenticationResultStatus.Success, state }; return { status: AuthenticationResultStatus.Success, state };
} }
redirect(redirectUrl) { redirect() {
return { status: AuthenticationResultStatus.Redirect, redirectUrl }; return { status: AuthenticationResultStatus.Redirect };
} }
async ensureUserManagerInitialized() { async ensureUserManagerInitialized() {
@ -239,12 +198,6 @@ export class AuthorizeService {
static get instance() { return authService } static get instance() { return authService }
} }
const LoginMode = {
Silent: 'silent',
PopUp: 'popup',
Redirect: 'redirect'
}
const authService = new AuthorizeService(); const authService = new AuthorizeService();
export default authService; export default authService;

View File

@ -68,10 +68,6 @@ export class Login extends Component {
const result = await authService.signIn(state); const result = await authService.signIn(state);
switch (result.status) { switch (result.status) {
case AuthenticationResultStatus.Redirect: 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; break;
case AuthenticationResultStatus.Success: case AuthenticationResultStatus.Success:
await this.navigateToReturnUrl(returnUrl); await this.navigateToReturnUrl(returnUrl);

View File

@ -71,9 +71,6 @@ export class Logout extends Component {
const result = await authService.signOut(state); const result = await authService.signOut(state);
switch (result.status) { switch (result.status) {
case AuthenticationResultStatus.Redirect: 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; break;
case AuthenticationResultStatus.Success: case AuthenticationResultStatus.Success:
await this.navigateToReturnUrl(returnUrl); await this.navigateToReturnUrl(returnUrl);

View File

@ -10,52 +10,67 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Company.WebApplication1.Data.Migrations namespace Company.WebApplication1.Data.Migrations
{ {
[DbContext(typeof(ApplicationDbContext))] [DbContext(typeof(ApplicationDbContext))]
[Migration("00000000000000_CreateIdentitySchema")] [Migration("20190808120446_CreateIdentitySchema")]
partial class CreateIdentitySchema partial class CreateIdentitySchema
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3") .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13")
.HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<bool>("EmailConfirmed"); b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled"); b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd"); b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedUserName") b.Property<string>("NormalizedUserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("PasswordHash"); b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber"); b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed"); b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp"); b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled"); b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -74,26 +89,33 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
{ {
b.Property<string>("UserCode") b.Property<string>("UserCode")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<string>("DeviceCode") b.Property<string>("DeviceCode")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime?>("Expiration") b.Property<DateTime?>("Expiration")
.IsRequired(); .IsRequired()
.HasColumnType("datetime2");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.HasKey("UserCode"); b.HasKey("UserCode");
@ -101,51 +123,64 @@ namespace Company.WebApplication1.Data.Migrations
b.HasIndex("DeviceCode") b.HasIndex("DeviceCode")
.IsUnique(); .IsUnique();
b.HasIndex("Expiration");
b.ToTable("DeviceCodes"); b.ToTable("DeviceCodes");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
{ {
b.Property<string>("Key") b.Property<string>("Key")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<DateTime?>("Expiration"); b.Property<DateTime?>("Expiration")
.HasColumnType("datetime2");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(50)")
.HasMaxLength(50); .HasMaxLength(50);
b.HasKey("Key"); b.HasKey("Key");
b.HasIndex("SubjectId", "ClientId", "Type"); b.HasIndex("SubjectId", "ClientId", "Type", "Expiration");
b.ToTable("PersistedGrants"); b.ToTable("PersistedGrants");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -162,14 +197,18 @@ namespace Company.WebApplication1.Data.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.IsRequired(); .IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id"); b.HasKey("Id");
@ -182,14 +221,18 @@ namespace Company.WebApplication1.Data.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id"); b.HasKey("Id");
@ -201,15 +244,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderDisplayName"); b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey"); b.HasKey("LoginProvider", "ProviderKey");
@ -220,9 +267,11 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId"); b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId"); b.HasKey("UserId", "RoleId");
@ -233,15 +282,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Value"); b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name"); b.HasKey("UserId", "LoginProvider", "Name");

View File

@ -1,5 +1,4 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
namespace Company.WebApplication1.Data.Migrations namespace Company.WebApplication1.Data.Migrations
@ -86,7 +85,7 @@ namespace Company.WebApplication1.Data.Migrations
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:Identity", "1, 1"),
RoleId = table.Column<string>(nullable: false), RoleId = table.Column<string>(nullable: false),
ClaimType = table.Column<string>(nullable: true), ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true) ClaimValue = table.Column<string>(nullable: true)
@ -107,7 +106,7 @@ namespace Company.WebApplication1.Data.Migrations
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:Identity", "1, 1"),
UserId = table.Column<string>(nullable: false), UserId = table.Column<string>(nullable: false),
ClaimType = table.Column<string>(nullable: true), ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true) ClaimValue = table.Column<string>(nullable: true)
@ -233,9 +232,14 @@ namespace Company.WebApplication1.Data.Migrations
unique: true); unique: true);
migrationBuilder.CreateIndex( 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", table: "PersistedGrants",
columns: new[] { "SubjectId", "ClientId", "Type" }); columns: new[] { "SubjectId", "ClientId", "Type", "Expiration" });
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)

View File

@ -15,45 +15,60 @@ namespace Company.WebApplication1.Data.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3") .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13")
.HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<bool>("EmailConfirmed"); b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled"); b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd"); b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedUserName") b.Property<string>("NormalizedUserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("PasswordHash"); b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber"); b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed"); b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp"); b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled"); b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -72,26 +87,33 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
{ {
b.Property<string>("UserCode") b.Property<string>("UserCode")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<string>("DeviceCode") b.Property<string>("DeviceCode")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime?>("Expiration") b.Property<DateTime?>("Expiration")
.IsRequired(); .IsRequired()
.HasColumnType("datetime2");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.HasKey("UserCode"); b.HasKey("UserCode");
@ -99,51 +121,64 @@ namespace Company.WebApplication1.Data.Migrations
b.HasIndex("DeviceCode") b.HasIndex("DeviceCode")
.IsUnique(); .IsUnique();
b.HasIndex("Expiration");
b.ToTable("DeviceCodes"); b.ToTable("DeviceCodes");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
{ {
b.Property<string>("Key") b.Property<string>("Key")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<DateTime?>("Expiration"); b.Property<DateTime?>("Expiration")
.HasColumnType("datetime2");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("nvarchar(200)")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(50)")
.HasMaxLength(50); .HasMaxLength(50);
b.HasKey("Key"); b.HasKey("Key");
b.HasIndex("SubjectId", "ClientId", "Type"); b.HasIndex("SubjectId", "ClientId", "Type", "Expiration");
b.ToTable("PersistedGrants"); b.ToTable("PersistedGrants");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -160,14 +195,18 @@ namespace Company.WebApplication1.Data.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.IsRequired(); .IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id"); b.HasKey("Id");
@ -180,14 +219,18 @@ namespace Company.WebApplication1.Data.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id"); b.HasKey("Id");
@ -199,15 +242,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderDisplayName"); b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey"); b.HasKey("LoginProvider", "ProviderKey");
@ -218,9 +265,11 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId"); b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId"); b.HasKey("UserId", "RoleId");
@ -231,15 +280,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Value"); b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name"); b.HasKey("UserId", "LoginProvider", "Name");

View File

@ -16,43 +16,58 @@ namespace Company.WebApplication1.Data.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3"); .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13");
modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<bool>("EmailConfirmed"); b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled"); b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd"); b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedUserName") b.Property<string>("NormalizedUserName")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("PasswordHash"); b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber"); b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed"); b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp"); b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled"); b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -70,26 +85,33 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
{ {
b.Property<string>("UserCode") b.Property<string>("UserCode")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<string>("DeviceCode") b.Property<string>("DeviceCode")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime?>("Expiration") b.Property<DateTime?>("Expiration")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.HasKey("UserCode"); b.HasKey("UserCode");
@ -97,51 +119,64 @@ namespace Company.WebApplication1.Data.Migrations
b.HasIndex("DeviceCode") b.HasIndex("DeviceCode")
.IsUnique(); .IsUnique();
b.HasIndex("Expiration");
b.ToTable("DeviceCodes"); b.ToTable("DeviceCodes");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
{ {
b.Property<string>("Key") b.Property<string>("Key")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<DateTime?>("Expiration"); b.Property<DateTime?>("Expiration")
.HasColumnType("TEXT");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(50); .HasMaxLength(50);
b.HasKey("Key"); b.HasKey("Key");
b.HasIndex("SubjectId", "ClientId", "Type"); b.HasIndex("SubjectId", "ClientId", "Type", "Expiration");
b.ToTable("PersistedGrants"); b.ToTable("PersistedGrants");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -156,14 +191,18 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -175,14 +214,18 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -194,15 +237,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderDisplayName"); b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey"); b.HasKey("LoginProvider", "ProviderKey");
@ -213,9 +260,11 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId"); b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId"); b.HasKey("UserId", "RoleId");
@ -226,15 +275,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Value"); b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name"); b.HasKey("UserId", "LoginProvider", "Name");

View File

@ -230,9 +230,14 @@ namespace Company.WebApplication1.Data.Migrations
unique: true); unique: true);
migrationBuilder.CreateIndex( 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", table: "PersistedGrants",
columns: new[] { "SubjectId", "ClientId", "Type" }); columns: new[] { "SubjectId", "ClientId", "Type", "Expiration" });
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)

View File

@ -14,43 +14,58 @@ namespace Company.WebApplication1.Data.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "3.0.0-preview4.19174.3"); .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13");
modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<bool>("EmailConfirmed"); b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled"); b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd"); b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedUserName") b.Property<string>("NormalizedUserName")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("PasswordHash"); b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber"); b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed"); b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp"); b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled"); b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -68,26 +83,33 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
{ {
b.Property<string>("UserCode") b.Property<string>("UserCode")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<string>("DeviceCode") b.Property<string>("DeviceCode")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime?>("Expiration") b.Property<DateTime?>("Expiration")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.HasKey("UserCode"); b.HasKey("UserCode");
@ -95,51 +117,64 @@ namespace Company.WebApplication1.Data.Migrations
b.HasIndex("DeviceCode") b.HasIndex("DeviceCode")
.IsUnique(); .IsUnique();
b.HasIndex("Expiration");
b.ToTable("DeviceCodes"); b.ToTable("DeviceCodes");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
{ {
b.Property<string>("Key") b.Property<string>("Key")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<DateTime>("CreationTime"); b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(50000); .HasMaxLength(50000);
b.Property<DateTime?>("Expiration"); b.Property<DateTime?>("Expiration")
.HasColumnType("TEXT");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("TEXT")
.HasMaxLength(200); .HasMaxLength(200);
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(50); .HasMaxLength(50);
b.HasKey("Key"); b.HasKey("Key");
b.HasIndex("SubjectId", "ClientId", "Type"); b.HasIndex("SubjectId", "ClientId", "Type", "Expiration");
b.ToTable("PersistedGrants"); b.ToTable("PersistedGrants");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasColumnType("TEXT")
.HasMaxLength(256); .HasMaxLength(256);
b.HasKey("Id"); b.HasKey("Id");
@ -154,14 +189,18 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -173,14 +212,18 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType"); b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue"); b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id"); b.HasKey("Id");
@ -192,15 +235,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("ProviderDisplayName"); b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired(); .IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey"); b.HasKey("LoginProvider", "ProviderKey");
@ -211,9 +258,11 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId"); b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId"); b.HasKey("UserId", "RoleId");
@ -224,15 +273,19 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(128); .HasMaxLength(128);
b.Property<string>("Value"); b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name"); b.HasKey("UserId", "LoginProvider", "Name");

View File

@ -24,6 +24,9 @@ namespace Templates.Test.Helpers
public const string DefaultFramework = "netcoreapp3.0"; public const string DefaultFramework = "netcoreapp3.0";
public static bool IsCIEnvironment => typeof(Project).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.Any(a => a.Key == "ContinuousIntegrationBuild");
public SemaphoreSlim DotNetNewLock { get; set; } public SemaphoreSlim DotNetNewLock { get; set; }
public SemaphoreSlim NodeLock { get; set; } public SemaphoreSlim NodeLock { get; set; }
public string ProjectName { get; set; } public string ProjectName { get; set; }

View File

@ -57,8 +57,12 @@
<_Parameter1>TestPackageRestorePath</_Parameter1> <_Parameter1>TestPackageRestorePath</_Parameter1>
<_Parameter2>$(TestPackageRestorePath)</_Parameter2> <_Parameter2>$(TestPackageRestorePath)</_Parameter2>
</AssemblyAttribute> </AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(ContinuousIntegrationBuild)' == 'true'">
<_Parameter1>ContinuousIntegrationBuild</_Parameter1>
<_Parameter2>true</_Parameter2>
</AssemblyAttribute>
</ItemGroup> </ItemGroup>
<Target Name="PrepareForTest" BeforeTargets="CoreCompile" Condition="$(DesignTimeBuild) != true"> <Target Name="PrepareForTest" BeforeTargets="CoreCompile" Condition="$(DesignTimeBuild) != true">
<PropertyGroup> <PropertyGroup>
<TestTemplateCreationFolder>$([MSBuild]::NormalizePath('$(OutputPath)$(TestTemplateCreationFolder)'))</TestTemplateCreationFolder> <TestTemplateCreationFolder>$([MSBuild]::NormalizePath('$(OutputPath)$(TestTemplateCreationFolder)'))</TestTemplateCreationFolder>

View File

@ -84,7 +84,7 @@ namespace Templates.Test.SpaTemplateTest
Assert.True(0 == buildResult.ExitCode, ErrorMessages.GetFailedProcessMessage("build", Project, buildResult)); Assert.True(0 == buildResult.ExitCode, ErrorMessages.GetFailedProcessMessage("build", Project, buildResult));
// localdb is not installed on the CI machines, so skip it. // localdb is not installed on the CI machines, so skip it.
var shouldVisitFetchData = !useLocalDb; var shouldVisitFetchData = !(useLocalDb && Project.IsCIEnvironment);
if (usesAuth) if (usesAuth)
{ {