fix to startup identiy: remove old migrations and add initial migration.

This commit is contained in:
Erik Pique 2019-07-29 13:21:00 +02:00
parent e9811980f3
commit 671d8b1e27
21 changed files with 697 additions and 1413 deletions

View File

@ -121,7 +121,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
options.DescribeAllEnumsAsStrings(); options.DescribeAllEnumsAsStrings();
options.SwaggerDoc("v1", new OpenApiInfo options.SwaggerDoc("v1", new OpenApiInfo
{ {
Title = "Shopping Aggregator for Mobile Clients", Title = "eShopOnContainers - Shopping Aggregator for Mobile Clients",
Version = "v1", Version = "v1",
Description = "Shopping Aggregator for Mobile Clients" Description = "Shopping Aggregator for Mobile Clients"
}); });

View File

@ -147,7 +147,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
options.DescribeAllEnumsAsStrings(); options.DescribeAllEnumsAsStrings();
options.SwaggerDoc("v1", new OpenApiInfo options.SwaggerDoc("v1", new OpenApiInfo
{ {
Title = "Shopping Aggregator for Web Clients", Title = "eShopOnContainers - Shopping Aggregator for Web Clients",
Version = "v1", Version = "v1",
Description = "Shopping Aggregator for Web Clients" Description = "Shopping Aggregator for Web Clients"
}); });

View File

@ -40,12 +40,7 @@ namespace Microsoft.AspNetCore.Hosting
else else
{ {
var retry = Policy.Handle<SqlException>() var retry = Policy.Handle<SqlException>()
.WaitAndRetry(new TimeSpan[] .WaitAndRetry(10, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
{
TimeSpan.FromSeconds(3),
TimeSpan.FromSeconds(5),
TimeSpan.FromSeconds(8),
});
//if the sql server container is not created on run docker compose this //if the sql server container is not created on run docker compose this
//migration can't fail for network related exception. The retry options for DbContext only //migration can't fail for network related exception. The retry options for DbContext only

View File

@ -43,7 +43,6 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
public IConfiguration Configuration { get; } public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services) public IServiceProvider ConfigureServices(IServiceCollection services)
{ {
@ -130,7 +129,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
options.DescribeAllEnumsAsStrings(); options.DescribeAllEnumsAsStrings();
options.SwaggerDoc("v1", new OpenApiInfo options.SwaggerDoc("v1", new OpenApiInfo
{ {
Title = "Basket HTTP API", Title = "eShopOnContainers - Basket HTTP API",
Version = "v1", Version = "v1",
Description = "The Basket Service HTTP API" Description = "The Basket Service HTTP API"
}); });
@ -151,7 +150,6 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
} }
} }
}); });
}); });
services.AddCors(options => services.AddCors(options =>
@ -175,7 +173,6 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
return new AutofacServiceProvider(container.Build()); return new AutofacServiceProvider(container.Build());
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{ {
@ -188,12 +185,19 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
app.UsePathBase(pathBase); app.UsePathBase(pathBase);
} }
app.UseStaticFiles();
app.UseCors("CorsPolicy");
ConfigureAuth(app); ConfigureAuth(app);
app.UseAuthorization(); app.UseStaticFiles();
app.UseSwagger()
.UseSwaggerUI(setup =>
{
setup.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Basket.API V1");
setup.OAuthClientId("basketswaggerui");
setup.OAuthAppName("Basket Swagger UI");
});
app.UseCors("CorsPolicy");
app.UseRouting(); app.UseRouting();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
@ -210,16 +214,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
}); });
}); });
app.UseSwagger()
.UseSwaggerUI(c =>
{
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Basket.API V1");
c.OAuthClientId("basketswaggerui");
c.OAuthAppName("Basket Swagger UI");
});
ConfigureEventBus(app); ConfigureEventBus(app);
} }
private void RegisterAppInsights(IServiceCollection services) private void RegisterAppInsights(IServiceCollection services)
@ -255,8 +250,8 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
app.UseMiddleware<ByPassAuthMiddleware>(); app.UseMiddleware<ByPassAuthMiddleware>();
} }
app.UseAuthentication();
app.UseAuthorization(); app.UseAuthorization();
app.UseAuthentication();
} }
private void RegisterEventBus(IServiceCollection services) private void RegisterEventBus(IServiceCollection services)

View File

