Browse Source

Merge branch 'dev' into eShopOnServiceFabric-Win

pull/808/head
Ramón Tomás 7 years ago
parent
commit
248a3ac82c
20 changed files with 728 additions and 841 deletions
  1. +25
    -18
      src/Services/Identity/Identity.API/Controllers/AccountController.cs
  2. +1
    -2
      src/Services/Identity/Identity.API/Data/ApplicationContextSeed.cs
  3. +1
    -5
      src/Services/Identity/Identity.API/Data/ApplicationDbContext.cs
  4. +0
    -246
      src/Services/Identity/Identity.API/Data/Migrations/20161020101725_extendProfile.Designer.cs
  5. +0
    -33
      src/Services/Identity/Identity.API/Data/Migrations/20161020101725_extendProfile.cs
  6. +1
    -1
      src/Services/Identity/Identity.API/Dockerfile
  7. +9
    -32
      src/Services/Identity/Identity.API/Identity.API.csproj
  8. +0
    -40
      src/Services/Identity/Identity.API/Migrations/20170604151240_Init-persisted-grant.cs
  9. +132
    -109
      src/Services/Identity/Identity.API/Migrations/20170912114036_Initial.Designer.cs
  10. +78
    -72
      src/Services/Identity/Identity.API/Migrations/20170912114036_Initial.cs
  11. +131
    -111
      src/Services/Identity/Identity.API/Migrations/ApplicationDbContextModelSnapshot.cs
  12. +55
    -8
      src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20170912114152_Initial.Designer.cs
  13. +146
    -112
      src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20170912114152_Initial.cs
  14. +53
    -6
      src/Services/Identity/Identity.API/Migrations/ConfigurationDb/ConfigurationDbContextModelSnapshot.cs
  15. +10
    -6
      src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20170912114120_Initial.Designer.cs
  16. +40
    -0
      src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20170912114120_Initial.cs
  17. +8
    -4
      src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/PersistedGrantDbContextModelSnapshot.cs
  18. +1
    -5
      src/Services/Identity/Identity.API/Models/ApplicationUser.cs
  19. +16
    -5
      src/Services/Identity/Identity.API/Program.cs
  20. +21
    -26
      src/Services/Identity/Identity.API/Startup.cs

+ 25
- 18
src/Services/Identity/Identity.API/Controllers/AccountController.cs View File

@ -2,26 +2,23 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using Identity.API.Models;
using Identity.API.Models.AccountViewModels;
using Identity.API.Services;
using IdentityModel;
using IdentityServer4.Quickstart.UI.Models;
using IdentityServer4.Models;
using IdentityServer4.Services;
using Microsoft.AspNetCore.Http.Authentication;
using IdentityServer4.Stores;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using IdentityServer4.Models;
using IdentityServer4.Stores;
using Identity.API.Services;
using Identity.API.Models;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Authorization;
using Identity.API.Models.AccountViewModels;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Authentication;
namespace IdentityServer4.Quickstart.UI.Controllers
{
@ -36,7 +33,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers
private readonly ILoginService<ApplicationUser> _loginService;
private readonly IIdentityServerInteractionService _interaction;
private readonly IClientStore _clientStore;
private readonly ILogger _logger;
private readonly ILogger<AccountController> _logger;
private readonly UserManager<ApplicationUser> _userManager;
public AccountController(
@ -45,13 +42,13 @@ namespace IdentityServer4.Quickstart.UI.Controllers
ILoginService<ApplicationUser> loginService,
IIdentityServerInteractionService interaction,
IClientStore clientStore,
ILoggerFactory loggerFactory,
ILogger<AccountController> logger,
UserManager<ApplicationUser> userManager)
{
_loginService = loginService;
_interaction = interaction;
_clientStore = clientStore;
_logger = loggerFactory.CreateLogger<AccountController>();
_logger = logger;
_userManager = userManager;
}
@ -69,6 +66,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers
}
var vm = await BuildLoginViewModelAsync(returnUrl, context);
ViewData["ReturnUrl"] = returnUrl;
return View(vm);
@ -97,6 +95,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers
};
await _loginService.SignIn(user);
// make sure the returnUrl is still valid, and if yes - redirect back to authorize endpoint
if (_interaction.IsValidReturnUrl(model.ReturnUrl))
{
@ -111,7 +110,9 @@ namespace IdentityServer4.Quickstart.UI.Controllers
// something went wrong, show form with error
var vm = await BuildLoginViewModelAsync(model);
ViewData["ReturnUrl"] = model.ReturnUrl;
return View(vm);
}
@ -180,6 +181,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers
public async Task<IActionResult> Logout(LogoutViewModel model)
{
var idp = User?.FindFirst(JwtClaimTypes.IdentityProvider)?.Value;
if (idp != null && idp != IdentityServerConstants.LocalIdentityProvider)
{
if (model.LogoutId == null)
@ -191,10 +193,15 @@ namespace IdentityServer4.Quickstart.UI.Controllers
}
string url = "/Account/Logout?logoutId=" + model.LogoutId;
try
{
// hack: try/catch to handle social providers that throw
await HttpContext.Authentication.SignOutAsync(idp, new AuthenticationProperties { RedirectUri = url });
await HttpContext.SignOutAsync(idp, new AuthenticationProperties
{
RedirectUri = url
});
}
catch (Exception ex)
{
@ -203,7 +210,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers
}
// delete authentication cookie
await HttpContext.Authentication.SignOutAsync();
await HttpContext.SignOutAsync();
// set this so UI rendering sees an anonymous user
HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity());
@ -217,7 +224,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers
public async Task<IActionResult> DeviceLogOut(string redirectUrl)
{
// delete authentication cookie
await HttpContext.Authentication.SignOutAsync();
await HttpContext.SignOutAsync();
// set this so UI rendering sees an anonymous user
HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity());


