diff --git a/src/Services/Identity/Identity.API/Controllers/AccountController.cs b/src/Services/Identity/Identity.API/Controllers/AccountController.cs index fd041cf7b..60191b9f3 100644 --- a/src/Services/Identity/Identity.API/Controllers/AccountController.cs +++ b/src/Services/Identity/Identity.API/Controllers/AccountController.cs @@ -126,9 +126,9 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers private async Task BuildLoginViewModelAsync(string returnUrl, AuthorizationRequest context) { var allowLocal = true; - if (context?.ClientId != null) + if (context?.Client.ClientId != null) { - var client = await _clientStore.FindEnabledClientByIdAsync(context.ClientId); + var client = await _clientStore.FindEnabledClientByIdAsync(context.Client.ClientId); if (client != null) { allowLocal = client.EnableLocalLogin; diff --git a/src/Services/Identity/Identity.API/Controllers/ConsentController.cs b/src/Services/Identity/Identity.API/Controllers/ConsentController.cs index b8a11fb1c..14ad0cf01 100644 --- a/src/Services/Identity/Identity.API/Controllers/ConsentController.cs +++ b/src/Services/Identity/Identity.API/Controllers/ConsentController.cs @@ -1,9 +1,15 @@ -using IdentityServer4.Models; +using IdentityServer4.Events; +using IdentityServer4.Extensions; +using IdentityServer4.Models; using IdentityServer4.Services; using IdentityServer4.Stores; +using IdentityServer4.Validation; using Microsoft.AspNetCore.Mvc; -using Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels; +using Microsoft.eShopOnContainers.Services.Identity.API.Extensions; +using Microsoft.eShopOnContainers.Services.Identity.API.Models.ConsentViewModels; using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -14,22 +20,18 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers /// public class ConsentController : Controller { - private readonly ILogger _logger; - private readonly IClientStore _clientStore; - private readonly IResourceStore _resourceStore; private readonly IIdentityServerInteractionService _interaction; - + private readonly IEventService _events; + private readonly ILogger _logger; public ConsentController( - ILogger logger, IIdentityServerInteractionService interaction, - IClientStore clientStore, - IResourceStore resourceStore) + IEventService events, + ILogger logger) { - _logger = logger; _interaction = interaction; - _clientStore = clientStore; - _resourceStore = resourceStore; + _events = events; + _logger = logger; } /// @@ -41,7 +43,6 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers public async Task Index(string returnUrl) { var vm = await BuildViewModelAsync(returnUrl); - ViewData["ReturnUrl"] = returnUrl; if (vm != null) { return View("Index", vm); @@ -57,77 +58,111 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers [ValidateAntiForgeryToken] public async Task Index(ConsentInputModel model) { - // parse the return URL back to an AuthorizeRequest object - var request = await _interaction.GetAuthorizationContextAsync(model.ReturnUrl); - ConsentResponse response = null; + var result = await ProcessConsent(model); - // user clicked 'no' - send back the standard 'access_denied' response - if (model.Button == "no") + if (result.IsRedirect) { - response = ConsentResponse.Denied; - } - // user clicked 'yes' - validate the data - else if (model.Button == "yes" && model != null) - { - // if the user consented to some scope, build the response model - if (model.ScopesConsented != null && model.ScopesConsented.Any()) + var context = await _interaction.GetAuthorizationContextAsync(model.ReturnUrl); + if (context?.IsNativeClient() == true) { - response = new ConsentResponse - { - RememberConsent = model.RememberConsent, - ScopesConsented = model.ScopesConsented - }; + // The client is native, so this change in how to + // return the response is for better UX for the end user. + return this.LoadingPage("Redirect", result.RedirectUri); } - else - { - ModelState.AddModelError("", "You must pick at least one permission."); - } - } - else - { - ModelState.AddModelError("", "Invalid Selection"); + + return Redirect(result.RedirectUri); } - if (response != null) + if (result.HasValidationError) { - // communicate outcome of consent back to identityserver - await _interaction.GrantConsentAsync(request, response); - - // redirect back to authorization endpoint - return Redirect(model.ReturnUrl); + ModelState.AddModelError(string.Empty, result.ValidationError); } - var vm = await BuildViewModelAsync(model.ReturnUrl, model); - if (vm != null) + if (result.ShowView) { - return View("Index", vm); + return View("Index", result.ViewModel); } return View("Error"); } - async Task BuildViewModelAsync(string returnUrl, ConsentInputModel model = null) + /*****************************************/ + /* helper APIs for the ConsentController */ + /*****************************************/ + private async Task ProcessConsent(ConsentInputModel model) + { + var result = new ProcessConsentResult(); + + // validate return url is still valid + var request = await _interaction.GetAuthorizationContextAsync(model.ReturnUrl); + if (request == null) return result; + + ConsentResponse grantedConsent = null; + + // user clicked 'no' - send back the standard 'access_denied' response + if (model?.Button == "no") + { + grantedConsent = new ConsentResponse { Error = AuthorizationError.AccessDenied }; + + // emit event + await _events.RaiseAsync(new ConsentDeniedEvent(User.GetSubjectId(), request.Client.ClientId, request.ValidatedResources.RawScopeValues)); + } + // user clicked 'yes' - validate the data + else if (model?.Button == "yes") + { + // if the user consented to some scope, build the response model + if (model.ScopesConsented != null && model.ScopesConsented.Any()) + { + var scopes = model.ScopesConsented; + if (ConsentOptions.EnableOfflineAccess == false) + { + scopes = scopes.Where(x => x != IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess); + } + + grantedConsent = new ConsentResponse + { + RememberConsent = model.RememberConsent, + ScopesValuesConsented = scopes.ToArray(), + Description = model.Description + }; + + // emit event + await _events.RaiseAsync(new ConsentGrantedEvent(User.GetSubjectId(), request.Client.ClientId, request.ValidatedResources.RawScopeValues, grantedConsent.ScopesValuesConsented, grantedConsent.RememberConsent)); + } + else + { + result.ValidationError = ConsentOptions.MustChooseOneErrorMessage; + } + } + else + { + result.ValidationError = ConsentOptions.InvalidSelectionErrorMessage; + } + + if (grantedConsent != null) + { + // communicate outcome of consent back to identityserver + await _interaction.GrantConsentAsync(request, grantedConsent); + + // indicate that's it ok to redirect back to authorization endpoint + result.RedirectUri = model.ReturnUrl; + result.Client = request.Client; + } + else + { + // we need to redisplay the consent UI + result.ViewModel = await BuildViewModelAsync(model.ReturnUrl, model); + } + + return result; + } + + private async Task BuildViewModelAsync(string returnUrl, ConsentInputModel model = null) { var request = await _interaction.GetAuthorizationContextAsync(returnUrl); if (request != null) { - var client = await _clientStore.FindEnabledClientByIdAsync(request.ClientId); - if (client != null) - { - var resources = await _resourceStore.FindEnabledResourcesByScopeAsync(request.ScopesRequested); - if (resources != null && (resources.IdentityResources.Any() || resources.ApiResources.Any())) - { - return new ConsentViewModel(model, returnUrl, request, client, resources); - } - else - { - _logger.LogError("No scopes matching: {0}", request.ScopesRequested.Aggregate((x, y) => x + ", " + y)); - } - } - else - { - _logger.LogError("Invalid client id: {0}", request.ClientId); - } + return CreateConsentViewModel(model, returnUrl, request); } else { @@ -136,5 +171,88 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers return null; } + + private ConsentViewModel CreateConsentViewModel( + ConsentInputModel model, string returnUrl, + AuthorizationRequest request) + { + var vm = new ConsentViewModel + { + RememberConsent = model?.RememberConsent ?? true, + ScopesConsented = model?.ScopesConsented ?? Enumerable.Empty(), + Description = model?.Description, + + ReturnUrl = returnUrl, + + ClientName = request.Client.ClientName ?? request.Client.ClientId, + ClientUrl = request.Client.ClientUri, + ClientLogoUrl = request.Client.LogoUri, + AllowRememberConsent = request.Client.AllowRememberConsent + }; + + vm.IdentityScopes = request.ValidatedResources.Resources.IdentityResources.Select(x => CreateScopeViewModel(x, vm.ScopesConsented.Contains(x.Name) || model == null)).ToArray(); + + var apiScopes = new List(); + foreach (var parsedScope in request.ValidatedResources.ParsedScopes) + { + var apiScope = request.ValidatedResources.Resources.FindApiScope(parsedScope.ParsedName); + if (apiScope != null) + { + var scopeVm = CreateScopeViewModel(parsedScope, apiScope, vm.ScopesConsented.Contains(parsedScope.RawValue) || model == null); + apiScopes.Add(scopeVm); + } + } + if (ConsentOptions.EnableOfflineAccess && request.ValidatedResources.Resources.OfflineAccess) + { + apiScopes.Add(GetOfflineAccessScope(vm.ScopesConsented.Contains(IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess) || model == null)); + } + vm.ApiScopes = apiScopes; + + return vm; + } + + private ScopeViewModel CreateScopeViewModel(IdentityResource identity, bool check) + { + return new ScopeViewModel + { + Value = identity.Name, + DisplayName = identity.DisplayName ?? identity.Name, + Description = identity.Description, + Emphasize = identity.Emphasize, + Required = identity.Required, + Checked = check || identity.Required + }; + } + + public ScopeViewModel CreateScopeViewModel(ParsedScopeValue parsedScopeValue, ApiScope apiScope, bool check) + { + var displayName = apiScope.DisplayName ?? apiScope.Name; + if (!String.IsNullOrWhiteSpace(parsedScopeValue.ParsedParameter)) + { + displayName += ":" + parsedScopeValue.ParsedParameter; + } + + return new ScopeViewModel + { + Value = parsedScopeValue.RawValue, + DisplayName = displayName, + Description = apiScope.Description, + Emphasize = apiScope.Emphasize, + Required = apiScope.Required, + Checked = check || apiScope.Required + }; + } + + private ScopeViewModel GetOfflineAccessScope(bool check) + { + return new ScopeViewModel + { + Value = IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess, + DisplayName = ConsentOptions.OfflineAccessDisplayName, + Description = ConsentOptions.OfflineAccessDescription, + Emphasize = true, + Checked = check + }; + } } } \ No newline at end of file diff --git a/src/Services/Identity/Identity.API/Extensions/Extensions.cs b/src/Services/Identity/Identity.API/Extensions/Extensions.cs new file mode 100644 index 000000000..0410480e6 --- /dev/null +++ b/src/Services/Identity/Identity.API/Extensions/Extensions.cs @@ -0,0 +1,28 @@ +using System; +using IdentityServer4.Models; +using Microsoft.AspNetCore.Mvc; +using Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels; + +namespace Microsoft.eShopOnContainers.Services.Identity.API.Extensions +{ + public static class Extensions + { + /// + /// Checks if the redirect URI is for a native client. + /// + /// + public static bool IsNativeClient(this AuthorizationRequest context) + { + return !context.RedirectUri.StartsWith("https", StringComparison.Ordinal) + && !context.RedirectUri.StartsWith("http", StringComparison.Ordinal); + } + + public static IActionResult LoadingPage(this Controller controller, string viewName, string redirectUri) + { + controller.HttpContext.Response.StatusCode = 200; + controller.HttpContext.Response.Headers["Location"] = ""; + + return controller.View(viewName, new RedirectViewModel { RedirectUrl = redirectUri }); + } + } +} diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index 7184410d2..4ea6237b6 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -19,11 +19,11 @@ - - - - - + + + + + @@ -38,6 +38,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -63,7 +67,10 @@ - + + + + diff --git a/src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20190729092011_InitialConfigurationMigration.cs b/src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20190729092011_InitialConfigurationMigration.cs deleted file mode 100644 index 8eb69adad..000000000 --- a/src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20190729092011_InitialConfigurationMigration.cs +++ /dev/null @@ -1,608 +0,0 @@ -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using System; - -namespace Identity.API.Migrations.ConfigurationDb -{ - public partial class InitialConfigurationMigration : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ApiResources", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Enabled = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Created = table.Column(nullable: false), - Updated = table.Column(nullable: true), - LastAccessed = table.Column(nullable: true), - NonEditable = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ApiResources", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Clients", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Enabled = table.Column(nullable: false), - ClientId = table.Column(maxLength: 200, nullable: false), - ProtocolType = table.Column(maxLength: 200, nullable: false), - RequireClientSecret = table.Column(nullable: false), - ClientName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - ClientUri = table.Column(maxLength: 2000, nullable: true), - LogoUri = table.Column(maxLength: 2000, nullable: true), - RequireConsent = table.Column(nullable: false), - AllowRememberConsent = table.Column(nullable: false), - AlwaysIncludeUserClaimsInIdToken = table.Column(nullable: false), - RequirePkce = table.Column(nullable: false), - AllowPlainTextPkce = table.Column(nullable: false), - AllowAccessTokensViaBrowser = table.Column(nullable: false), - FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - FrontChannelLogoutSessionRequired = table.Column(nullable: false), - BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - BackChannelLogoutSessionRequired = table.Column(nullable: false), - AllowOfflineAccess = table.Column(nullable: false), - IdentityTokenLifetime = table.Column(nullable: false), - AccessTokenLifetime = table.Column(nullable: false), - AuthorizationCodeLifetime = table.Column(nullable: false), - ConsentLifetime = table.Column(nullable: true), - AbsoluteRefreshTokenLifetime = table.Column(nullable: false), - SlidingRefreshTokenLifetime = table.Column(nullable: false), - RefreshTokenUsage = table.Column(nullable: false), - UpdateAccessTokenClaimsOnRefresh = table.Column(nullable: false), - RefreshTokenExpiration = table.Column(nullable: false), - AccessTokenType = table.Column(nullable: false), - EnableLocalLogin = table.Column(nullable: false), - IncludeJwtId = table.Column(nullable: false), - AlwaysSendClientClaims = table.Column(nullable: false), - ClientClaimsPrefix = table.Column(maxLength: 200, nullable: true), - PairWiseSubjectSalt = table.Column(maxLength: 200, nullable: true), - Created = table.Column(nullable: false), - Updated = table.Column(nullable: true), - LastAccessed = table.Column(nullable: true), - UserSsoLifetime = table.Column(nullable: true), - UserCodeType = table.Column(maxLength: 100, nullable: true), - DeviceCodeLifetime = table.Column(nullable: false), - NonEditable = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Clients", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityResources", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Enabled = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false), - Created = table.Column(nullable: false), - Updated = table.Column(nullable: true), - NonEditable = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityResources", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "ApiClaims", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Type = table.Column(maxLength: 200, nullable: false), - ApiResourceId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ApiClaims", x => x.Id); - table.ForeignKey( - name: "FK_ApiClaims_ApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "ApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ApiProperties", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false), - ApiResourceId = table.Column(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: "ApiScopes", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false), - ApiResourceId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ApiScopes", x => x.Id); - table.ForeignKey( - name: "FK_ApiScopes_ApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "ApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ApiSecrets", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Description = table.Column(maxLength: 1000, nullable: true), - Value = table.Column(maxLength: 4000, nullable: false), - Expiration = table.Column(nullable: true), - Type = table.Column(maxLength: 250, nullable: false), - Created = table.Column(nullable: false), - ApiResourceId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ApiSecrets", x => x.Id); - table.ForeignKey( - name: "FK_ApiSecrets_ApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "ApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ClientClaims", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 250, nullable: false), - ClientId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ClientClaims", x => x.Id); - table.ForeignKey( - name: "FK_ClientClaims_Clients_ClientId", - column: x => x.ClientId, - principalTable: "Clients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ClientCorsOrigins", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Origin = table.Column(maxLength: 150, nullable: false), - ClientId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ClientCorsOrigins", x => x.Id); - table.ForeignKey( - name: "FK_ClientCorsOrigins_Clients_ClientId", - column: x => x.ClientId, - principalTable: "Clients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ClientGrantTypes", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - GrantType = table.Column(maxLength: 250, nullable: false), - ClientId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ClientGrantTypes", x => x.Id); - table.ForeignKey( - name: "FK_ClientGrantTypes_Clients_ClientId", - column: x => x.ClientId, - principalTable: "Clients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ClientIdPRestrictions", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Provider = table.Column(maxLength: 200, nullable: false), - ClientId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ClientIdPRestrictions", x => x.Id); - table.ForeignKey( - name: "FK_ClientIdPRestrictions_Clients_ClientId", - column: x => x.ClientId, - principalTable: "Clients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ClientPostLogoutRedirectUris", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false), - ClientId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ClientPostLogoutRedirectUris", x => x.Id); - table.ForeignKey( - name: "FK_ClientPostLogoutRedirectUris_Clients_ClientId", - column: x => x.ClientId, - principalTable: "Clients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ClientProperties", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false), - ClientId = table.Column(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(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RedirectUri = table.Column(maxLength: 2000, nullable: false), - ClientId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ClientRedirectUris", x => x.Id); - table.ForeignKey( - name: "FK_ClientRedirectUris_Clients_ClientId", - column: x => x.ClientId, - principalTable: "Clients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ClientScopes", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Scope = table.Column(maxLength: 200, nullable: false), - ClientId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ClientScopes", x => x.Id); - table.ForeignKey( - name: "FK_ClientScopes_Clients_ClientId", - column: x => x.ClientId, - principalTable: "Clients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ClientSecrets", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Description = table.Column(maxLength: 2000, nullable: true), - Value = table.Column(maxLength: 4000, nullable: false), - Expiration = table.Column(nullable: true), - Type = table.Column(maxLength: 250, nullable: false), - Created = table.Column(nullable: false), - ClientId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ClientSecrets", x => x.Id); - table.ForeignKey( - name: "FK_ClientSecrets_Clients_ClientId", - column: x => x.ClientId, - principalTable: "Clients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityClaims", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Type = table.Column(maxLength: 200, nullable: false), - IdentityResourceId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityClaims", x => x.Id); - table.ForeignKey( - name: "FK_IdentityClaims_IdentityResources_IdentityResourceId", - column: x => x.IdentityResourceId, - principalTable: "IdentityResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityProperties", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false), - IdentityResourceId = table.Column(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( - name: "ApiScopeClaims", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Type = table.Column(maxLength: 200, nullable: false), - ApiScopeId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ApiScopeClaims", x => x.Id); - table.ForeignKey( - name: "FK_ApiScopeClaims_ApiScopes_ApiScopeId", - column: x => x.ApiScopeId, - principalTable: "ApiScopes", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_ApiClaims_ApiResourceId", - table: "ApiClaims", - column: "ApiResourceId"); - - migrationBuilder.CreateIndex( - name: "IX_ApiProperties_ApiResourceId", - table: "ApiProperties", - column: "ApiResourceId"); - - migrationBuilder.CreateIndex( - name: "IX_ApiResources_Name", - table: "ApiResources", - column: "Name", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ApiScopeClaims_ApiScopeId", - table: "ApiScopeClaims", - column: "ApiScopeId"); - - migrationBuilder.CreateIndex( - name: "IX_ApiScopes_ApiResourceId", - table: "ApiScopes", - column: "ApiResourceId"); - - migrationBuilder.CreateIndex( - name: "IX_ApiScopes_Name", - table: "ApiScopes", - column: "Name", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ApiSecrets_ApiResourceId", - table: "ApiSecrets", - column: "ApiResourceId"); - - migrationBuilder.CreateIndex( - name: "IX_ClientClaims_ClientId", - table: "ClientClaims", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_ClientCorsOrigins_ClientId", - table: "ClientCorsOrigins", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_ClientGrantTypes_ClientId", - table: "ClientGrantTypes", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_ClientIdPRestrictions_ClientId", - table: "ClientIdPRestrictions", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_ClientPostLogoutRedirectUris_ClientId", - 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", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_ClientSecrets_ClientId", - table: "ClientSecrets", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityClaims_IdentityResourceId", - table: "IdentityClaims", - column: "IdentityResourceId"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityProperties_IdentityResourceId", - table: "IdentityProperties", - column: "IdentityResourceId"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityResources_Name", - table: "IdentityResources", - column: "Name", - unique: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ApiClaims"); - - migrationBuilder.DropTable( - name: "ApiProperties"); - - migrationBuilder.DropTable( - name: "ApiScopeClaims"); - - migrationBuilder.DropTable( - name: "ApiSecrets"); - - migrationBuilder.DropTable( - name: "ClientClaims"); - - migrationBuilder.DropTable( - name: "ClientCorsOrigins"); - - migrationBuilder.DropTable( - name: "ClientGrantTypes"); - - migrationBuilder.DropTable( - name: "ClientIdPRestrictions"); - - migrationBuilder.DropTable( - name: "ClientPostLogoutRedirectUris"); - - migrationBuilder.DropTable( - name: "ClientProperties"); - - migrationBuilder.DropTable( - name: "ClientRedirectUris"); - - migrationBuilder.DropTable( - name: "ClientScopes"); - - migrationBuilder.DropTable( - name: "ClientSecrets"); - - migrationBuilder.DropTable( - name: "IdentityClaims"); - - migrationBuilder.DropTable( - name: "IdentityProperties"); - - migrationBuilder.DropTable( - name: "ApiScopes"); - - migrationBuilder.DropTable( - name: "Clients"); - - migrationBuilder.DropTable( - name: "IdentityResources"); - - migrationBuilder.DropTable( - name: "ApiResources"); - } - } -} diff --git a/src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20190729092011_InitialConfigurationMigration.Designer.cs b/src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20210301145249_InitialConfigurationMigration.Designer.cs similarity index 50% rename from src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20190729092011_InitialConfigurationMigration.Designer.cs rename to src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20210301145249_InitialConfigurationMigration.Designer.cs index 5e801b306..f5eb45444 100644 --- a/src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20190729092011_InitialConfigurationMigration.Designer.cs +++ b/src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20210301145249_InitialConfigurationMigration.Designer.cs @@ -10,42 +10,58 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Identity.API.Migrations.ConfigurationDb { [DbContext(typeof(ConfigurationDbContext))] - [Migration("20190729092011_InitialConfigurationMigration")] + [Migration("20210301145249_InitialConfigurationMigration")] partial class InitialConfigurationMigration { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview7.19362.6") + .UseIdentityColumns() .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "5.0.2"); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("Created"); + b.Property("AllowedAccessTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Created") + .HasColumnType("datetime2"); b.Property("Description") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); - b.Property("LastAccessed"); + b.Property("LastAccessed") + .HasColumnType("datetime2"); b.Property("Name") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("NonEditable"); + b.Property("NonEditable") + .HasColumnType("bit"); - b.Property("Updated"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); + + b.Property("Updated") + .HasColumnType("datetime2"); b.HasKey("Id"); @@ -59,72 +75,144 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("int"); b.Property("Type") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); b.HasIndex("ApiResourceId"); - b.ToTable("ApiClaims"); + b.ToTable("ApiResourceClaims"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("int"); b.Property("Key") .IsRequired() - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") .IsRequired() - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("Id"); b.HasIndex("ApiResourceId"); - b.ToTable("ApiProperties"); + b.ToTable("ApiResourceProperties"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("ApiResourceId") + .HasColumnType("int"); + + b.Property("Scope") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("ApiResourceId"); + + b.ToTable("ApiResourceScopes"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("ApiResourceId") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); + + b.HasKey("Id"); + + b.HasIndex("ApiResourceId"); + + b.ToTable("ApiResourceSecrets"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ApiResourceId"); + .HasColumnType("int") + .UseIdentityColumn(); b.Property("Description") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); + + b.Property("Enabled") + .HasColumnType("bit"); b.Property("Name") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("Id"); - b.HasIndex("ApiResourceId"); - b.HasIndex("Name") .IsUnique(); @@ -135,151 +223,200 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ApiScopeId"); + b.Property("ScopeId") + .HasColumnType("int"); b.Property("Type") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); - b.HasIndex("ApiScopeId"); + b.HasIndex("ScopeId"); b.ToTable("ApiScopeClaims"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ApiResourceId"); - - b.Property("Created"); - - b.Property("Description") - .HasMaxLength(1000); - - b.Property("Expiration"); - - b.Property("Type") + b.Property("Key") .IsRequired() - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("ScopeId") + .HasColumnType("int"); b.Property("Value") .IsRequired() - .HasMaxLength(4000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("Id"); - b.HasIndex("ApiResourceId"); + b.HasIndex("ScopeId"); - b.ToTable("ApiSecrets"); + b.ToTable("ApiScopeProperties"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("AbsoluteRefreshTokenLifetime"); + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenLifetime"); + b.Property("AccessTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenType"); + b.Property("AccessTokenType") + .HasColumnType("int"); - b.Property("AllowAccessTokensViaBrowser"); + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("bit"); - b.Property("AllowOfflineAccess"); + b.Property("AllowOfflineAccess") + .HasColumnType("bit"); - b.Property("AllowPlainTextPkce"); + b.Property("AllowPlainTextPkce") + .HasColumnType("bit"); - b.Property("AllowRememberConsent"); + b.Property("AllowRememberConsent") + .HasColumnType("bit"); - b.Property("AlwaysIncludeUserClaimsInIdToken"); + b.Property("AllowedIdentityTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("AlwaysSendClientClaims"); + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("bit"); - b.Property("AuthorizationCodeLifetime"); + b.Property("AlwaysSendClientClaims") + .HasColumnType("bit"); - b.Property("BackChannelLogoutSessionRequired"); + b.Property("AuthorizationCodeLifetime") + .HasColumnType("int"); + + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("BackChannelLogoutUri") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("ClientClaimsPrefix") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientId") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientName") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientUri") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); - b.Property("ConsentLifetime"); + b.Property("ConsentLifetime") + .HasColumnType("int"); - b.Property("Created"); + b.Property("Created") + .HasColumnType("datetime2"); b.Property("Description") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); - b.Property("DeviceCodeLifetime"); + b.Property("DeviceCodeLifetime") + .HasColumnType("int"); - b.Property("EnableLocalLogin"); + b.Property("EnableLocalLogin") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); - b.Property("FrontChannelLogoutSessionRequired"); + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("FrontChannelLogoutUri") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); - b.Property("IdentityTokenLifetime"); + b.Property("IdentityTokenLifetime") + .HasColumnType("int"); - b.Property("IncludeJwtId"); + b.Property("IncludeJwtId") + .HasColumnType("bit"); - b.Property("LastAccessed"); + b.Property("LastAccessed") + .HasColumnType("datetime2"); b.Property("LogoUri") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); - b.Property("NonEditable"); + b.Property("NonEditable") + .HasColumnType("bit"); b.Property("PairWiseSubjectSalt") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ProtocolType") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("RefreshTokenExpiration"); + b.Property("RefreshTokenExpiration") + .HasColumnType("int"); - b.Property("RefreshTokenUsage"); + b.Property("RefreshTokenUsage") + .HasColumnType("int"); - b.Property("RequireClientSecret"); + b.Property("RequireClientSecret") + .HasColumnType("bit"); - b.Property("RequireConsent"); + b.Property("RequireConsent") + .HasColumnType("bit"); - b.Property("RequirePkce"); + b.Property("RequirePkce") + .HasColumnType("bit"); - b.Property("SlidingRefreshTokenLifetime"); + b.Property("RequireRequestObject") + .HasColumnType("bit"); - b.Property("UpdateAccessTokenClaimsOnRefresh"); + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("Updated"); + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("bit"); + + b.Property("Updated") + .HasColumnType("datetime2"); b.Property("UserCodeType") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("UserSsoLifetime"); + b.Property("UserSsoLifetime") + .HasColumnType("int"); b.HasKey("Id"); @@ -293,17 +430,21 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("Type") .IsRequired() - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") .IsRequired() - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.HasKey("Id"); @@ -316,13 +457,16 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("Origin") .IsRequired() - .HasMaxLength(150); + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); b.HasKey("Id"); @@ -335,13 +479,16 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("GrantType") .IsRequired() - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.HasKey("Id"); @@ -354,13 +501,16 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("Provider") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); @@ -373,13 +523,16 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("PostLogoutRedirectUri") .IsRequired() - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("Id"); @@ -392,17 +545,21 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("Key") .IsRequired() - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") .IsRequired() - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("Id"); @@ -415,13 +572,16 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("RedirectUri") .IsRequired() - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("Id"); @@ -434,13 +594,16 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("Scope") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); @@ -453,24 +616,31 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); - b.Property("Created"); + b.Property("Created") + .HasColumnType("datetime2"); b.Property("Description") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.Property("Type") .IsRequired() - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") .IsRequired() - .HasMaxLength(4000); + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); b.HasKey("Id"); @@ -479,54 +649,46 @@ namespace Identity.API.Migrations.ConfigurationDb b.ToTable("ClientSecrets"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("IdentityResourceId"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(200); - - b.HasKey("Id"); - - b.HasIndex("IdentityResourceId"); - - b.ToTable("IdentityClaims"); - }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("Created"); + b.Property("Created") + .HasColumnType("datetime2"); b.Property("Description") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("Name") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("NonEditable"); + b.Property("NonEditable") + .HasColumnType("bit"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); - b.Property("Updated"); + b.Property("Updated") + .HasColumnType("datetime2"); b.HasKey("Id"); @@ -536,27 +698,53 @@ namespace Identity.API.Migrations.ConfigurationDb b.ToTable("IdentityResources"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("IdentityResourceId"); + b.Property("IdentityResourceId") + .HasColumnType("int"); - b.Property("Key") + b.Property("Type") .IsRequired() - .HasMaxLength(250); - - b.Property("Value") - .IsRequired() - .HasMaxLength(2000); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); b.HasIndex("IdentityResourceId"); - b.ToTable("IdentityProperties"); + b.ToTable("IdentityResourceClaims"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("IdentityResourceId") + .HasColumnType("int"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.HasKey("Id"); + + b.HasIndex("IdentityResourceId"); + + b.ToTable("IdentityResourceProperties"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b => @@ -566,6 +754,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b => @@ -575,33 +765,52 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceScope", b => { b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource") .WithMany("Scopes") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b => - { - b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "ApiScope") - .WithMany("UserClaims") - .HasForeignKey("ApiScopeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b => { b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource") .WithMany("Secrets") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b => + { + b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "Scope") + .WithMany("UserClaims") + .HasForeignKey("ScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Scope"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b => + { + b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "Scope") + .WithMany("Properties") + .HasForeignKey("ScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Scope"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b => @@ -611,6 +820,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b => @@ -620,6 +831,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b => @@ -629,6 +842,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b => @@ -638,6 +853,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b => @@ -647,6 +864,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b => @@ -656,6 +875,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b => @@ -665,6 +886,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b => @@ -674,6 +897,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b => @@ -683,15 +908,19 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityClaim", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b => { b.HasOne("IdentityServer4.EntityFramework.Entities.IdentityResource", "IdentityResource") .WithMany("UserClaims") .HasForeignKey("IdentityResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("IdentityResource"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => @@ -701,6 +930,54 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("IdentityResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("IdentityResource"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b => + { + b.Navigation("Properties"); + + b.Navigation("Scopes"); + + b.Navigation("Secrets"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b => + { + b.Navigation("AllowedCorsOrigins"); + + b.Navigation("AllowedGrantTypes"); + + b.Navigation("AllowedScopes"); + + b.Navigation("Claims"); + + b.Navigation("ClientSecrets"); + + b.Navigation("IdentityProviderRestrictions"); + + b.Navigation("PostLogoutRedirectUris"); + + b.Navigation("Properties"); + + b.Navigation("RedirectUris"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); }); #pragma warning restore 612, 618 } diff --git a/src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20210301145249_InitialConfigurationMigration.cs b/src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20210301145249_InitialConfigurationMigration.cs new file mode 100644 index 000000000..382184233 --- /dev/null +++ b/src/Services/Identity/Identity.API/Migrations/ConfigurationDb/20210301145249_InitialConfigurationMigration.cs @@ -0,0 +1,657 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Identity.API.Migrations.ConfigurationDb +{ + public partial class InitialConfigurationMigration : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "ApiResources", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Enabled = table.Column(type: "bit", nullable: false), + Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + DisplayName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + AllowedAccessTokenSigningAlgorithms = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ShowInDiscoveryDocument = table.Column(type: "bit", nullable: false), + Created = table.Column(type: "datetime2", nullable: false), + Updated = table.Column(type: "datetime2", nullable: true), + LastAccessed = table.Column(type: "datetime2", nullable: true), + NonEditable = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiResources", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ApiScopes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Enabled = table.Column(type: "bit", nullable: false), + Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + DisplayName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Required = table.Column(type: "bit", nullable: false), + Emphasize = table.Column(type: "bit", nullable: false), + ShowInDiscoveryDocument = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiScopes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Clients", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Enabled = table.Column(type: "bit", nullable: false), + ClientId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + ProtocolType = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + RequireClientSecret = table.Column(type: "bit", nullable: false), + ClientName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + ClientUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + LogoUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + RequireConsent = table.Column(type: "bit", nullable: false), + AllowRememberConsent = table.Column(type: "bit", nullable: false), + AlwaysIncludeUserClaimsInIdToken = table.Column(type: "bit", nullable: false), + RequirePkce = table.Column(type: "bit", nullable: false), + AllowPlainTextPkce = table.Column(type: "bit", nullable: false), + RequireRequestObject = table.Column(type: "bit", nullable: false), + AllowAccessTokensViaBrowser = table.Column(type: "bit", nullable: false), + FrontChannelLogoutUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + FrontChannelLogoutSessionRequired = table.Column(type: "bit", nullable: false), + BackChannelLogoutUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + BackChannelLogoutSessionRequired = table.Column(type: "bit", nullable: false), + AllowOfflineAccess = table.Column(type: "bit", nullable: false), + IdentityTokenLifetime = table.Column(type: "int", nullable: false), + AllowedIdentityTokenSigningAlgorithms = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + AccessTokenLifetime = table.Column(type: "int", nullable: false), + AuthorizationCodeLifetime = table.Column(type: "int", nullable: false), + ConsentLifetime = table.Column(type: "int", nullable: true), + AbsoluteRefreshTokenLifetime = table.Column(type: "int", nullable: false), + SlidingRefreshTokenLifetime = table.Column(type: "int", nullable: false), + RefreshTokenUsage = table.Column(type: "int", nullable: false), + UpdateAccessTokenClaimsOnRefresh = table.Column(type: "bit", nullable: false), + RefreshTokenExpiration = table.Column(type: "int", nullable: false), + AccessTokenType = table.Column(type: "int", nullable: false), + EnableLocalLogin = table.Column(type: "bit", nullable: false), + IncludeJwtId = table.Column(type: "bit", nullable: false), + AlwaysSendClientClaims = table.Column(type: "bit", nullable: false), + ClientClaimsPrefix = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + PairWiseSubjectSalt = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Created = table.Column(type: "datetime2", nullable: false), + Updated = table.Column(type: "datetime2", nullable: true), + LastAccessed = table.Column(type: "datetime2", nullable: true), + UserSsoLifetime = table.Column(type: "int", nullable: true), + UserCodeType = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + DeviceCodeLifetime = table.Column(type: "int", nullable: false), + NonEditable = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Clients", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityResources", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Enabled = table.Column(type: "bit", nullable: false), + Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + DisplayName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Required = table.Column(type: "bit", nullable: false), + Emphasize = table.Column(type: "bit", nullable: false), + ShowInDiscoveryDocument = table.Column(type: "bit", nullable: false), + Created = table.Column(type: "datetime2", nullable: false), + Updated = table.Column(type: "datetime2", nullable: true), + NonEditable = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityResources", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ApiResourceClaims", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ApiResourceId = table.Column(type: "int", nullable: false), + Type = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiResourceClaims", x => x.Id); + table.ForeignKey( + name: "FK_ApiResourceClaims_ApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "ApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ApiResourceProperties", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ApiResourceId = table.Column(type: "int", nullable: false), + Key = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiResourceProperties", x => x.Id); + table.ForeignKey( + name: "FK_ApiResourceProperties_ApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "ApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ApiResourceScopes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Scope = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + ApiResourceId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiResourceScopes", x => x.Id); + table.ForeignKey( + name: "FK_ApiResourceScopes_ApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "ApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ApiResourceSecrets", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ApiResourceId = table.Column(type: "int", nullable: false), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Value = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: false), + Expiration = table.Column(type: "datetime2", nullable: true), + Type = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Created = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiResourceSecrets", x => x.Id); + table.ForeignKey( + name: "FK_ApiResourceSecrets_ApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "ApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ApiScopeClaims", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ScopeId = table.Column(type: "int", nullable: false), + Type = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiScopeClaims", x => x.Id); + table.ForeignKey( + name: "FK_ApiScopeClaims_ApiScopes_ScopeId", + column: x => x.ScopeId, + principalTable: "ApiScopes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ApiScopeProperties", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ScopeId = table.Column(type: "int", nullable: false), + Key = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiScopeProperties", x => x.Id); + table.ForeignKey( + name: "FK_ApiScopeProperties_ApiScopes_ScopeId", + column: x => x.ScopeId, + principalTable: "ApiScopes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ClientClaims", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Type = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + ClientId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ClientClaims", x => x.Id); + table.ForeignKey( + name: "FK_ClientClaims_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ClientCorsOrigins", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Origin = table.Column(type: "nvarchar(150)", maxLength: 150, nullable: false), + ClientId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ClientCorsOrigins", x => x.Id); + table.ForeignKey( + name: "FK_ClientCorsOrigins_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ClientGrantTypes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + GrantType = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + ClientId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ClientGrantTypes", x => x.Id); + table.ForeignKey( + name: "FK_ClientGrantTypes_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ClientIdPRestrictions", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Provider = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + ClientId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ClientIdPRestrictions", x => x.Id); + table.ForeignKey( + name: "FK_ClientIdPRestrictions_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ClientPostLogoutRedirectUris", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + PostLogoutRedirectUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false), + ClientId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ClientPostLogoutRedirectUris", x => x.Id); + table.ForeignKey( + name: "FK_ClientPostLogoutRedirectUris_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ClientProperties", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ClientId = table.Column(type: "int", nullable: false), + Key = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(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(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + RedirectUri = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false), + ClientId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ClientRedirectUris", x => x.Id); + table.ForeignKey( + name: "FK_ClientRedirectUris_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ClientScopes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Scope = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + ClientId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ClientScopes", x => x.Id); + table.ForeignKey( + name: "FK_ClientScopes_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ClientSecrets", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ClientId = table.Column(type: "int", nullable: false), + Description = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), + Value = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: false), + Expiration = table.Column(type: "datetime2", nullable: true), + Type = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Created = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ClientSecrets", x => x.Id); + table.ForeignKey( + name: "FK_ClientSecrets_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityResourceClaims", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + IdentityResourceId = table.Column(type: "int", nullable: false), + Type = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityResourceClaims", x => x.Id); + table.ForeignKey( + name: "FK_IdentityResourceClaims_IdentityResources_IdentityResourceId", + column: x => x.IdentityResourceId, + principalTable: "IdentityResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityResourceProperties", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + IdentityResourceId = table.Column(type: "int", nullable: false), + Key = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityResourceProperties", x => x.Id); + table.ForeignKey( + name: "FK_IdentityResourceProperties_IdentityResources_IdentityResourceId", + column: x => x.IdentityResourceId, + principalTable: "IdentityResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_ApiResourceClaims_ApiResourceId", + table: "ApiResourceClaims", + column: "ApiResourceId"); + + migrationBuilder.CreateIndex( + name: "IX_ApiResourceProperties_ApiResourceId", + table: "ApiResourceProperties", + column: "ApiResourceId"); + + migrationBuilder.CreateIndex( + name: "IX_ApiResources_Name", + table: "ApiResources", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ApiResourceScopes_ApiResourceId", + table: "ApiResourceScopes", + column: "ApiResourceId"); + + migrationBuilder.CreateIndex( + name: "IX_ApiResourceSecrets_ApiResourceId", + table: "ApiResourceSecrets", + column: "ApiResourceId"); + + migrationBuilder.CreateIndex( + name: "IX_ApiScopeClaims_ScopeId", + table: "ApiScopeClaims", + column: "ScopeId"); + + migrationBuilder.CreateIndex( + name: "IX_ApiScopeProperties_ScopeId", + table: "ApiScopeProperties", + column: "ScopeId"); + + migrationBuilder.CreateIndex( + name: "IX_ApiScopes_Name", + table: "ApiScopes", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ClientClaims_ClientId", + table: "ClientClaims", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_ClientCorsOrigins_ClientId", + table: "ClientCorsOrigins", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_ClientGrantTypes_ClientId", + table: "ClientGrantTypes", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_ClientIdPRestrictions_ClientId", + table: "ClientIdPRestrictions", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_ClientPostLogoutRedirectUris_ClientId", + 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", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_ClientSecrets_ClientId", + table: "ClientSecrets", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityResourceClaims_IdentityResourceId", + table: "IdentityResourceClaims", + column: "IdentityResourceId"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityResourceProperties_IdentityResourceId", + table: "IdentityResourceProperties", + column: "IdentityResourceId"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityResources_Name", + table: "IdentityResources", + column: "Name", + unique: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ApiResourceClaims"); + + migrationBuilder.DropTable( + name: "ApiResourceProperties"); + + migrationBuilder.DropTable( + name: "ApiResourceScopes"); + + migrationBuilder.DropTable( + name: "ApiResourceSecrets"); + + migrationBuilder.DropTable( + name: "ApiScopeClaims"); + + migrationBuilder.DropTable( + name: "ApiScopeProperties"); + + migrationBuilder.DropTable( + name: "ClientClaims"); + + migrationBuilder.DropTable( + name: "ClientCorsOrigins"); + + migrationBuilder.DropTable( + name: "ClientGrantTypes"); + + migrationBuilder.DropTable( + name: "ClientIdPRestrictions"); + + migrationBuilder.DropTable( + name: "ClientPostLogoutRedirectUris"); + + migrationBuilder.DropTable( + name: "ClientProperties"); + + migrationBuilder.DropTable( + name: "ClientRedirectUris"); + + migrationBuilder.DropTable( + name: "ClientScopes"); + + migrationBuilder.DropTable( + name: "ClientSecrets"); + + migrationBuilder.DropTable( + name: "IdentityResourceClaims"); + + migrationBuilder.DropTable( + name: "IdentityResourceProperties"); + + migrationBuilder.DropTable( + name: "ApiResources"); + + migrationBuilder.DropTable( + name: "ApiScopes"); + + migrationBuilder.DropTable( + name: "Clients"); + + migrationBuilder.DropTable( + name: "IdentityResources"); + } + } +} diff --git a/src/Services/Identity/Identity.API/Migrations/ConfigurationDb/ConfigurationDbContextModelSnapshot.cs b/src/Services/Identity/Identity.API/Migrations/ConfigurationDb/ConfigurationDbContextModelSnapshot.cs index ec91a8841..be6b16490 100644 --- a/src/Services/Identity/Identity.API/Migrations/ConfigurationDb/ConfigurationDbContextModelSnapshot.cs +++ b/src/Services/Identity/Identity.API/Migrations/ConfigurationDb/ConfigurationDbContextModelSnapshot.cs @@ -15,35 +15,51 @@ namespace Identity.API.Migrations.ConfigurationDb { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview7.19362.6") + .UseIdentityColumns() .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "5.0.2"); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("Created"); + b.Property("AllowedAccessTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Created") + .HasColumnType("datetime2"); b.Property("Description") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); - b.Property("LastAccessed"); + b.Property("LastAccessed") + .HasColumnType("datetime2"); b.Property("Name") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("NonEditable"); + b.Property("NonEditable") + .HasColumnType("bit"); - b.Property("Updated"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); + + b.Property("Updated") + .HasColumnType("datetime2"); b.HasKey("Id"); @@ -57,72 +73,144 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("int"); b.Property("Type") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); b.HasIndex("ApiResourceId"); - b.ToTable("ApiClaims"); + b.ToTable("ApiResourceClaims"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("int"); b.Property("Key") .IsRequired() - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") .IsRequired() - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("Id"); b.HasIndex("ApiResourceId"); - b.ToTable("ApiProperties"); + b.ToTable("ApiResourceProperties"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("ApiResourceId") + .HasColumnType("int"); + + b.Property("Scope") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("ApiResourceId"); + + b.ToTable("ApiResourceScopes"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("ApiResourceId") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); + + b.HasKey("Id"); + + b.HasIndex("ApiResourceId"); + + b.ToTable("ApiResourceSecrets"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ApiResourceId"); + .HasColumnType("int") + .UseIdentityColumn(); b.Property("Description") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); + + b.Property("Enabled") + .HasColumnType("bit"); b.Property("Name") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("Id"); - b.HasIndex("ApiResourceId"); - b.HasIndex("Name") .IsUnique(); @@ -133,151 +221,200 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ApiScopeId"); + b.Property("ScopeId") + .HasColumnType("int"); b.Property("Type") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); - b.HasIndex("ApiScopeId"); + b.HasIndex("ScopeId"); b.ToTable("ApiScopeClaims"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ApiResourceId"); - - b.Property("Created"); - - b.Property("Description") - .HasMaxLength(1000); - - b.Property("Expiration"); - - b.Property("Type") + b.Property("Key") .IsRequired() - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("ScopeId") + .HasColumnType("int"); b.Property("Value") .IsRequired() - .HasMaxLength(4000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("Id"); - b.HasIndex("ApiResourceId"); + b.HasIndex("ScopeId"); - b.ToTable("ApiSecrets"); + b.ToTable("ApiScopeProperties"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("AbsoluteRefreshTokenLifetime"); + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenLifetime"); + b.Property("AccessTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenType"); + b.Property("AccessTokenType") + .HasColumnType("int"); - b.Property("AllowAccessTokensViaBrowser"); + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("bit"); - b.Property("AllowOfflineAccess"); + b.Property("AllowOfflineAccess") + .HasColumnType("bit"); - b.Property("AllowPlainTextPkce"); + b.Property("AllowPlainTextPkce") + .HasColumnType("bit"); - b.Property("AllowRememberConsent"); + b.Property("AllowRememberConsent") + .HasColumnType("bit"); - b.Property("AlwaysIncludeUserClaimsInIdToken"); + b.Property("AllowedIdentityTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("AlwaysSendClientClaims"); + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("bit"); - b.Property("AuthorizationCodeLifetime"); + b.Property("AlwaysSendClientClaims") + .HasColumnType("bit"); - b.Property("BackChannelLogoutSessionRequired"); + b.Property("AuthorizationCodeLifetime") + .HasColumnType("int"); + + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("BackChannelLogoutUri") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.Property("ClientClaimsPrefix") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientId") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientName") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientUri") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); - b.Property("ConsentLifetime"); + b.Property("ConsentLifetime") + .HasColumnType("int"); - b.Property("Created"); + b.Property("Created") + .HasColumnType("datetime2"); b.Property("Description") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); - b.Property("DeviceCodeLifetime"); + b.Property("DeviceCodeLifetime") + .HasColumnType("int"); - b.Property("EnableLocalLogin"); + b.Property("EnableLocalLogin") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); - b.Property("FrontChannelLogoutSessionRequired"); + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("FrontChannelLogoutUri") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); - b.Property("IdentityTokenLifetime"); + b.Property("IdentityTokenLifetime") + .HasColumnType("int"); - b.Property("IncludeJwtId"); + b.Property("IncludeJwtId") + .HasColumnType("bit"); - b.Property("LastAccessed"); + b.Property("LastAccessed") + .HasColumnType("datetime2"); b.Property("LogoUri") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); - b.Property("NonEditable"); + b.Property("NonEditable") + .HasColumnType("bit"); b.Property("PairWiseSubjectSalt") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ProtocolType") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("RefreshTokenExpiration"); + b.Property("RefreshTokenExpiration") + .HasColumnType("int"); - b.Property("RefreshTokenUsage"); + b.Property("RefreshTokenUsage") + .HasColumnType("int"); - b.Property("RequireClientSecret"); + b.Property("RequireClientSecret") + .HasColumnType("bit"); - b.Property("RequireConsent"); + b.Property("RequireConsent") + .HasColumnType("bit"); - b.Property("RequirePkce"); + b.Property("RequirePkce") + .HasColumnType("bit"); - b.Property("SlidingRefreshTokenLifetime"); + b.Property("RequireRequestObject") + .HasColumnType("bit"); - b.Property("UpdateAccessTokenClaimsOnRefresh"); + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("Updated"); + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("bit"); + + b.Property("Updated") + .HasColumnType("datetime2"); b.Property("UserCodeType") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("UserSsoLifetime"); + b.Property("UserSsoLifetime") + .HasColumnType("int"); b.HasKey("Id"); @@ -291,17 +428,21 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("Type") .IsRequired() - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") .IsRequired() - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.HasKey("Id"); @@ -314,13 +455,16 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("Origin") .IsRequired() - .HasMaxLength(150); + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); b.HasKey("Id"); @@ -333,13 +477,16 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("GrantType") .IsRequired() - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.HasKey("Id"); @@ -352,13 +499,16 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("Provider") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); @@ -371,13 +521,16 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("PostLogoutRedirectUri") .IsRequired() - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("Id"); @@ -390,17 +543,21 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("Key") .IsRequired() - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") .IsRequired() - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("Id"); @@ -413,13 +570,16 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("RedirectUri") .IsRequired() - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); b.HasKey("Id"); @@ -432,13 +592,16 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); b.Property("Scope") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); @@ -451,24 +614,31 @@ namespace Identity.API.Migrations.ConfigurationDb { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("int"); - b.Property("Created"); + b.Property("Created") + .HasColumnType("datetime2"); b.Property("Description") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.Property("Type") .IsRequired() - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("Value") .IsRequired() - .HasMaxLength(4000); + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); b.HasKey("Id"); @@ -477,54 +647,46 @@ namespace Identity.API.Migrations.ConfigurationDb b.ToTable("ClientSecrets"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("IdentityResourceId"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(200); - - b.HasKey("Id"); - - b.HasIndex("IdentityResourceId"); - - b.ToTable("IdentityClaims"); - }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("Created"); + b.Property("Created") + .HasColumnType("datetime2"); b.Property("Description") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); b.Property("DisplayName") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("Name") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("NonEditable"); + b.Property("NonEditable") + .HasColumnType("bit"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); - b.Property("Updated"); + b.Property("Updated") + .HasColumnType("datetime2"); b.HasKey("Id"); @@ -534,27 +696,53 @@ namespace Identity.API.Migrations.ConfigurationDb b.ToTable("IdentityResources"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int") + .UseIdentityColumn(); - b.Property("IdentityResourceId"); + b.Property("IdentityResourceId") + .HasColumnType("int"); - b.Property("Key") + b.Property("Type") .IsRequired() - .HasMaxLength(250); - - b.Property("Value") - .IsRequired() - .HasMaxLength(2000); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); b.HasIndex("IdentityResourceId"); - b.ToTable("IdentityProperties"); + b.ToTable("IdentityResourceClaims"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("IdentityResourceId") + .HasColumnType("int"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.HasKey("Id"); + + b.HasIndex("IdentityResourceId"); + + b.ToTable("IdentityResourceProperties"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b => @@ -564,6 +752,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b => @@ -573,33 +763,52 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceScope", b => { b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource") .WithMany("Scopes") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b => - { - b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "ApiScope") - .WithMany("UserClaims") - .HasForeignKey("ApiScopeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b => { b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource") .WithMany("Secrets") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b => + { + b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "Scope") + .WithMany("UserClaims") + .HasForeignKey("ScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Scope"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b => + { + b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "Scope") + .WithMany("Properties") + .HasForeignKey("ScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Scope"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b => @@ -609,6 +818,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b => @@ -618,6 +829,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b => @@ -627,6 +840,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b => @@ -636,6 +851,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b => @@ -645,6 +862,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b => @@ -654,6 +873,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b => @@ -663,6 +884,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b => @@ -672,6 +895,8 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b => @@ -681,15 +906,19 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityClaim", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b => { b.HasOne("IdentityServer4.EntityFramework.Entities.IdentityResource", "IdentityResource") .WithMany("UserClaims") .HasForeignKey("IdentityResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("IdentityResource"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => @@ -699,6 +928,54 @@ namespace Identity.API.Migrations.ConfigurationDb .HasForeignKey("IdentityResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("IdentityResource"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b => + { + b.Navigation("Properties"); + + b.Navigation("Scopes"); + + b.Navigation("Secrets"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b => + { + b.Navigation("AllowedCorsOrigins"); + + b.Navigation("AllowedGrantTypes"); + + b.Navigation("AllowedScopes"); + + b.Navigation("Claims"); + + b.Navigation("ClientSecrets"); + + b.Navigation("IdentityProviderRestrictions"); + + b.Navigation("PostLogoutRedirectUris"); + + b.Navigation("Properties"); + + b.Navigation("RedirectUris"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); }); #pragma warning restore 612, 618 } diff --git a/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20190729092100_InitialPersistedGrantMigration.Designer.cs b/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20190729092100_InitialPersistedGrantMigration.Designer.cs deleted file mode 100644 index 0518894dc..000000000 --- a/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20190729092100_InitialPersistedGrantMigration.Designer.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -using System; -using IdentityServer4.EntityFramework.DbContexts; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace Identity.API.Migrations.PersistedGrantDb -{ - [DbContext(typeof(PersistedGrantDbContext))] - [Migration("20190729092100_InitialPersistedGrantMigration")] - partial class InitialPersistedGrantMigration - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview7.19362.6") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => - { - b.Property("UserCode") - .HasMaxLength(200); - - b.Property("ClientId") - .IsRequired() - .HasMaxLength(200); - - b.Property("CreationTime"); - - b.Property("Data") - .IsRequired() - .HasMaxLength(50000); - - b.Property("DeviceCode") - .IsRequired() - .HasMaxLength(200); - - b.Property("Expiration") - .IsRequired(); - - b.Property("SubjectId") - .HasMaxLength(200); - - b.HasKey("UserCode"); - - b.HasIndex("DeviceCode") - .IsUnique(); - - b.ToTable("DeviceCodes"); - }); - - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => - { - b.Property("Key") - .HasMaxLength(200); - - b.Property("ClientId") - .IsRequired() - .HasMaxLength(200); - - b.Property("CreationTime"); - - b.Property("Data") - .IsRequired() - .HasMaxLength(50000); - - b.Property("Expiration"); - - b.Property("SubjectId") - .HasMaxLength(200); - - b.Property("Type") - .IsRequired() - .HasMaxLength(50); - - b.HasKey("Key"); - - b.HasIndex("SubjectId", "ClientId", "Type"); - - b.ToTable("PersistedGrants"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20190729092100_InitialPersistedGrantMigration.cs b/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20190729092100_InitialPersistedGrantMigration.cs deleted file mode 100644 index ac19250a6..000000000 --- a/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20190729092100_InitialPersistedGrantMigration.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; -using System; - -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(maxLength: 200, nullable: false), - DeviceCode = table.Column(maxLength: 200, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - CreationTime = table.Column(nullable: false), - Expiration = table.Column(nullable: false), - Data = table.Column(maxLength: 50000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_DeviceCodes", x => x.UserCode); - }); - - migrationBuilder.CreateTable( - name: "PersistedGrants", - columns: table => new - { - Key = table.Column(maxLength: 200, nullable: false), - Type = table.Column(maxLength: 50, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - CreationTime = table.Column(nullable: false), - Expiration = table.Column(nullable: true), - Data = table.Column(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"); - } - } -} diff --git a/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20210301145424_InitialPersistedGrantMigration.Designer.cs b/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20210301145424_InitialPersistedGrantMigration.Designer.cs new file mode 100644 index 000000000..51389bdae --- /dev/null +++ b/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20210301145424_InitialPersistedGrantMigration.Designer.cs @@ -0,0 +1,129 @@ +// +using System; +using IdentityServer4.EntityFramework.DbContexts; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace Identity.API.Migrations.PersistedGrantDb +{ + [DbContext(typeof(PersistedGrantDbContext))] + [Migration("20210301145424_InitialPersistedGrantMigration")] + partial class InitialPersistedGrantMigration + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.2"); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => + { + b.Property("UserCode") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("Data") + .IsRequired() + .HasMaxLength(50000) + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("DeviceCode") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("SubjectId") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("UserCode"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.ToTable("DeviceCodes"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => + { + b.Property("Key") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ConsumedTime") + .HasColumnType("datetime2"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("Data") + .IsRequired() + .HasMaxLength(50000) + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("SubjectId") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Key"); + + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); + + b.HasIndex("SubjectId", "SessionId", "Type"); + + b.ToTable("PersistedGrants"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20210301145424_InitialPersistedGrantMigration.cs b/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20210301145424_InitialPersistedGrantMigration.cs new file mode 100644 index 000000000..59daae421 --- /dev/null +++ b/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/20210301145424_InitialPersistedGrantMigration.cs @@ -0,0 +1,85 @@ +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(type: "nvarchar(200)", maxLength: 200, nullable: false), + DeviceCode = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + SubjectId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + SessionId = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ClientId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Description = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + Expiration = table.Column(type: "datetime2", nullable: false), + Data = table.Column(type: "nvarchar(max)", maxLength: 50000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DeviceCodes", x => x.UserCode); + }); + + migrationBuilder.CreateTable( + name: "PersistedGrants", + columns: table => new + { + Key = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Type = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + SubjectId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + SessionId = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ClientId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Description = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + Expiration = table.Column(type: "datetime2", nullable: true), + ConsumedTime = table.Column(type: "datetime2", nullable: true), + Data = table.Column(type: "nvarchar(max)", 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_DeviceCodes_Expiration", + table: "DeviceCodes", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_Expiration", + table: "PersistedGrants", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_SubjectId_ClientId_Type", + table: "PersistedGrants", + columns: new[] { "SubjectId", "ClientId", "Type" }); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_SubjectId_SessionId_Type", + table: "PersistedGrants", + columns: new[] { "SubjectId", "SessionId", "Type" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "DeviceCodes"); + + migrationBuilder.DropTable( + name: "PersistedGrants"); + } + } +} diff --git a/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/PersistedGrantDbContextModelSnapshot.cs b/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/PersistedGrantDbContextModelSnapshot.cs index 3188904ef..e79423df8 100644 --- a/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/PersistedGrantDbContextModelSnapshot.cs +++ b/src/Services/Identity/Identity.API/Migrations/PersistedGrantDb/PersistedGrantDbContextModelSnapshot.cs @@ -15,71 +15,110 @@ namespace Identity.API.Migrations.PersistedGrantDb { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview7.19362.6") + .UseIdentityColumns() .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "5.0.2"); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property("UserCode") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientId") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") .IsRequired() - .HasMaxLength(50000); + .HasMaxLength(50000) + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("DeviceCode") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Expiration") - .IsRequired(); + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("SubjectId") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("UserCode"); b.HasIndex("DeviceCode") .IsUnique(); + b.HasIndex("Expiration"); + b.ToTable("DeviceCodes"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => { b.Property("Key") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("ClientId") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); - b.Property("CreationTime"); + b.Property("ConsumedTime") + .HasColumnType("datetime2"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") .IsRequired() - .HasMaxLength(50000); + .HasMaxLength(50000) + .HasColumnType("nvarchar(max)"); - b.Property("Expiration"); + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("SubjectId") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("Type") .IsRequired() - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); b.HasKey("Key"); + b.HasIndex("Expiration"); + b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "SessionId", "Type"); + b.ToTable("PersistedGrants"); }); #pragma warning restore 612, 618 diff --git a/src/Services/Identity/Identity.API/Models/AccountViewModels/ConsentViewModel.cs b/src/Services/Identity/Identity.API/Models/AccountViewModels/ConsentViewModel.cs deleted file mode 100644 index 07dbd05c3..000000000 --- a/src/Services/Identity/Identity.API/Models/AccountViewModels/ConsentViewModel.cs +++ /dev/null @@ -1,63 +0,0 @@ -using IdentityServer4.Models; -using System.Collections.Generic; -using System.Linq; - -namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels -{ - public record ConsentViewModel : ConsentInputModel - { - public ConsentViewModel(ConsentInputModel model, string returnUrl, AuthorizationRequest request, Client client, Resources resources) - { - RememberConsent = model?.RememberConsent ?? true; - ScopesConsented = model?.ScopesConsented ?? Enumerable.Empty(); - - ReturnUrl = returnUrl; - - ClientName = client.ClientName; - ClientUrl = client.ClientUri; - ClientLogoUrl = client.LogoUri; - AllowRememberConsent = client.AllowRememberConsent; - - IdentityScopes = resources.IdentityResources.Select(x => new ScopeViewModel(x, ScopesConsented.Contains(x.Name) || model == null)).ToArray(); - ResourceScopes = resources.ApiResources.SelectMany(x => x.Scopes).Select(x => new ScopeViewModel(x, ScopesConsented.Contains(x.Name) || model == null)).ToArray(); - } - - public string ClientName { get; init; } - public string ClientUrl { get; init; } - public string ClientLogoUrl { get; init; } - public bool AllowRememberConsent { get; init; } - - public IEnumerable IdentityScopes { get; init; } - public IEnumerable ResourceScopes { get; init; } - } - - public record ScopeViewModel - { - public ScopeViewModel(Scope scope, bool check) - { - Name = scope.Name; - DisplayName = scope.DisplayName; - Description = scope.Description; - Emphasize = scope.Emphasize; - Required = scope.Required; - Checked = check || scope.Required; - } - - public ScopeViewModel(IdentityResource identity, bool check) - { - Name = identity.Name; - DisplayName = identity.DisplayName; - Description = identity.Description; - Emphasize = identity.Emphasize; - Required = identity.Required; - Checked = check || identity.Required; - } - - public string Name { get; init; } - public string DisplayName { get; init; } - public string Description { get; init; } - public bool Emphasize { get; init; } - public bool Required { get; init; } - public bool Checked { get; init; } - } -} diff --git a/src/Services/Identity/Identity.API/Models/AccountViewModels/RedirectViewModel.cs b/src/Services/Identity/Identity.API/Models/AccountViewModels/RedirectViewModel.cs new file mode 100644 index 000000000..b0bb87464 --- /dev/null +++ b/src/Services/Identity/Identity.API/Models/AccountViewModels/RedirectViewModel.cs @@ -0,0 +1,7 @@ +namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels +{ + public class RedirectViewModel + { + public string RedirectUrl { get; set; } + } +} \ No newline at end of file diff --git a/src/Services/Identity/Identity.API/Models/ConsentViewModels/ConsentInputModel.cs b/src/Services/Identity/Identity.API/Models/ConsentViewModels/ConsentInputModel.cs new file mode 100644 index 000000000..38592c36f --- /dev/null +++ b/src/Services/Identity/Identity.API/Models/ConsentViewModels/ConsentInputModel.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ConsentViewModels +{ + public class ConsentInputModel + { + public string Button { get; set; } + public IEnumerable ScopesConsented { get; set; } + public bool RememberConsent { get; set; } + public string ReturnUrl { get; set; } + public string Description { get; set; } + } +} \ No newline at end of file diff --git a/src/Services/Identity/Identity.API/Models/ConsentViewModels/ConsentOptions.cs b/src/Services/Identity/Identity.API/Models/ConsentViewModels/ConsentOptions.cs new file mode 100644 index 000000000..d943f8ad6 --- /dev/null +++ b/src/Services/Identity/Identity.API/Models/ConsentViewModels/ConsentOptions.cs @@ -0,0 +1,12 @@ +namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ConsentViewModels +{ + public class ConsentOptions + { + public static bool EnableOfflineAccess = true; + public static string OfflineAccessDisplayName = "Offline Access"; + public static string OfflineAccessDescription = "Access to your applications and resources, even when you are offline"; + + public static readonly string MustChooseOneErrorMessage = "You must pick at least one permission"; + public static readonly string InvalidSelectionErrorMessage = "Invalid selection"; + } +} diff --git a/src/Services/Identity/Identity.API/Models/ConsentViewModels/ConsentViewModel.cs b/src/Services/Identity/Identity.API/Models/ConsentViewModels/ConsentViewModel.cs new file mode 100644 index 000000000..7bcc492bc --- /dev/null +++ b/src/Services/Identity/Identity.API/Models/ConsentViewModels/ConsentViewModel.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ConsentViewModels +{ + public class ConsentViewModel : ConsentInputModel + { + public string ClientName { get; set; } + public string ClientUrl { get; set; } + public string ClientLogoUrl { get; set; } + public bool AllowRememberConsent { get; set; } + + public IEnumerable IdentityScopes { get; set; } + public IEnumerable ApiScopes { get; set; } + } +} diff --git a/src/Services/Identity/Identity.API/Models/ConsentViewModels/ProcessConsentResult.cs b/src/Services/Identity/Identity.API/Models/ConsentViewModels/ProcessConsentResult.cs new file mode 100644 index 000000000..54862c005 --- /dev/null +++ b/src/Services/Identity/Identity.API/Models/ConsentViewModels/ProcessConsentResult.cs @@ -0,0 +1,17 @@ +using IdentityServer4.Models; + +namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ConsentViewModels +{ + public class ProcessConsentResult + { + public bool IsRedirect => RedirectUri != null; + public string RedirectUri { get; set; } + public Client Client { get; set; } + + public bool ShowView => ViewModel != null; + public ConsentViewModel ViewModel { get; set; } + + public bool HasValidationError => ValidationError != null; + public string ValidationError { get; set; } + } +} diff --git a/src/Services/Identity/Identity.API/Models/ConsentViewModels/ScopeViewModel.cs b/src/Services/Identity/Identity.API/Models/ConsentViewModels/ScopeViewModel.cs new file mode 100644 index 000000000..d64190e6b --- /dev/null +++ b/src/Services/Identity/Identity.API/Models/ConsentViewModels/ScopeViewModel.cs @@ -0,0 +1,12 @@ +namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ConsentViewModels +{ + public class ScopeViewModel + { + public string Value { get; set; } + public string DisplayName { get; set; } + public string Description { get; set; } + public bool Emphasize { get; set; } + public bool Required { get; set; } + public bool Checked { get; set; } + } +} diff --git a/src/Services/Identity/Identity.API/Startup.cs b/src/Services/Identity/Identity.API/Startup.cs index a161729db..4e888fbb5 100644 --- a/src/Services/Identity/Identity.API/Startup.cs +++ b/src/Services/Identity/Identity.API/Startup.cs @@ -147,6 +147,9 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API app.Use(async (context, next) => { context.Response.Headers.Add("Content-Security-Policy", "script-src 'unsafe-inline'"); + context.Response.Headers.Add("Access-Control-Allow-Origin", "*"); + context.Response.Headers.Add("Access-Control-Allow-Headers", "*"); + context.Response.Headers.Add("Access-Control-Allow-Methods", "GET, POST, PUT, OPTIONS"); await next(); }); diff --git a/src/Services/Identity/Identity.API/Views/Consent/Index.cshtml b/src/Services/Identity/Identity.API/Views/Consent/Index.cshtml index 08c316553..556b7b82c 100644 --- a/src/Services/Identity/Identity.API/Views/Consent/Index.cshtml +++ b/src/Services/Identity/Identity.API/Views/Consent/Index.cshtml @@ -1,82 +1,104 @@ -@model Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels.ConsentViewModel +@model Microsoft.eShopOnContainers.Services.Identity.API.Models.ConsentViewModels.ConsentViewModel -