@ -26,6 +26,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Microsoft.OpenApi.Models;
using RabbitMQ.Client; using RabbitMQ.Client;
using System; using System;
using System.Data.Common; using System.Data.Common;
@ -82,8 +83,6 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
}); });
app.UseCors("CorsPolicy"); app.UseCors("CorsPolicy");
app.UseAuthorization();
app.UseAuthentication();
app.UseRouting(); app.UseRouting();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
@ -262,7 +261,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
services.AddSwaggerGen(options => services.AddSwaggerGen(options =>
{ {
options.DescribeAllEnumsAsStrings(); options.DescribeAllEnumsAsStrings();
options.SwaggerDoc("v1", new OpenApi.Models.OpenApiInfo options.SwaggerDoc("v1", new OpenApiInfo
{ {
Title = "eShopOnContainers - Catalog HTTP API", Title = "eShopOnContainers - Catalog HTTP API",
Version = "v1", Version = "v1",

View File

@ -1,28 +1,138 @@
// <auto-generated /> // <auto-generated />
using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.eShopOnContainers.Services.Identity.API.Data; using Microsoft.eShopOnContainers.Services.Identity.API.Data;
using System;
namespace Identity.API.Migrations namespace Identity.API.Migrations
{ {
[DbContext(typeof(ApplicationDbContext))] [DbContext(typeof(ApplicationDbContext))]
[Migration("20170912114036_Initial")] [Migration("20190729091724_InitialMigration")]
partial class Initial partial class InitialMigration
{ {
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", "2.0.0-rtm-26452") .HasAnnotation("ProductVersion", "3.0.0-preview7.19362.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Identity.API.Models.ApplicationUser", b => 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")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
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.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
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.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.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.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.Services.Identity.API.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount");
@ -105,157 +215,55 @@ namespace Identity.API.Migrations
b.ToTable("AspNetUsers"); 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")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.Property<int>("Id") b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.ValueGeneratedOnAdd(); .WithMany()
.HasForeignKey("RoleId")
b.Property<string>("ClaimType"); .OnDelete(DeleteBehavior.Cascade)
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired(); .IsRequired();
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.Property<int>("Id") b.HasOne("Microsoft.eShopOnContainers.Services.Identity.API.Models.ApplicationUser", null)
.ValueGeneratedOnAdd(); .WithMany()
.HasForeignKey("UserId")
b.Property<string>("ClaimType"); .OnDelete(DeleteBehavior.Cascade)
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired(); .IsRequired();
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider"); b.HasOne("Microsoft.eShopOnContainers.Services.Identity.API.Models.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
b.Property<string>("ProviderKey"); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("ProviderDisplayName"); b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
b.Property<string>("UserId") .HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasKey("LoginProvider", "ProviderKey"); b.HasOne("Microsoft.eShopOnContainers.Services.Identity.API.Models.ApplicationUser", null)
.WithMany()
b.HasIndex("UserId"); .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
b.ToTable("AspNetUserLogins"); .IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId"); b.HasOne("Microsoft.eShopOnContainers.Services.Identity.API.Models.ApplicationUser", null)
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany() .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade)
}); .IsRequired();
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
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 #pragma warning restore 612, 618
} }

View File

@ -1,11 +1,10 @@
using Microsoft.EntityFrameworkCore.Metadata; using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace Identity.API.Migrations namespace Identity.API.Migrations
{ {
public partial class Initial : Migration public partial class InitialMigration : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
@ -13,10 +12,10 @@ namespace Identity.API.Migrations
name: "AspNetRoles", name: "AspNetRoles",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(type: "nvarchar(450)", nullable: false), Id = table.Column<string>(nullable: false),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true), Name = table.Column<string>(maxLength: 256, nullable: true),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true), NormalizedName = table.Column<string>(maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true) ConcurrencyStamp = table.Column<string>(nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -27,33 +26,33 @@ namespace Identity.API.Migrations
name: "AspNetUsers", name: "AspNetUsers",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(type: "nvarchar(450)", nullable: false), Id = table.Column<string>(nullable: false),
AccessFailedCount = table.Column<int>(type: "int", nullable: false), UserName = table.Column<string>(maxLength: 256, nullable: true),
CardHolderName = table.Column<string>(type: "nvarchar(max)", nullable: false), NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
CardNumber = table.Column<string>(type: "nvarchar(max)", nullable: false), Email = table.Column<string>(maxLength: 256, nullable: true),
CardType = table.Column<int>(type: "int", nullable: false), NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
City = table.Column<string>(type: "nvarchar(max)", nullable: false), EmailConfirmed = table.Column<bool>(nullable: false),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true), PasswordHash = table.Column<string>(nullable: true),
Country = table.Column<string>(type: "nvarchar(max)", nullable: false), SecurityStamp = table.Column<string>(nullable: true),
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true), ConcurrencyStamp = table.Column<string>(nullable: true),
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false), PhoneNumber = table.Column<string>(nullable: true),
Expiration = table.Column<string>(type: "nvarchar(max)", nullable: false), PhoneNumberConfirmed = table.Column<bool>(nullable: false),
LastName = table.Column<string>(type: "nvarchar(max)", nullable: false), TwoFactorEnabled = table.Column<bool>(nullable: false),
LockoutEnabled = table.Column<bool>(type: "bit", nullable: false), LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true), LockoutEnabled = table.Column<bool>(nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false), AccessFailedCount = table.Column<int>(nullable: false),
NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true), CardNumber = table.Column<string>(nullable: false),
NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true), SecurityNumber = table.Column<string>(nullable: false),
PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: true), Expiration = table.Column<string>(nullable: false),
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: true), CardHolderName = table.Column<string>(nullable: false),
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false), CardType = table.Column<int>(nullable: false),
SecurityNumber = table.Column<string>(type: "nvarchar(max)", nullable: false), Street = table.Column<string>(nullable: false),
SecurityStamp = table.Column<string>(type: "nvarchar(max)", nullable: true), City = table.Column<string>(nullable: false),
State = table.Column<string>(type: "nvarchar(max)", nullable: false), State = table.Column<string>(nullable: false),
Street = table.Column<string>(type: "nvarchar(max)", nullable: false), Country = table.Column<string>(nullable: false),
TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false), ZipCode = table.Column<string>(nullable: false),
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true), Name = table.Column<string>(nullable: false),
ZipCode = table.Column<string>(type: "nvarchar(max)", nullable: false) LastName = table.Column<string>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -64,11 +63,11 @@ namespace Identity.API.Migrations
name: "AspNetRoleClaims", name: "AspNetRoleClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true), RoleId = table.Column<string>(nullable: false),
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true), ClaimType = table.Column<string>(nullable: true),
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false) ClaimValue = table.Column<string>(nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -85,11 +84,11 @@ namespace Identity.API.Migrations
name: "AspNetUserClaims", name: "AspNetUserClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true), UserId = table.Column<string>(nullable: false),
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true), ClaimType = table.Column<string>(nullable: true),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false) ClaimValue = table.Column<string>(nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -106,10 +105,10 @@ namespace Identity.API.Migrations
name: "AspNetUserLogins", name: "AspNetUserLogins",
columns: table => new columns: table => new
{ {
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false), LoginProvider = table.Column<string>(nullable: false),
ProviderKey = table.Column<string>(type: "nvarchar(450)", nullable: false), ProviderKey = table.Column<string>(nullable: false),
ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true), ProviderDisplayName = table.Column<string>(nullable: true),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false) UserId = table.Column<string>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -126,8 +125,8 @@ namespace Identity.API.Migrations
name: "AspNetUserRoles", name: "AspNetUserRoles",
columns: table => new columns: table => new
{ {
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false), UserId = table.Column<string>(nullable: false),
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false) RoleId = table.Column<string>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -150,10 +149,10 @@ namespace Identity.API.Migrations
name: "AspNetUserTokens", name: "AspNetUserTokens",
columns: table => new columns: table => new
{ {
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false), UserId = table.Column<string>(nullable: false),
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false), LoginProvider = table.Column<string>(nullable: false),
Name = table.Column<string>(type: "nvarchar(450)", nullable: false), Name = table.Column<string>(nullable: false),
Value = table.Column<string>(type: "nvarchar(max)", nullable: true) Value = table.Column<string>(nullable: true)
}, },
constraints: table => constraints: table =>
{ {

View File

@ -1,9 +1,10 @@
// <auto-generated /> // <auto-generated />
using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.eShopOnContainers.Services.Identity.API.Data; using Microsoft.eShopOnContainers.Services.Identity.API.Data;
using System;
namespace Identity.API.Migrations namespace Identity.API.Migrations
{ {
@ -14,13 +15,122 @@ namespace Identity.API.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452") .HasAnnotation("ProductVersion", "3.0.0-preview7.19362.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Identity.API.Models.ApplicationUser", b => 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")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
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.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
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.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.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.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.Services.Identity.API.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount");
@ -103,157 +213,55 @@ namespace Identity.API.Migrations
b.ToTable("AspNetUsers"); 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")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.Property<int>("Id") b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.ValueGeneratedOnAdd(); .WithMany()
.HasForeignKey("RoleId")
b.Property<string>("ClaimType"); .OnDelete(DeleteBehavior.Cascade)
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired(); .IsRequired();
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.Property<int>("Id") b.HasOne("Microsoft.eShopOnContainers.Services.Identity.API.Models.ApplicationUser", null)
.ValueGeneratedOnAdd(); .WithMany()
.HasForeignKey("UserId")
b.Property<string>("ClaimType"); .OnDelete(DeleteBehavior.Cascade)
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired(); .IsRequired();
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider"); b.HasOne("Microsoft.eShopOnContainers.Services.Identity.API.Models.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
b.Property<string>("ProviderKey"); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("ProviderDisplayName"); b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
b.Property<string>("UserId") .HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasKey("LoginProvider", "ProviderKey"); b.HasOne("Microsoft.eShopOnContainers.Services.Identity.API.Models.ApplicationUser", null)
.WithMany()
b.HasIndex("UserId"); .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
b.ToTable("AspNetUserLogins"); .IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId"); b.HasOne("Microsoft.eShopOnContainers.Services.Identity.API.Models.ApplicationUser", null)
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany() .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade)
}); .IsRequired();
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Identity.API.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
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 #pragma warning restore 612, 618
} }