+ 1
- 2
src/Services/Identity/Identity.API/Data/ApplicationContextSeed.cs View File

@ -5,8 +5,8 @@
using Extensions.Logging;
using global::eShopOnContainers.Identity;
using global::Identity.API.Data;
using global::Identity.API.Extensions;
using global::Identity.API.Models;
using Identity.API.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
@ -16,7 +16,6 @@
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using System.Threading.Tasks;


+ 1
- 5
src/Services/Identity/Identity.API/Data/ApplicationDbContext.cs View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Identity.API.Models;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Identity.API.Models;
namespace Identity.API.Data
{


+ 0
- 246
src/Services/Identity/Identity.API/Data/Migrations/20161020101725_extendProfile.Designer.cs View File

@ -1,246 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Identity.API.Data;
namespace WebMVC.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20161020101725_extendProfile")]
partial class extendProfile
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.0.0-rtm-21431")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.HasIndex("UserId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("CardHolderName");
b.Property<string>("CardNumber");
b.Property<int>("CardType");
b.Property<string>("City");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Country");
b.Property<string>("CountryCode");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("Expiration");
b.Property<string>("LastName");
b.Property<double>("Latitude");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<double>("Longitude");
b.Property<string>("Name");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityNumber");
b.Property<string>("SecurityStamp");
b.Property<string>("State");
b.Property<string>("StateCode");
b.Property<string>("Street");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("ZipCode");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Claims")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Users")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
}
}
}

+ 0
- 33
src/Services/Identity/Identity.API/Data/Migrations/20161020101725_extendProfile.cs View File

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace WebMVC.Migrations
{
public partial class extendProfile : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "LastName",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Name",
table: "AspNetUsers",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "LastName",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "Name",
table: "AspNetUsers");
}
}
}

+ 1
- 1
src/Services/Identity/Identity.API/Dockerfile View File

@ -1,4 +1,4 @@
FROM microsoft/aspnetcore:1.1.2
FROM microsoft/aspnetcore:2.0.0
ARG source
WORKDIR /app
EXPOSE 80


+ 9
- 32
src/Services/Identity/Identity.API/Identity.API.csproj View File

@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<RuntimeFrameworkVersion>1.1.2</RuntimeFrameworkVersion>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeFrameworkVersion>2.0.0</RuntimeFrameworkVersion>
<UserSecretsId>aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5</UserSecretsId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
@ -16,32 +16,9 @@
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.2">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink.Loader" Version="14.1.0" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="1.0.1" />
<PackageReference Include="IdentityServer4.EntityFramework" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="2.0.0-rc1" />
<PackageReference Include="IdentityServer4.EntityFramework" Version="2.0.0-rc1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
</ItemGroup>
@ -51,10 +28,10 @@
</Target>
<ItemGroup>
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.4.337" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild3-final" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0-msbuild3-final" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.5.357" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>
<ItemGroup>


+ 0
- 40
src/Services/Identity/Identity.API/Migrations/20170604151240_Init-persisted-grant.cs View File

@ -1,40 +0,0 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Identity.API.Migrations
{
public partial class Initpersistedgrant : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PersistedGrants",
columns: table => new
{
Key = table.Column<string>(maxLength: 200, nullable: false),
ClientId = table.Column<string>(maxLength: 200, nullable: false),
CreationTime = table.Column<DateTime>(nullable: false),
Data = table.Column<string>(maxLength: 50000, nullable: false),
Expiration = table.Column<DateTime>(nullable: true),
SubjectId = table.Column<string>(maxLength: 200, nullable: true),
Type = table.Column<string>(maxLength: 50, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PersistedGrants", x => x.Key);
});
migrationBuilder.CreateIndex(
name: "IX_PersistedGrants_SubjectId_ClientId_Type",
table: "PersistedGrants",
columns: new[] { "SubjectId", "ClientId", "Type" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PersistedGrants");
}
}
}