View File

@ -1,591 +0,0 @@
// <auto-generated />
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace Identity.API.Migrations.ConfigurationDb
{
[DbContext(typeof(ConfigurationDbContext))]
[Migration("20170927170433_Config")]
partial class Config
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Enabled");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("ApiResources");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ApiResourceId")
.IsRequired();
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ApiResourceId")
.IsRequired();
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Emphasize");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.Property<bool>("Required");
b.Property<bool>("ShowInDiscoveryDocument");
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.HasIndex("Name")
.IsUnique();
b.ToTable("ApiScopes");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ApiScopeId")
.IsRequired();
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ApiScopeId");
b.ToTable("ApiScopeClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ApiResourceId")
.IsRequired();
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<DateTime?>("Expiration");
b.Property<string>("Type")
.HasMaxLength(250);
b.Property<string>("Value")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiSecrets");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AbsoluteRefreshTokenLifetime");
b.Property<int>("AccessTokenLifetime");
b.Property<int>("AccessTokenType");
b.Property<bool>("AllowAccessTokensViaBrowser");
b.Property<bool>("AllowOfflineAccess");
b.Property<bool>("AllowPlainTextPkce");
b.Property<bool>("AllowRememberConsent");
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken");
b.Property<bool>("AlwaysSendClientClaims");
b.Property<int>("AuthorizationCodeLifetime");
b.Property<bool>("BackChannelLogoutSessionRequired");
b.Property<string>("BackChannelLogoutUri")
.HasMaxLength(2000);
b.Property<string>("ClientClaimsPrefix")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<string>("ClientName")
.HasMaxLength(200);
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")
.HasMaxLength(2000);
b.Property<int>("IdentityTokenLifetime");
b.Property<bool>("IncludeJwtId");
b.Property<string>("LogoUri")
.HasMaxLength(2000);
b.Property<string>("PairWiseSubjectSalt")
.HasMaxLength(200);
b.Property<string>("ProtocolType")
.IsRequired()
.HasMaxLength(200);
b.Property<int>("RefreshTokenExpiration");
b.Property<int>("RefreshTokenUsage");
b.Property<bool>("RequireClientSecret");
b.Property<bool>("RequireConsent");
b.Property<bool>("RequirePkce");
b.Property<int>("SlidingRefreshTokenLifetime");
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("Clients");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ClientId")
.IsRequired();
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(250);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ClientId")
.IsRequired();
b.Property<string>("Origin")
.IsRequired()
.HasMaxLength(150);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientCorsOrigins");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ClientId")
.IsRequired();
b.Property<string>("GrantType")
.IsRequired()
.HasMaxLength(250);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientGrantTypes");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ClientId")
.IsRequired();
b.Property<string>("Provider")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientIdPRestrictions");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ClientId")
.IsRequired();
b.Property<string>("PostLogoutRedirectUri")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
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")
.ValueGeneratedOnAdd();
b.Property<int?>("ClientId")
.IsRequired();
b.Property<string>("RedirectUri")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientRedirectUris");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ClientId")
.IsRequired();
b.Property<string>("Scope")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientScopes");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ClientId")
.IsRequired();
b.Property<string>("Description")
.HasMaxLength(2000);
b.Property<DateTime?>("Expiration");
b.Property<string>("Type")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientSecrets");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("IdentityResourceId")
.IsRequired();
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Emphasize");
b.Property<bool>("Enabled");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.Property<bool>("Required");
b.Property<bool>("ShowInDiscoveryDocument");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("IdentityResources");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Scopes")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "ApiScope")
.WithMany("UserClaims")
.HasForeignKey("ApiScopeId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Secrets")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("Claims")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedCorsOrigins")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedGrantTypes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("IdentityProviderRestrictions")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("PostLogoutRedirectUris")
.HasForeignKey("ClientId")
.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")
.WithMany("RedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedScopes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("ClientSecrets")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityClaim", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.IdentityResource", "IdentityResource")
.WithMany("UserClaims")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,294 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Identity.API.Migrations.ConfigurationDb
{
public partial class core3 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "Created",
table: "IdentityResources",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<bool>(
name: "NonEditable",
table: "IdentityResources",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
name: "Updated",
table: "IdentityResources",
nullable: true);
migrationBuilder.AlterColumn<string>(
name: "Value",
table: "ClientSecrets",
maxLength: 4000,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 2000);
migrationBuilder.AlterColumn<string>(
name: "Type",
table: "ClientSecrets",
maxLength: 250,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 250,
oldNullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "Created",
table: "ClientSecrets",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "Created",
table: "Clients",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<int>(
name: "DeviceCodeLifetime",
table: "Clients",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<DateTime>(
name: "LastAccessed",
table: "Clients",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "NonEditable",
table: "Clients",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
name: "Updated",
table: "Clients",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "UserCodeType",
table: "Clients",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<int>(
name: "UserSsoLifetime",
table: "Clients",
nullable: true);
migrationBuilder.AlterColumn<string>(
name: "Value",
table: "ApiSecrets",
maxLength: 4000,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 2000,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Type",
table: "ApiSecrets",
maxLength: 250,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 250,
oldNullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "Created",
table: "ApiSecrets",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "Created",
table: "ApiResources",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "LastAccessed",
table: "ApiResources",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "NonEditable",
table: "ApiResources",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
name: "Updated",
table: "ApiResources",
nullable: true);
migrationBuilder.CreateTable(
name: "ApiProperties",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Key = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 2000, nullable: false),
ApiResourceId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiProperties", x => x.Id);
table.ForeignKey(
name: "FK_ApiProperties_ApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityProperties",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Key = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 2000, nullable: false),
IdentityResourceId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityProperties", x => x.Id);
table.ForeignKey(
name: "FK_IdentityProperties_IdentityResources_IdentityResourceId",
column: x => x.IdentityResourceId,
principalTable: "IdentityResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ApiProperties_ApiResourceId",
table: "ApiProperties",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_IdentityProperties_IdentityResourceId",
table: "IdentityProperties",
column: "IdentityResourceId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ApiProperties");
migrationBuilder.DropTable(
name: "IdentityProperties");
migrationBuilder.DropColumn(
name: "Created",
table: "IdentityResources");
migrationBuilder.DropColumn(
name: "NonEditable",
table: "IdentityResources");
migrationBuilder.DropColumn(
name: "Updated",
table: "IdentityResources");
migrationBuilder.DropColumn(
name: "Created",
table: "ClientSecrets");
migrationBuilder.DropColumn(
name: "Created",
table: "Clients");
migrationBuilder.DropColumn(
name: "DeviceCodeLifetime",
table: "Clients");
migrationBuilder.DropColumn(
name: "LastAccessed",
table: "Clients");
migrationBuilder.DropColumn(
name: "NonEditable",
table: "Clients");
migrationBuilder.DropColumn(
name: "Updated",
table: "Clients");
migrationBuilder.DropColumn(
name: "UserCodeType",
table: "Clients");
migrationBuilder.DropColumn(
name: "UserSsoLifetime",
table: "Clients");
migrationBuilder.DropColumn(
name: "Created",
table: "ApiSecrets");
migrationBuilder.DropColumn(
name: "Created",
table: "ApiResources");
migrationBuilder.DropColumn(
name: "LastAccessed",
table: "ApiResources");
migrationBuilder.DropColumn(
name: "NonEditable",
table: "ApiResources");
migrationBuilder.DropColumn(
name: "Updated",
table: "ApiResources");
migrationBuilder.AlterColumn<string>(
name: "Value",
table: "ClientSecrets",
maxLength: 2000,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 4000);
migrationBuilder.AlterColumn<string>(
name: "Type",
table: "ClientSecrets",
maxLength: 250,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 250);
migrationBuilder.AlterColumn<string>(
name: "Value",
table: "ApiSecrets",
maxLength: 2000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 4000);
migrationBuilder.AlterColumn<string>(
name: "Type",
table: "ApiSecrets",
maxLength: 250,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 250);
}
}
}

View File

@ -10,8 +10,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Identity.API.Migrations.ConfigurationDb namespace Identity.API.Migrations.ConfigurationDb
{ {
[DbContext(typeof(ConfigurationDbContext))] [DbContext(typeof(ConfigurationDbContext))]
[Migration("20190725132846_core3")] [Migration("20190729092011_InitialConfigurationMigration")]
partial class core3 partial class InitialConfigurationMigration
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {

View File

@ -1,10 +1,10 @@
using Microsoft.EntityFrameworkCore.Metadata; using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using System;
namespace Identity.API.Migrations.ConfigurationDb namespace Identity.API.Migrations.ConfigurationDb
{ {
public partial class Config : Migration public partial class InitialConfigurationMigration : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
@ -12,12 +12,16 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ApiResources", name: "ApiResources",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true), Enabled = table.Column<bool>(nullable: false),
DisplayName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), Name = table.Column<string>(maxLength: 200, nullable: false),
Enabled = table.Column<bool>(type: "bit", nullable: false), DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false) Description = table.Column<string>(maxLength: 1000, nullable: true),
Created = table.Column<DateTime>(nullable: false),
Updated = table.Column<DateTime>(nullable: true),
LastAccessed = table.Column<DateTime>(nullable: true),
NonEditable = table.Column<bool>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -28,42 +32,49 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "Clients", name: "Clients",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
AbsoluteRefreshTokenLifetime = table.Column<int>(type: "int", nullable: false), Enabled = table.Column<bool>(nullable: false),
AccessTokenLifetime = table.Column<int>(type: "int", nullable: false), ClientId = table.Column<string>(maxLength: 200, nullable: false),
AccessTokenType = table.Column<int>(type: "int", nullable: false), ProtocolType = table.Column<string>(maxLength: 200, nullable: false),
AllowAccessTokensViaBrowser = table.Column<bool>(type: "bit", nullable: false), RequireClientSecret = table.Column<bool>(nullable: false),
AllowOfflineAccess = table.Column<bool>(type: "bit", nullable: false), ClientName = table.Column<string>(maxLength: 200, nullable: true),
AllowPlainTextPkce = table.Column<bool>(type: "bit", nullable: false), Description = table.Column<string>(maxLength: 1000, nullable: true),
AllowRememberConsent = table.Column<bool>(type: "bit", nullable: false), ClientUri = table.Column<string>(maxLength: 2000, nullable: true),
AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(type: "bit", nullable: false), LogoUri = table.Column<string>(maxLength: 2000, nullable: true),
AlwaysSendClientClaims = table.Column<bool>(type: "bit", nullable: false), RequireConsent = table.Column<bool>(nullable: false),
AuthorizationCodeLifetime = table.Column<int>(type: "int", nullable: false), AllowRememberConsent = table.Column<bool>(nullable: false),
BackChannelLogoutSessionRequired = table.Column<bool>(type: "bit", nullable: false), AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(nullable: false),
BackChannelLogoutUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true), RequirePkce = table.Column<bool>(nullable: false),
ClientClaimsPrefix = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), AllowPlainTextPkce = table.Column<bool>(nullable: false),
ClientId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), AllowAccessTokensViaBrowser = table.Column<bool>(nullable: false),
ClientName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), FrontChannelLogoutUri = table.Column<string>(maxLength: 2000, nullable: true),
ClientUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true), FrontChannelLogoutSessionRequired = table.Column<bool>(nullable: false),
ConsentLifetime = table.Column<int>(type: "int", nullable: true), BackChannelLogoutUri = table.Column<string>(maxLength: 2000, nullable: true),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true), BackChannelLogoutSessionRequired = table.Column<bool>(nullable: false),
EnableLocalLogin = table.Column<bool>(type: "bit", nullable: false), AllowOfflineAccess = table.Column<bool>(nullable: false),
Enabled = table.Column<bool>(type: "bit", nullable: false), IdentityTokenLifetime = table.Column<int>(nullable: false),
FrontChannelLogoutSessionRequired = table.Column<bool>(type: "bit", nullable: false), AccessTokenLifetime = table.Column<int>(nullable: false),
FrontChannelLogoutUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true), AuthorizationCodeLifetime = table.Column<int>(nullable: false),
IdentityTokenLifetime = table.Column<int>(type: "int", nullable: false), ConsentLifetime = table.Column<int>(nullable: true),
IncludeJwtId = table.Column<bool>(type: "bit", nullable: false), AbsoluteRefreshTokenLifetime = table.Column<int>(nullable: false),
LogoUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true), SlidingRefreshTokenLifetime = table.Column<int>(nullable: false),
PairWiseSubjectSalt = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), RefreshTokenUsage = table.Column<int>(nullable: false),
ProtocolType = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(nullable: false),
RefreshTokenExpiration = table.Column<int>(type: "int", nullable: false), RefreshTokenExpiration = table.Column<int>(nullable: false),
RefreshTokenUsage = table.Column<int>(type: "int", nullable: false), AccessTokenType = table.Column<int>(nullable: false),
RequireClientSecret = table.Column<bool>(type: "bit", nullable: false), EnableLocalLogin = table.Column<bool>(nullable: false),
RequireConsent = table.Column<bool>(type: "bit", nullable: false), IncludeJwtId = table.Column<bool>(nullable: false),
RequirePkce = table.Column<bool>(type: "bit", nullable: false), AlwaysSendClientClaims = table.Column<bool>(nullable: false),
SlidingRefreshTokenLifetime = table.Column<int>(type: "int", nullable: false), ClientClaimsPrefix = table.Column<string>(maxLength: 200, nullable: true),
UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(type: "bit", nullable: false) PairWiseSubjectSalt = table.Column<string>(maxLength: 200, nullable: true),
Created = table.Column<DateTime>(nullable: false),
Updated = table.Column<DateTime>(nullable: true),
LastAccessed = table.Column<DateTime>(nullable: true),
UserSsoLifetime = table.Column<int>(nullable: true),
UserCodeType = table.Column<string>(maxLength: 100, nullable: true),
DeviceCodeLifetime = table.Column<int>(nullable: false),
NonEditable = table.Column<bool>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -74,15 +85,18 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "IdentityResources", name: "IdentityResources",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true), Enabled = table.Column<bool>(nullable: false),
DisplayName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), Name = table.Column<string>(maxLength: 200, nullable: false),
Emphasize = table.Column<bool>(type: "bit", nullable: false), DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Enabled = table.Column<bool>(type: "bit", nullable: false), Description = table.Column<string>(maxLength: 1000, nullable: true),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), Required = table.Column<bool>(nullable: false),
Required = table.Column<bool>(type: "bit", nullable: false), Emphasize = table.Column<bool>(nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(type: "bit", nullable: false) ShowInDiscoveryDocument = table.Column<bool>(nullable: false),
Created = table.Column<DateTime>(nullable: false),
Updated = table.Column<DateTime>(nullable: true),
NonEditable = table.Column<bool>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -93,10 +107,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ApiClaims", name: "ApiClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ApiResourceId = table.Column<int>(type: "int", nullable: false), Type = table.Column<string>(maxLength: 200, nullable: false),
Type = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false) ApiResourceId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -109,19 +123,40 @@ namespace Identity.API.Migrations.ConfigurationDb
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "ApiProperties",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Key = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 2000, nullable: false),
ApiResourceId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiProperties", x => x.Id);
table.ForeignKey(
name: "FK_ApiProperties_ApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "ApiScopes", name: "ApiScopes",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ApiResourceId = table.Column<int>(type: "int", 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>(maxLength: 200, nullable: true),
DisplayName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), Description = table.Column<string>(maxLength: 1000, nullable: true),
Emphasize = table.Column<bool>(type: "bit", nullable: false), Required = table.Column<bool>(nullable: false),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), Emphasize = table.Column<bool>(nullable: false),
Required = table.Column<bool>(type: "bit", nullable: false), ShowInDiscoveryDocument = table.Column<bool>(nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(type: "bit", nullable: false) ApiResourceId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -138,13 +173,14 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ApiSecrets", name: "ApiSecrets",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ApiResourceId = table.Column<int>(type: "int", nullable: false), Description = table.Column<string>(maxLength: 1000, nullable: true),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true), Value = table.Column<string>(maxLength: 4000, nullable: false),
Expiration = table.Column<DateTime>(type: "datetime2", nullable: true), Expiration = table.Column<DateTime>(nullable: true),
Type = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true), Type = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true) Created = table.Column<DateTime>(nullable: false),
ApiResourceId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -161,11 +197,11 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientClaims", name: "ClientClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(type: "int", nullable: false), Type = table.Column<string>(maxLength: 250, nullable: false),
Type = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false), Value = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false) ClientId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -182,10 +218,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientCorsOrigins", name: "ClientCorsOrigins",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(type: "int", nullable: false), Origin = table.Column<string>(maxLength: 150, nullable: false),
Origin = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false) ClientId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -202,10 +238,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientGrantTypes", name: "ClientGrantTypes",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(type: "int", nullable: false), GrantType = table.Column<string>(maxLength: 250, nullable: false),
GrantType = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false) ClientId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -222,10 +258,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientIdPRestrictions", name: "ClientIdPRestrictions",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(type: "int", nullable: false), Provider = table.Column<string>(maxLength: 200, nullable: false),
Provider = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false) ClientId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -242,10 +278,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientPostLogoutRedirectUris", name: "ClientPostLogoutRedirectUris",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(type: "int", nullable: false), PostLogoutRedirectUri = table.Column<string>(maxLength: 2000, nullable: false),
PostLogoutRedirectUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false) ClientId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -262,11 +298,11 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientProperties", name: "ClientProperties",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(type: "int", nullable: false), Key = table.Column<string>(maxLength: 250, nullable: false),
Key = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false), Value = table.Column<string>(maxLength: 2000, nullable: false),
Value = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false) ClientId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -283,10 +319,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientRedirectUris", name: "ClientRedirectUris",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(type: "int", nullable: false), RedirectUri = table.Column<string>(maxLength: 2000, nullable: false),
RedirectUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false) ClientId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -303,10 +339,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientScopes", name: "ClientScopes",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(type: "int", nullable: false), Scope = table.Column<string>(maxLength: 200, nullable: false),
Scope = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false) ClientId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -323,13 +359,14 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "ClientSecrets", name: "ClientSecrets",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClientId = table.Column<int>(type: "int", nullable: false), Description = table.Column<string>(maxLength: 2000, nullable: true),
Description = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true), Value = table.Column<string>(maxLength: 4000, nullable: false),
Expiration = table.Column<DateTime>(type: "datetime2", nullable: true), Expiration = table.Column<DateTime>(nullable: true),
Type = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true), Type = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false) Created = table.Column<DateTime>(nullable: false),
ClientId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -346,10 +383,10 @@ namespace Identity.API.Migrations.ConfigurationDb
name: "IdentityClaims", name: "IdentityClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
IdentityResourceId = table.Column<int>(type: "int", nullable: false), Type = table.Column<string>(maxLength: 200, nullable: false),
Type = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false) IdentityResourceId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -362,14 +399,35 @@ namespace Identity.API.Migrations.ConfigurationDb
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "IdentityProperties",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Key = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 2000, nullable: false),
IdentityResourceId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityProperties", x => x.Id);
table.ForeignKey(
name: "FK_IdentityProperties_IdentityResources_IdentityResourceId",
column: x => x.IdentityResourceId,
principalTable: "IdentityResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "ApiScopeClaims", name: "ApiScopeClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ApiScopeId = table.Column<int>(type: "int", nullable: false), Type = table.Column<string>(maxLength: 200, nullable: false),
Type = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false) ApiScopeId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -387,6 +445,11 @@ namespace Identity.API.Migrations.ConfigurationDb
table: "ApiClaims", table: "ApiClaims",
column: "ApiResourceId"); column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiProperties_ApiResourceId",
table: "ApiProperties",
column: "ApiResourceId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ApiResources_Name", name: "IX_ApiResources_Name",
table: "ApiResources", table: "ApiResources",
@ -470,6 +533,11 @@ namespace Identity.API.Migrations.ConfigurationDb
table: "IdentityClaims", table: "IdentityClaims",
column: "IdentityResourceId"); column: "IdentityResourceId");
migrationBuilder.CreateIndex(
name: "IX_IdentityProperties_IdentityResourceId",
table: "IdentityProperties",
column: "IdentityResourceId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_IdentityResources_Name", name: "IX_IdentityResources_Name",
table: "IdentityResources", table: "IdentityResources",
@ -482,6 +550,9 @@ namespace Identity.API.Migrations.ConfigurationDb
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ApiClaims"); name: "ApiClaims");
migrationBuilder.DropTable(
name: "ApiProperties");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ApiScopeClaims"); name: "ApiScopeClaims");
@ -518,6 +589,9 @@ namespace Identity.API.Migrations.ConfigurationDb
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "IdentityClaims"); name: "IdentityClaims");
migrationBuilder.DropTable(
name: "IdentityProperties");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ApiScopes"); name: "ApiScopes");

View File

@ -1,39 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
namespace Identity.API.Migrations.PersistedGrantDb
{
public partial class Grants : 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");
}
}
}

View File

@ -1,25 +1,59 @@
// <auto-generated /> // <auto-generated />
using System;
using IdentityServer4.EntityFramework.DbContexts; using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using System;
namespace Identity.API.Migrations.PersistedGrantDb namespace Identity.API.Migrations.PersistedGrantDb
{ {
[DbContext(typeof(PersistedGrantDbContext))] [DbContext(typeof(PersistedGrantDbContext))]
[Migration("20170927170423_Grants")] [Migration("20190729092100_InitialPersistedGrantMigration")]
partial class Grants partial class InitialPersistedGrantMigration
{ {
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", "2.0.0-rtm-26452") .HasAnnotation("ProductVersion", "3.0.0-preview7.19362.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
{
b.Property<string>("UserCode")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<DateTime>("CreationTime");
b.Property<string>("Data")
.IsRequired()
.HasMaxLength(50000);
b.Property<string>("DeviceCode")
.IsRequired()
.HasMaxLength(200);
b.Property<DateTime?>("Expiration")
.IsRequired();
b.Property<string>("SubjectId")
.HasMaxLength(200);
b.HasKey("UserCode");
b.HasIndex("DeviceCode")
.IsUnique();
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")

View File

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

View File

@ -1,11 +1,10 @@
// <auto-generated /> // <auto-generated />
using System;
using IdentityServer4.EntityFramework.DbContexts; using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace Identity.API.Migrations.PersistedGrantDb namespace Identity.API.Migrations.PersistedGrantDb
{ {
@ -16,9 +15,43 @@ namespace Identity.API.Migrations.PersistedGrantDb
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452") .HasAnnotation("ProductVersion", "3.0.0-preview7.19362.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
{
b.Property<string>("UserCode")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<DateTime>("CreationTime");
b.Property<string>("Data")
.IsRequired()
.HasMaxLength(50000);
b.Property<string>("DeviceCode")
.IsRequired()
.HasMaxLength(200);
b.Property<DateTime?>("Expiration")
.IsRequired();
b.Property<string>("SubjectId")
.HasMaxLength(200);
b.HasKey("UserCode");
b.HasIndex("DeviceCode")
.IsUnique();
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")

View File

@ -169,7 +169,6 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
ConfigureAuth(app); ConfigureAuth(app);
app.UseAuthorization();
app.UseRouting(); app.UseRouting();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
@ -230,6 +229,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
} }
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization();
} }
private void RegisterEventBus(IServiceCollection services) private void RegisterEventBus(IServiceCollection services)

View File

@ -50,7 +50,7 @@
// Add framework services. // Add framework services.
services.AddCustomHealthCheck(Configuration); services.AddCustomHealthCheck(Configuration);
services.AddControllers(); services.AddControllers().AddNewtonsoftJson();
services.Configure<MarketingSettings>(Configuration); services.Configure<MarketingSettings>(Configuration);
ConfigureAuthService(services); ConfigureAuthService(services);
@ -122,7 +122,7 @@
options.DescribeAllEnumsAsStrings(); options.DescribeAllEnumsAsStrings();
options.SwaggerDoc("v1", new OpenApiInfo options.SwaggerDoc("v1", new OpenApiInfo
{ {
Title = "Marketing HTTP API", Title = "eShopOnContainers - Marketing HTTP API",
Version = "v1", Version = "v1",
Description = "The Marketing Service HTTP API" Description = "The Marketing Service HTTP API"
}); });
@ -189,7 +189,6 @@
ConfigureAuth(app); ConfigureAuth(app);
app.UseAuthorization();
app.UseRouting(); app.UseRouting();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
@ -207,11 +206,11 @@
}); });
app.UseSwagger() app.UseSwagger()
.UseSwaggerUI(c => .UseSwaggerUI(setup =>
{ {
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Marketing.API V1"); setup.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Marketing.API V1");
c.OAuthClientId("marketingswaggerui"); setup.OAuthClientId("marketingswaggerui");
c.OAuthAppName("Marketing Swagger UI"); setup.OAuthAppName("Marketing Swagger UI");
}); });
ConfigureEventBus(app); ConfigureEventBus(app);
@ -234,11 +233,11 @@
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(options => }).AddJwtBearer(options =>
{ {
options.Authority = Configuration.GetValue<string>("IdentityUrl"); options.Authority = Configuration.GetValue<string>("IdentityUrl");
options.Audience = "marketing"; options.Audience = "marketing";
options.RequireHttpsMetadata = false; options.RequireHttpsMetadata = false;
}); });
} }
private void RegisterEventBus(IServiceCollection services) private void RegisterEventBus(IServiceCollection services)
@ -295,6 +294,7 @@
} }
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization();
} }
} }