src/Services/Identity/Identity.API/Data/Migrations/20161019122215_Init_Scheme.Designer.cs → src/Services/Identity/Identity.API/Migrations/20170912114036_Initial.Designer.cs View File

@ -1,44 +1,137 @@
using System;
// <auto-generated />
using Identity.API.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Identity.API.Data;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace WebMVC.Migrations
namespace Identity.API.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20161019122215_Init_Scheme")]
partial class Init_Scheme
[Migration("20170912114036_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "1.0.0-rtm-21431")
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
modelBuilder.Entity("Identity.API.Models.ApplicationUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("CardHolderName")
.IsRequired();
b.Property<string>("CardNumber")
.IsRequired();
b.Property<int>("CardType");
b.Property<string>("City")
.IsRequired();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Country")
.IsRequired();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("Expiration")
.IsRequired();
b.Property<string>("LastName")
.IsRequired();
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("Name")
.IsRequired();
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityNumber")
.IsRequired();
b.Property<string>("SecurityStamp");
b.Property<string>("State")
.IsRequired();
b.Property<string>("Street")
.IsRequired();
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.Property<string>("ZipCode")
.IsRequired();
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasName("RoleNameIndex");
.IsUnique()
.HasName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
@ -57,7 +150,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
@ -76,7 +169,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
@ -94,7 +187,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
@ -104,12 +197,10 @@ namespace WebMVC.Migrations
b.HasIndex("RoleId");
b.HasIndex("UserId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
@ -124,119 +215,51 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("CardHolderName");
b.Property<string>("CardNumber");
b.Property<int>("CardType");
b.Property<string>("City");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Country");
b.Property<string>("CountryCode");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("Expiration");
b.Property<double>("Latitude");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<double>("Longitude");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityNumber");
b.Property<string>("SecurityStamp");
b.Property<string>("State");
b.Property<string>("StateCode");
b.Property<string>("Street");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("ZipCode");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Claims")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Claims")
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Logins")
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Users")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Roles")
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

src/Services/Identity/Identity.API/Data/Migrations/20161019122215_Init_Scheme.cs → src/Services/Identity/Identity.API/Migrations/20170912114036_Initial.cs View File

@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Metadata;
using System;
using System.Collections.Generic;
namespace WebMVC.Migrations
namespace Identity.API.Migrations
{
public partial class Init_Scheme : Migration
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
@ -13,59 +13,47 @@ namespace WebMVC.Migrations
name: "AspNetRoles",
columns: table => new
{
Id = table.Column<string>(nullable: false),
ConcurrencyStamp = table.Column<string>(nullable: true),
Name = table.Column<string>(maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(maxLength: 256, nullable: true)
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
columns: table => new
{
UserId = table.Column<string>(nullable: false),
LoginProvider = table.Column<string>(nullable: false),
Name = table.Column<string>(nullable: false),
Value = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
});
migrationBuilder.CreateTable(
name: "AspNetUsers",
columns: table => new
{
Id = table.Column<string>(nullable: false),
AccessFailedCount = table.Column<int>(nullable: false),
CardHolderName = table.Column<string>(nullable: true),
CardNumber = table.Column<string>(nullable: true),
CardType = table.Column<int>(nullable: false),
City = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
Country = table.Column<string>(nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false),
Expiration = table.Column<string>(nullable: true),
LockoutEnabled = table.Column<bool>(nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
PasswordHash = table.Column<string>(nullable: true),
PhoneNumber = table.Column<string>(nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false),
SecurityNumber = table.Column<string>(nullable: true),
SecurityStamp = table.Column<string>(nullable: true),
State = table.Column<string>(nullable: true),
Street = table.Column<string>(nullable: true),
TwoFactorEnabled = table.Column<bool>(nullable: false),
UserName = table.Column<string>(maxLength: 256, nullable: true),
ZipCode = table.Column<string>(nullable: true)
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
AccessFailedCount = table.Column<int>(type: "int", nullable: false),
CardHolderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
CardNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
CardType = table.Column<int>(type: "int", nullable: false),
City = table.Column<string>(type: "nvarchar(max)", nullable: false),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
Country = table.Column<string>(type: "nvarchar(max)", nullable: false),
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false),
Expiration = table.Column<string>(type: "nvarchar(max)", nullable: false),
LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
LockoutEnabled = table.Column<bool>(type: "bit", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: true),
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false),
SecurityNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
SecurityStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
State = table.Column<string>(type: "nvarchar(max)", nullable: false),
Street = table.Column<string>(type: "nvarchar(max)", nullable: false),
TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false),
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
ZipCode = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
@ -76,11 +64,11 @@ namespace WebMVC.Migrations
name: "AspNetRoleClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true),
RoleId = table.Column<string>(nullable: false)
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true),
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
@ -97,11 +85,11 @@ namespace WebMVC.Migrations
name: "AspNetUserClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false)
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
@ -118,10 +106,10 @@ namespace WebMVC.Migrations
name: "AspNetUserLogins",
columns: table => new
{
LoginProvider = table.Column<string>(nullable: false),
ProviderKey = table.Column<string>(nullable: false),
ProviderDisplayName = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false)
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
ProviderKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
@ -138,8 +126,8 @@ namespace WebMVC.Migrations
name: "AspNetUserRoles",
columns: table => new
{
UserId = table.Column<string>(nullable: false),
RoleId = table.Column<string>(nullable: false)
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
@ -158,16 +146,38 @@ namespace WebMVC.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName");
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
columns: table => new
{
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName",
unique: true,
filter: "[NormalizedName] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserClaims_UserId",
table: "AspNetUserClaims",
@ -183,11 +193,6 @@ namespace WebMVC.Migrations
table: "AspNetUserRoles",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserRoles_UserId",
table: "AspNetUserRoles",
column: "UserId");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "AspNetUsers",
@ -197,7 +202,8 @@ namespace WebMVC.Migrations
name: "UserNameIndex",
table: "AspNetUsers",
column: "NormalizedUserName",
unique: true);
unique: true,
filter: "[NormalizedUserName] IS NOT NULL");
}
protected override void Down(MigrationBuilder migrationBuilder)

src/Services/Identity/Identity.API/Data/Migrations/ApplicationDbContextModelSnapshot.cs → src/Services/Identity/Identity.API/Migrations/ApplicationDbContextModelSnapshot.cs View File

@ -1,42 +1,136 @@
using System;
// <auto-generated />
using Identity.API.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Identity.API.Data;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace WebMVC.Migrations
namespace Identity.API.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "1.0.0-rtm-21431")
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
modelBuilder.Entity("Identity.API.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("CardHolderName")
.IsRequired();
b.Property<string>("CardNumber")
.IsRequired();
b.Property<int>("CardType");
b.Property<string>("City")
.IsRequired();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Country")
.IsRequired();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("Expiration")
.IsRequired();
b.Property<string>("LastName")
.IsRequired();
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
.IsRequired();
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityNumber")
.IsRequired();
b.Property<string>("SecurityStamp");
b.Property<string>("State")
.IsRequired();
b.Property<string>("Street")
.IsRequired();
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.Property<string>("ZipCode")
.IsRequired();
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasName("RoleNameIndex");
.IsUnique()
.HasName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
@ -55,7 +149,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
@ -74,7 +168,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
@ -92,7 +186,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
@ -102,12 +196,10 @@ namespace WebMVC.Migrations
b.HasIndex("RoleId");
b.HasIndex("UserId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
@ -122,123 +214,51 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("CardHolderName");
b.Property<string>("CardNumber");
b.Property<int>("CardType");
b.Property<string>("City");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Country");
b.Property<string>("CountryCode");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("Expiration");
b.Property<string>("LastName");
b.Property<double>("Latitude");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<double>("Longitude");
b.Property<string>("Name");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityNumber");
b.Property<string>("SecurityStamp");
b.Property<string>("State");
b.Property<string>("StateCode");
b.Property<string>("Street");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("ZipCode");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Claims")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Claims")
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Logins")
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Users")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Roles")
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20170604151338_Init-configuration.Designer.cs → src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20170912114152_Initial.Designer.cs View File

@ -1,20 +1,24 @@
using System;
// <auto-generated />
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace Identity.API.Migrations.ConfigurationDb
{
[DbContext(typeof(ConfigurationDbContext))]
[Migration("20170604151338_Init-configuration")]
partial class Initconfiguration
[Migration("20170912114152_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b =>
@ -165,6 +169,10 @@ namespace Identity.API.Migrations.ConfigurationDb
b.Property<int>("AuthorizationCodeLifetime");
b.Property<bool>("BackChannelLogoutSessionRequired");
b.Property<string>("BackChannelLogoutUri");
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
@ -175,19 +183,26 @@ namespace Identity.API.Migrations.ConfigurationDb
b.Property<string>("ClientUri")
.HasMaxLength(2000);
b.Property<int?>("ConsentLifetime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<bool>("EnableLocalLogin");
b.Property<bool>("Enabled");
b.Property<bool>("FrontChannelLogoutSessionRequired");
b.Property<string>("FrontChannelLogoutUri");
b.Property<int>("IdentityTokenLifetime");
b.Property<bool>("IncludeJwtId");
b.Property<string>("LogoUri");
b.Property<bool>("LogoutSessionRequired");
b.Property<string>("LogoutUri");
b.Property<string>("NormalizedClientId");
b.Property<bool>("PrefixClientClaims");
@ -316,6 +331,29 @@ namespace Identity.API.Migrations.ConfigurationDb
b.ToTable("ClientPostLogoutRedirectUris");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ClientId")
.IsRequired();
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientProperties");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
{
b.Property<int>("Id")
@ -503,6 +541,14 @@ namespace Identity.API.Migrations.ConfigurationDb
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
@ -534,6 +580,7 @@ namespace Identity.API.Migrations.ConfigurationDb
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20170604151338_Init-configuration.cs → src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20170912114152_Initial.cs View File

@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Metadata;
using System;
using System.Collections.Generic;
namespace Identity.API.Migrations.ConfigurationDb
{
public partial class Initconfiguration : Migration
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
@ -13,12 +13,12 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ApiResources",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Description = table.Column<string>(maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Enabled = table.Column<bool>(nullable: false),
Name = table.Column<string>(maxLength: 200, nullable: false)
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Enabled = table.Column<bool>(type: "bit", nullable: false),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
@ -29,37 +29,42 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "Clients",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
AbsoluteRefreshTokenLifetime = table.Column<int>(nullable: false),
AccessTokenLifetime = table.Column<int>(nullable: false),
AccessTokenType = table.Column<int>(nullable: false),
AllowAccessTokensViaBrowser = table.Column<bool>(nullable: false),
AllowOfflineAccess = table.Column<bool>(nullable: false),
AllowPlainTextPkce = table.Column<bool>(nullable: false),
AllowRememberConsent = table.Column<bool>(nullable: false),
AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(nullable: false),
AlwaysSendClientClaims = table.Column<bool>(nullable: false),
AuthorizationCodeLifetime = table.Column<int>(nullable: false),
ClientId = table.Column<string>(maxLength: 200, nullable: false),
ClientName = table.Column<string>(maxLength: 200, nullable: true),
ClientUri = table.Column<string>(maxLength: 2000, nullable: true),
EnableLocalLogin = table.Column<bool>(nullable: false),
Enabled = table.Column<bool>(nullable: false),
IdentityTokenLifetime = table.Column<int>(nullable: false),
IncludeJwtId = table.Column<bool>(nullable: false),
LogoUri = table.Column<string>(nullable: true),
LogoutSessionRequired = table.Column<bool>(nullable: false),
LogoutUri = table.Column<string>(nullable: true),
PrefixClientClaims = table.Column<bool>(nullable: false),
ProtocolType = table.Column<string>(maxLength: 200, nullable: false),
RefreshTokenExpiration = table.Column<int>(nullable: false),
RefreshTokenUsage = table.Column<int>(nullable: false),
RequireClientSecret = table.Column<bool>(nullable: false),
RequireConsent = table.Column<bool>(nullable: false),
RequirePkce = table.Column<bool>(nullable: false),
SlidingRefreshTokenLifetime = table.Column<int>(nullable: false),
UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(nullable: false)
AbsoluteRefreshTokenLifetime = table.Column<int>(type: "int", nullable: false),
AccessTokenLifetime = table.Column<int>(type: "int", nullable: false),
AccessTokenType = table.Column<int>(type: "int", nullable: false),
AllowAccessTokensViaBrowser = table.Column<bool>(type: "bit", nullable: false),
AllowOfflineAccess = table.Column<bool>(type: "bit", nullable: false),
AllowPlainTextPkce = table.Column<bool>(type: "bit", nullable: false),
AllowRememberConsent = table.Column<bool>(type: "bit", nullable: false),
AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(type: "bit", nullable: false),
AlwaysSendClientClaims = table.Column<bool>(type: "bit", nullable: false),
AuthorizationCodeLifetime = table.Column<int>(type: "int", nullable: false),
BackChannelLogoutSessionRequired = table.Column<bool>(type: "bit", nullable: false),
BackChannelLogoutUri = table.Column<string>(type: "nvarchar(max)", nullable: true),
ClientId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
ClientName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
ClientUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
ConsentLifetime = table.Column<int>(type: "int", nullable: true),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
EnableLocalLogin = table.Column<bool>(type: "bit", nullable: false),
Enabled = table.Column<bool>(type: "bit", nullable: false),
FrontChannelLogoutSessionRequired = table.Column<bool>(type: "bit", nullable: false),
FrontChannelLogoutUri = table.Column<string>(type: "nvarchar(max)", nullable: true),
IdentityTokenLifetime = table.Column<int>(type: "int", nullable: false),
IncludeJwtId = table.Column<bool>(type: "bit", nullable: false),
LogoUri = table.Column<string>(type: "nvarchar(max)", nullable: true),
NormalizedClientId = table.Column<string>(type: "nvarchar(max)", nullable: true),
PrefixClientClaims = table.Column<bool>(type: "bit", nullable: false),
ProtocolType = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
RefreshTokenExpiration = table.Column<int>(type: "int", nullable: false),
RefreshTokenUsage = table.Column<int>(type: "int", nullable: false),
RequireClientSecret = table.Column<bool>(type: "bit", nullable: false),
RequireConsent = table.Column<bool>(type: "bit", nullable: false),
RequirePkce = table.Column<bool>(type: "bit", nullable: false),
SlidingRefreshTokenLifetime = table.Column<int>(type: "int", nullable: false),
UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
@ -70,15 +75,15 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "IdentityResources",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Description = table.Column<string>(maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Emphasize = table.Column<bool>(nullable: false),
Enabled = table.Column<bool>(nullable: false),
Name = table.Column<string>(maxLength: 200, nullable: false),
Required = table.Column<bool>(nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(nullable: false)
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Emphasize = table.Column<bool>(type: "bit", nullable: false),
Enabled = table.Column<bool>(type: "bit", nullable: false),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Required = table.Column<bool>(type: "bit", nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
@ -89,10 +94,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ApiClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ApiResourceId = table.Column<int>(nullable: false),
Type = table.Column<string>(maxLength: 200, nullable: false)
ApiResourceId = table.Column<int>(type: "int", nullable: false),
Type = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
@ -109,15 +114,15 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ApiScopes",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ApiResourceId = table.Column<int>(nullable: false),
Description = table.Column<string>(maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Emphasize = table.Column<bool>(nullable: false),
Name = table.Column<string>(maxLength: 200, nullable: false),
Required = table.Column<bool>(nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(nullable: false)
ApiResourceId = table.Column<int>(type: "int", nullable: false),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Emphasize = table.Column<bool>(type: "bit", nullable: false),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Required = table.Column<bool>(type: "bit", nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
@ -134,13 +139,13 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ApiSecrets",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ApiResourceId = table.Column<int>(nullable: false),
Description = table.Column<string>(maxLength: 1000, nullable: true),
Expiration = table.Column<DateTime>(nullable: true),
Type = table.Column<string>(maxLength: 250, nullable: true),
Value = table.Column<string>(maxLength: 2000, nullable: true)
ApiResourceId = table.Column<int>(type: "int", nullable: false),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
Expiration = table.Column<DateTime>(type: "datetime2", nullable: true),
Type = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
Value = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true)
},
constraints: table =>
{
@ -157,11 +162,11 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
Type = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 250, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
Type = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
Value = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
},
constraints: table =>
{
@ -178,10 +183,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientCorsOrigins",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
Origin = table.Column<string>(maxLength: 150, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
Origin = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false)
},
constraints: table =>
{
@ -198,10 +203,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientGrantTypes",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
GrantType = table.Column<string>(maxLength: 250, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
GrantType = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
},
constraints: table =>
{
@ -218,10 +223,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientIdPRestrictions",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
Provider = table.Column<string>(maxLength: 200, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
Provider = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
@ -238,10 +243,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientPostLogoutRedirectUris",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
PostLogoutRedirectUri = table.Column<string>(maxLength: 2000, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
PostLogoutRedirectUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false)
},
constraints: table =>
{
@ -254,14 +259,35 @@ namespace Identity.API.Migrations.ConfigurationDb
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientProperties",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(type: "int", nullable: false),
Key = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
Value = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientProperties", x => x.Id);
table.ForeignKey(
name: "FK_ClientProperties_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientRedirectUris",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
RedirectUri = table.Column<string>(maxLength: 2000, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
RedirectUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false)
},
constraints: table =>
{
@ -278,10 +304,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientScopes",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
Scope = table.Column<string>(maxLength: 200, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
Scope = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
@ -298,13 +324,13 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientSecrets",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(nullable: false),
Description = table.Column<string>(maxLength: 2000, nullable: true),
Expiration = table.Column<DateTime>(nullable: true),
Type = table.Column<string>(maxLength: 250, nullable: true),
Value = table.Column<string>(maxLength: 2000, nullable: false)
ClientId = table.Column<int>(type: "int", nullable: false),
Description = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
Expiration = table.Column<DateTime>(type: "datetime2", nullable: true),
Type = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
Value = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false)
},
constraints: table =>
{
@ -321,10 +347,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "IdentityClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
IdentityResourceId = table.Column<int>(nullable: false),
Type = table.Column<string>(maxLength: 200, nullable: false)
IdentityResourceId = table.Column<int>(type: "int", nullable: false),
Type = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
@ -341,10 +367,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ApiScopeClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ApiScopeId = table.Column<int>(nullable: false),
Type = table.Column<string>(maxLength: 200, nullable: false)
ApiScopeId = table.Column<int>(type: "int", nullable: false),
Type = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
@ -357,6 +383,11 @@ namespace Identity.API.Migrations.ConfigurationDb
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ApiClaims_ApiResourceId",
table: "ApiClaims",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiResources_Name",
table: "ApiResources",
@ -364,9 +395,9 @@ namespace Identity.API.Migrations.ConfigurationDb
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ApiClaims_ApiResourceId",
table: "ApiClaims",
column: "ApiResourceId");
name: "IX_ApiScopeClaims_ApiScopeId",
table: "ApiScopeClaims",
column: "ApiScopeId");
migrationBuilder.CreateIndex(
name: "IX_ApiScopes_ApiResourceId",
@ -379,22 +410,11 @@ namespace Identity.API.Migrations.ConfigurationDb
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ApiScopeClaims_ApiScopeId",
table: "ApiScopeClaims",
column: "ApiScopeId");
migrationBuilder.CreateIndex(
name: "IX_ApiSecrets_ApiResourceId",
table: "ApiSecrets",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_Clients_ClientId",
table: "Clients",
column: "ClientId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClientClaims_ClientId",
table: "ClientClaims",
@ -420,11 +440,22 @@ namespace Identity.API.Migrations.ConfigurationDb
table: "ClientPostLogoutRedirectUris",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientProperties_ClientId",
table: "ClientProperties",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientRedirectUris_ClientId",
table: "ClientRedirectUris",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_Clients_ClientId",
table: "Clients",
column: "ClientId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClientScopes_ClientId",
table: "ClientScopes",
@ -473,6 +504,9 @@ namespace Identity.API.Migrations.ConfigurationDb
migrationBuilder.DropTable(
name: "ClientPostLogoutRedirectUris");
migrationBuilder.DropTable(
name: "ClientProperties");
migrationBuilder.DropTable(
name: "ClientRedirectUris");

+ 53
- 6
src/Services/Identity/Identity.API/Migrations/ConfigurationDb/ConfigurationDbContextModelSnapshot.cs View File

@ -1,9 +1,12 @@
using System;
// <auto-generated />
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace Identity.API.Migrations.ConfigurationDb
{
@ -12,8 +15,9 @@ namespace Identity.API.Migrations.ConfigurationDb
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b =>
@ -164,6 +168,10 @@ namespace Identity.API.Migrations.ConfigurationDb
b.Property<int>("AuthorizationCodeLifetime");
b.Property<bool>("BackChannelLogoutSessionRequired");
b.Property<string>("BackChannelLogoutUri");
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
@ -174,19 +182,26 @@ namespace Identity.API.Migrations.ConfigurationDb
b.Property<string>("ClientUri")
.HasMaxLength(2000);
b.Property<int?>("ConsentLifetime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<bool>("EnableLocalLogin");
b.Property<bool>("Enabled");
b.Property<bool>("FrontChannelLogoutSessionRequired");
b.Property<string>("FrontChannelLogoutUri");
b.Property<int>("IdentityTokenLifetime");
b.Property<bool>("IncludeJwtId");
b.Property<string>("LogoUri");
b.Property<bool>("LogoutSessionRequired");
b.Property<string>("LogoutUri");
b.Property<string>("NormalizedClientId");
b.Property<bool>("PrefixClientClaims");
@ -315,6 +330,29 @@ namespace Identity.API.Migrations.ConfigurationDb
b.ToTable("ClientPostLogoutRedirectUris");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ClientId")
.IsRequired();
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientProperties");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
{
b.Property<int>("Id")
@ -502,6 +540,14 @@ namespace Identity.API.Migrations.ConfigurationDb
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
@ -533,6 +579,7 @@ namespace Identity.API.Migrations.ConfigurationDb
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

src/Services/Identity/Identity.API/Migrations/20170604151240_Init-persisted-grant.Designer.cs → src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20170912114120_Initial.Designer.cs View File

@ -1,20 +1,23 @@
using System;
// <auto-generated />
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace Identity.API.Migrations
namespace Identity.API.Migrations.PersistedGrantDb
{
[DbContext(typeof(PersistedGrantDbContext))]
[Migration("20170604151240_Init-persisted-grant")]
partial class Initpersistedgrant
[Migration("20170912114120_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
@ -47,6 +50,7 @@ namespace Identity.API.Migrations
b.ToTable("PersistedGrants");
});
#pragma warning restore 612, 618
}
}
}

+ 40
- 0
src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20170912114120_Initial.cs View File

@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace Identity.API.Migrations.PersistedGrantDb
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PersistedGrants",
columns: table => new
{
Key = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
ClientId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
Data = table.Column<string>(type: "nvarchar(max)", maxLength: 50000, nullable: false),
Expiration = table.Column<DateTime>(type: "datetime2", nullable: true),
SubjectId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Type = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PersistedGrants", x => x.Key);
});
migrationBuilder.CreateIndex(
name: "IX_PersistedGrants_SubjectId_ClientId_Type",
table: "PersistedGrants",
columns: new[] { "SubjectId", "ClientId", "Type" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PersistedGrants");
}
}
}

src/Services/Identity/Identity.API/Migrations/PersistedGrantDbContextModelSnapshot.cs → src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/PersistedGrantDbContextModelSnapshot.cs View File

@ -1,19 +1,22 @@
using System;
// <auto-generated />
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace Identity.API.Migrations
namespace Identity.API.Migrations.PersistedGrantDb
{
[DbContext(typeof(PersistedGrantDbContext))]
partial class PersistedGrantDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
@ -46,6 +49,7 @@ namespace Identity.API.Migrations
b.ToTable("PersistedGrants");
});
#pragma warning restore 612, 618
}
}
}

+ 1
- 5
src/Services/Identity/Identity.API/Models/ApplicationUser.cs View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.AspNetCore.Identity;
using System.ComponentModel.DataAnnotations;
namespace Identity.API.Models


+ 16
- 5
src/Services/Identity/Identity.API/Program.cs View File

@ -1,4 +1,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.eShopOnContainers.Services.Identity;
using Microsoft.Extensions.Logging;
using System.IO;
namespace eShopOnContainers.Identity
@ -7,15 +10,23 @@ namespace eShopOnContainers.Identity
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseKestrel()
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
})
.Build();
host.Run();
}
}
}

+ 21
- 26
src/Services/Identity/Identity.API/Startup.cs View File

@ -1,5 +1,6 @@
using Autofac;
using Autofac.Extensions.DependencyInjection;
using eShopOnContainers.Identity;
using Identity.API.Certificate;
using Identity.API.Configuration;
using Identity.API.Data;
@ -11,7 +12,6 @@ using IdentityServer4.Services;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.BuildingBlocks;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
@ -25,28 +25,16 @@ using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
namespace eShopOnContainers.Identity
namespace Microsoft.eShopOnContainers.Services.Identity
{
public class Startup
{
public Startup(IHostingEnvironment env)
public Startup(IConfiguration configuration)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
if (env.IsDevelopment())
{
// For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
builder.AddUserSecrets<Startup>();
}
builder.AddEnvironmentVariables();
Configuration = builder.Build();
Configuration = configuration;
}
public IConfigurationRoot Configuration { get; }
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services)
@ -95,16 +83,21 @@ namespace eShopOnContainers.Identity
services.AddIdentityServer(x => x.IssuerUri = "null")
.AddSigningCredential(Certificate.Get())
.AddAspNetIdentity<ApplicationUser>()
.AddConfigurationStore(builder =>
builder.UseSqlServer(connectionString, options =>
options.MigrationsAssembly(migrationsAssembly)))
.AddOperationalStore(builder =>
builder.UseSqlServer(connectionString, options =>
options.MigrationsAssembly(migrationsAssembly)))
.AddConfigurationStore(options =>
{
options.ConfigureDbContext = builder => builder.UseSqlServer(connectionString, opts =>
opts.MigrationsAssembly(migrationsAssembly));
})
.AddOperationalStore(options =>
{
options.ConfigureDbContext = builder => builder.UseSqlServer(connectionString, opts =>
opts.MigrationsAssembly(migrationsAssembly));
})
.Services.AddTransient<IProfileService, ProfileService>();
var container = new ContainerBuilder();
container.Populate(services);
return new AutofacServiceProvider(container.Build());
}
@ -118,7 +111,6 @@ namespace eShopOnContainers.Identity
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
app.UseBrowserLink();
}
else
{
@ -142,7 +134,7 @@ namespace eShopOnContainers.Identity
await next();
});
app.UseIdentity();
app.UseAuthentication();
// Adds IdentityServer
app.UseIdentityServer();
@ -176,7 +168,10 @@ namespace eShopOnContainers.Identity
using (var serviceScope = app.ApplicationServices.GetService<IServiceScopeFactory>().CreateScope())
{
serviceScope.ServiceProvider.GetRequiredService<PersistedGrantDbContext>().Database.Migrate();
serviceScope.ServiceProvider.GetRequiredService<PersistedGrantDbContext>()
.Database
.Migrate();
var context = serviceScope.ServiceProvider.GetRequiredService<ConfigurationDbContext>();
context.Database.Migrate();


Loading…
Cancel
Save