View File

@ -83,7 +83,6 @@
ConfigureAuth(app); ConfigureAuth(app);
app.UseAuthorization();
app.UseRouting(); app.UseRouting();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
@ -132,6 +131,7 @@
} }
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization();
} }
} }
@ -242,14 +242,14 @@
options.DescribeAllEnumsAsStrings(); options.DescribeAllEnumsAsStrings();
options.SwaggerDoc("v1", new OpenApiInfo options.SwaggerDoc("v1", new OpenApiInfo
{ {
Title = "Ordering HTTP API", Title = "eShopOnContainers - Ordering HTTP API",
Version = "v1", Version = "v1",
Description = "The Ordering Service HTTP API" Description = "The Ordering Service HTTP API"
}); });
options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
{ {
Type = SecuritySchemeType.OAuth2, Type = SecuritySchemeType.OAuth2,
Flows = new OpenApi.Models.OpenApiOAuthFlows() Flows = new OpenApiOAuthFlows()
{ {
Implicit = new OpenApiOAuthFlow() Implicit = new OpenApiOAuthFlow()
{ {

View File

@ -135,7 +135,6 @@ namespace Ordering.SignalrHub
} }
app.UseCors("CorsPolicy"); app.UseCors("CorsPolicy");
app.UseAuthentication();
app.UseRouting(); app.UseRouting();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {

View File

@ -82,7 +82,6 @@ namespace Webhooks.API
ConfigureAuth(app); ConfigureAuth(app);
app.UseAuthorization();
app.UseRouting(); app.UseRouting();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {