diff --git a/eng/Versions.props b/eng/Versions.props index c7ef3f67ba2323976e47e927b02034734c6387af..c17bc4c3149691f74e970f74a1f18a33352fb062 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ <AspNetCoreMajorVersion>3</AspNetCoreMajorVersion> <AspNetCoreMinorVersion>0</AspNetCoreMinorVersion> <AspNetCorePatchVersion>0</AspNetCorePatchVersion> - <PreReleasePreviewNumber>1</PreReleasePreviewNumber> + <PreReleasePreviewNumber>2</PreReleasePreviewNumber> <PreReleaseVersionLabel>rc$(PreReleasePreviewNumber)</PreReleaseVersionLabel> <PreReleaseBrandingLabel>Release Candidate $(PreReleasePreviewNumber)</PreReleaseBrandingLabel> <!-- Blazor Client packages will not RTM with 3.0 --> @@ -226,11 +226,11 @@ <FSharpCorePackageVersion>4.2.1</FSharpCorePackageVersion> <GoogleProtobufPackageVersion>3.8.0</GoogleProtobufPackageVersion> <GrpcAspNetCorePackageVersion>0.2.23-pre1</GrpcAspNetCorePackageVersion> - <IdentityServer4AspNetIdentityPackageVersion>3.0.0-preview7.33</IdentityServer4AspNetIdentityPackageVersion> - <IdentityServer4EntityFrameworkPackageVersion>3.0.0-preview7.33</IdentityServer4EntityFrameworkPackageVersion> - <IdentityServer4PackageVersion>3.0.0-preview7.33</IdentityServer4PackageVersion> - <IdentityServer4StoragePackageVersion>3.0.0-preview7.33</IdentityServer4StoragePackageVersion> - <IdentityServer4EntityFrameworkStoragePackageVersion>3.0.0-preview7.33</IdentityServer4EntityFrameworkStoragePackageVersion> + <IdentityServer4AspNetIdentityPackageVersion>3.0.0</IdentityServer4AspNetIdentityPackageVersion> + <IdentityServer4EntityFrameworkPackageVersion>3.0.0</IdentityServer4EntityFrameworkPackageVersion> + <IdentityServer4PackageVersion>3.0.0</IdentityServer4PackageVersion> + <IdentityServer4StoragePackageVersion>3.0.0</IdentityServer4StoragePackageVersion> + <IdentityServer4EntityFrameworkStoragePackageVersion>3.0.0</IdentityServer4EntityFrameworkStoragePackageVersion> <MessagePackPackageVersion>1.7.3.7</MessagePackPackageVersion> <MoqPackageVersion>4.10.0</MoqPackageVersion> <MonoCecilPackageVersion>0.10.1</MonoCecilPackageVersion> diff --git a/src/Components/test/E2ETest/ServerExecutionTests/GlobalizationTest.cs b/src/Components/test/E2ETest/ServerExecutionTests/GlobalizationTest.cs index ae4c699153fc5b9d397526a4cf31e25ec131fa06..af0ef6980e50d8906aa3a854f19963e8a0ca0ec7 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/GlobalizationTest.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/GlobalizationTest.cs @@ -41,16 +41,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests public void CanSetCultureAndParseCultueSensitiveNumbersAndDates(string culture) { var cultureInfo = CultureInfo.GetCultureInfo(culture); - - var selector = new SelectElement(Browser.FindElement(By.Id("culture-selector"))); - selector.SelectByValue(culture); - - // That should have triggered a redirect, wait for the main test selector to come up. - MountTestComponent<GlobalizationBindCases>(); - WaitUntilExists(By.Id("globalization-cases")); - - var cultureDisplay = WaitUntilExists(By.Id("culture-name-display")); - Assert.Equal($"Culture is: {culture}", cultureDisplay.Text); + SetCulture(culture); // int var input = Browser.FindElement(By.Id("input_type_text_int")); @@ -113,16 +104,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests public void CanSetCultureAndParseCultureInvariantNumbersAndDatesWithInputFields(string culture) { var cultureInfo = CultureInfo.GetCultureInfo(culture); - - var selector = new SelectElement(Browser.FindElement(By.Id("culture-selector"))); - selector.SelectByValue(culture); - - // That should have triggered a redirect, wait for the main test selector to come up. - MountTestComponent<GlobalizationBindCases>(); - WaitUntilExists(By.Id("globalization-cases")); - - var cultureDisplay = WaitUntilExists(By.Id("culture-name-display")); - Assert.Equal($"Culture is: {culture}", cultureDisplay.Text); + SetCulture(culture); // int var input = Browser.FindElement(By.Id("input_type_number_int")); @@ -179,16 +161,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests public void CanSetCultureAndParseCultureInvariantNumbersAndDatesWithFormComponents(string culture) { var cultureInfo = CultureInfo.GetCultureInfo(culture); - - var selector = new SelectElement(Browser.FindElement(By.Id("culture-selector"))); - selector.SelectByValue(culture); - - // That should have triggered a redirect, wait for the main test selector to come up. - MountTestComponent<GlobalizationBindCases>(); - WaitUntilExists(By.Id("globalization-cases")); - - var cultureDisplay = WaitUntilExists(By.Id("culture-name-display")); - Assert.Equal($"Culture is: {culture}", cultureDisplay.Text); + SetCulture(culture); // int var input = Browser.FindElement(By.Id("inputnumber_int")); @@ -247,5 +220,21 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests element.SendKeys(Keys.Control + "a"); element.SendKeys(text); } + + private void SetCulture(string culture) + { + var selector = new SelectElement(Browser.FindElement(By.Id("culture-selector"))); + selector.SelectByValue(culture); + + // Click the link to return back to the test page + WaitUntilExists(By.ClassName("return-from-culture-setter")).Click(); + + // That should have triggered a page load, so wait for the main test selector to come up. + MountTestComponent<GlobalizationBindCases>(); + WaitUntilExists(By.Id("globalization-cases")); + + var cultureDisplay = WaitUntilExists(By.Id("culture-name-display")); + Assert.Equal($"Culture is: {culture}", cultureDisplay.Text); + } } } diff --git a/src/Components/test/E2ETest/ServerExecutionTests/LocalizationTest.cs b/src/Components/test/E2ETest/ServerExecutionTests/LocalizationTest.cs index 94faed00bcd81867e27476159d282be7c0ecd22a..3faa49879d64be701d9b8394da15f3278e73f51f 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/LocalizationTest.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/LocalizationTest.cs @@ -40,7 +40,10 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests var selector = new SelectElement(Browser.FindElement(By.Id("culture-selector"))); selector.SelectByValue(culture); - // That should have triggered a redirect, wait for the main test selector to come up. + // Click the link to return back to the test page + WaitUntilExists(By.ClassName("return-from-culture-setter")).Click(); + + // That should have triggered a page load, so wait for the main test selector to come up. MountTestComponent<LocalizedText>(); var cultureDisplay = WaitUntilExists(By.Id("culture-name-display")); diff --git a/src/Components/test/testassets/BasicTestApp/CulturePicker.razor b/src/Components/test/testassets/BasicTestApp/CulturePicker.razor index 6e20528c69c1a42e130db8919674dca7df0c8b47..7a367ba766274f4b40b27f0032e782c19b4f8bec 100644 --- a/src/Components/test/testassets/BasicTestApp/CulturePicker.razor +++ b/src/Components/test/testassets/BasicTestApp/CulturePicker.razor @@ -12,7 +12,7 @@ { // Included fragment to preserve choice of Blazor client or server. var redirect = new Uri(NavigationManager.Uri).GetComponents(UriComponents.PathAndQuery | UriComponents.Fragment, UriFormat.UriEscaped); - var query = $"?culture={Uri.EscapeDataString((string)e.Value)}&redirectUri={redirect}"; + var query = $"?culture={Uri.EscapeDataString((string)e.Value)}&redirectUri={Uri.EscapeDataString(redirect)}"; NavigationManager.NavigateTo("/Culture/SetCulture" + query, forceLoad: true); } } diff --git a/src/Components/test/testassets/TestServer/Controllers/CultureController.cs b/src/Components/test/testassets/TestServer/Controllers/CultureController.cs index f3cbaf8286e5c1c778c44de02ca01a3895617125..4466bb59c35290ed6f451ab6f5711b7eb166138c 100644 --- a/src/Components/test/testassets/TestServer/Controllers/CultureController.cs +++ b/src/Components/test/testassets/TestServer/Controllers/CultureController.cs @@ -1,5 +1,8 @@ +using System.Text.Encodings.Web; using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.WebUtilities; +using Microsoft.Net.Http.Headers; namespace Components.TestServer.Controllers { @@ -15,7 +18,10 @@ namespace Components.TestServer.Controllers CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture))); } - return LocalRedirect(redirectUri); + var htmlEncoder = HtmlEncoder.Default; + var html = $"<h1>Culture has been changed to {htmlEncoder.Encode(culture)}</h1>" + + $"<a class='return-from-culture-setter' href='{htmlEncoder.Encode(redirectUri)}'>Return to previous page</a>"; + return Content(html, "text/html"); } } } diff --git a/src/DataProtection/DataProtection.sln b/src/DataProtection/DataProtection.sln index 834c97a4fe7c5b4df7318f65cf19bda7a1e8ff7e..6726d0ab6d77fa26c5e6d23c99d8c6a0c31a80e0 100644 --- a/src/DataProtection/DataProtection.sln +++ b/src/DataProtection/DataProtection.sln @@ -5,71 +5,73 @@ VisualStudioVersion = 16.0.0.0 MinimumVisualStudioVersion = 16.0.0.0 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Abstractions", "Abstractions", "{ABD364B3-09A1-4CFE-8D26-FF6417DDEC84}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection.Abstractions", "Abstractions\src\Microsoft.AspNetCore.DataProtection.Abstractions.csproj", "{18BE6FD1-1EB1-44AD-A3AE-398C990060F5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.Abstractions", "Abstractions\src\Microsoft.AspNetCore.DataProtection.Abstractions.csproj", "{18BE6FD1-1EB1-44AD-A3AE-398C990060F5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection.Abstractions.Tests", "Abstractions\test\Microsoft.AspNetCore.DataProtection.Abstractions.Tests.csproj", "{CEDC6CD0-0276-4C45-9B57-C222516840B9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.Abstractions.Tests", "Abstractions\test\Microsoft.AspNetCore.DataProtection.Abstractions.Tests.csproj", "{CEDC6CD0-0276-4C45-9B57-C222516840B9}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AzureKeyVault", "AzureKeyVault", "{695602EE-F2FD-4B9B-AF84-9208AE552B9E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection.AzureKeyVault", "AzureKeyVault\src\Microsoft.AspNetCore.DataProtection.AzureKeyVault.csproj", "{DDA72406-95B8-4A67-A994-F1E5F2506126}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.AzureKeyVault", "AzureKeyVault\src\Microsoft.AspNetCore.DataProtection.AzureKeyVault.csproj", "{DDA72406-95B8-4A67-A994-F1E5F2506126}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection.AzureKeyVault.Tests", "AzureKeyVault\test\Microsoft.AspNetCore.DataProtection.AzureKeyVault.Tests.csproj", "{0C2EE847-D78B-46FD-AB73-EAB8200C9138}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.AzureKeyVault.Tests", "AzureKeyVault\test\Microsoft.AspNetCore.DataProtection.AzureKeyVault.Tests.csproj", "{0C2EE847-D78B-46FD-AB73-EAB8200C9138}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AzureStorage", "AzureStorage", "{5CD76E65-363F-4CD5-B01D-2DF5DC16CB64}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection.AzureStorage", "AzureStorage\src\Microsoft.AspNetCore.DataProtection.AzureStorage.csproj", "{22860B07-A42B-4757-9208-7D6BDB2B48F3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.AzureStorage", "AzureStorage\src\Microsoft.AspNetCore.DataProtection.AzureStorage.csproj", "{22860B07-A42B-4757-9208-7D6BDB2B48F3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection.AzureStorage.Tests", "AzureStorage\test\Microsoft.AspNetCore.DataProtection.AzureStorage.Tests.csproj", "{C36DAB08-F641-4C5A-86C0-3CC39FC779D9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.AzureStorage.Tests", "AzureStorage\test\Microsoft.AspNetCore.DataProtection.AzureStorage.Tests.csproj", "{C36DAB08-F641-4C5A-86C0-3CC39FC779D9}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cryptography.Internal", "Cryptography.Internal", "{A5DE8834-6C9B-47A6-9CDC-AAB83C776F19}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Cryptography.Internal", "Cryptography.Internal\src\Microsoft.AspNetCore.Cryptography.Internal.csproj", "{93B3396D-0234-4D4E-A85B-4A391E0C6FE0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Cryptography.Internal", "Cryptography.Internal\src\Microsoft.AspNetCore.Cryptography.Internal.csproj", "{93B3396D-0234-4D4E-A85B-4A391E0C6FE0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Cryptography.Internal.Tests", "Cryptography.Internal\test\Microsoft.AspNetCore.Cryptography.Internal.Tests.csproj", "{14FD172E-4134-4712-AE77-524208FFEA1C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Cryptography.Internal.Tests", "Cryptography.Internal\test\Microsoft.AspNetCore.Cryptography.Internal.Tests.csproj", "{14FD172E-4134-4712-AE77-524208FFEA1C}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cryptography.KeyDerivation", "Cryptography.KeyDerivation", "{EFADD18C-A0D7-4F51-AEAB-9E3346A208BF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Cryptography.KeyDerivation", "Cryptography.KeyDerivation\src\Microsoft.AspNetCore.Cryptography.KeyDerivation.csproj", "{A82BAE81-24E3-48DF-96BA-C8A6FEDD274A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Cryptography.KeyDerivation", "Cryptography.KeyDerivation\src\Microsoft.AspNetCore.Cryptography.KeyDerivation.csproj", "{A82BAE81-24E3-48DF-96BA-C8A6FEDD274A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Cryptography.KeyDerivation.Tests", "Cryptography.KeyDerivation\test\Microsoft.AspNetCore.Cryptography.KeyDerivation.Tests.csproj", "{3121B1B2-92C8-4049-94E7-CB0A8D83A7E6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Cryptography.KeyDerivation.Tests", "Cryptography.KeyDerivation\test\Microsoft.AspNetCore.Cryptography.KeyDerivation.Tests.csproj", "{3121B1B2-92C8-4049-94E7-CB0A8D83A7E6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DataProtection", "DataProtection", "{78481E7D-CD56-4700-A2FD-C8EAE9F0B51B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection", "DataProtection\src\Microsoft.AspNetCore.DataProtection.csproj", "{B590E838-37CE-4651-835B-7F83A6C987CE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection", "DataProtection\src\Microsoft.AspNetCore.DataProtection.csproj", "{B590E838-37CE-4651-835B-7F83A6C987CE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection.Tests", "DataProtection\test\Microsoft.AspNetCore.DataProtection.Tests.csproj", "{4C48D2E2-789D-4ECF-8FB7-ADC46BC7A463}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.Tests", "DataProtection\test\Microsoft.AspNetCore.DataProtection.Tests.csproj", "{4C48D2E2-789D-4ECF-8FB7-ADC46BC7A463}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{361B9ACA-DCA4-4C1B-A071-906348E849C0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection.Extensions", "Extensions\src\Microsoft.AspNetCore.DataProtection.Extensions.csproj", "{7A64B793-719C-4EEE-A8FA-87AAABCC29AC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.Extensions", "Extensions\src\Microsoft.AspNetCore.DataProtection.Extensions.csproj", "{7A64B793-719C-4EEE-A8FA-87AAABCC29AC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection.Extensions.Tests", "Extensions\test\Microsoft.AspNetCore.DataProtection.Extensions.Tests.csproj", "{DC6D371D-200A-40D9-B4BE-C9202C27A863}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.Extensions.Tests", "Extensions\test\Microsoft.AspNetCore.DataProtection.Extensions.Tests.csproj", "{DC6D371D-200A-40D9-B4BE-C9202C27A863}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StackExchangeRedis", "StackExchangeRedis", "{1A2E71DA-8DFE-4DDA-B713-14B5F2B8EBAE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection.StackExchangeRedis", "StackExchangeRedis\src\Microsoft.AspNetCore.DataProtection.StackExchangeRedis.csproj", "{0FEAE8C5-4EAF-4E87-9A07-69FCE19B31D7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.StackExchangeRedis", "StackExchangeRedis\src\Microsoft.AspNetCore.DataProtection.StackExchangeRedis.csproj", "{0FEAE8C5-4EAF-4E87-9A07-69FCE19B31D7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Tests", "StackExchangeRedis\test\Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Tests.csproj", "{8A71D3B4-D617-4960-8616-A196FBF351FE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Tests", "StackExchangeRedis\test\Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Tests.csproj", "{8A71D3B4-D617-4960-8616-A196FBF351FE}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{9DF098B3-C8ED-471C-AE03-52E3196C1811}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureBlob", "samples\AzureBlob\AzureBlob.csproj", "{BB197CC9-04B8-4BC7-BB2E-703798B82FD4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureBlob", "samples\AzureBlob\AzureBlob.csproj", "{BB197CC9-04B8-4BC7-BB2E-703798B82FD4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureKeyVault", "samples\AzureKeyVault\AzureKeyVault.csproj", "{D8E4ED57-3D14-4453-A2FE-D36C97AE4273}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureKeyVault", "samples\AzureKeyVault\AzureKeyVault.csproj", "{D8E4ED57-3D14-4453-A2FE-D36C97AE4273}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomEncryptorSample", "samples\CustomEncryptorSample\CustomEncryptorSample.csproj", "{9824655A-4BBF-418E-A7D9-3DA52D98D16D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CustomEncryptorSample", "samples\CustomEncryptorSample\CustomEncryptorSample.csproj", "{9824655A-4BBF-418E-A7D9-3DA52D98D16D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeyManagementSample", "samples\KeyManagementSample\KeyManagementSample.csproj", "{03406538-75CB-4655-B210-643FE11A2B00}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KeyManagementSample", "samples\KeyManagementSample\KeyManagementSample.csproj", "{03406538-75CB-4655-B210-643FE11A2B00}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NonDISample", "samples\NonDISample\NonDISample.csproj", "{C5C425C8-5626-409B-9A81-4DC496CE41F4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NonDISample", "samples\NonDISample\NonDISample.csproj", "{C5C425C8-5626-409B-9A81-4DC496CE41F4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Redis", "samples\Redis\Redis.csproj", "{E578D5C2-76AD-4A9B-A4F0-3A74D7ACD98E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Redis", "samples\Redis\Redis.csproj", "{E578D5C2-76AD-4A9B-A4F0-3A74D7ACD98E}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EntityFrameworkCore", "EntityFrameworkCore", "{64FD02D7-B6F4-4C77-A3F8-E6BD6404168E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection.EntityFrameworkCore", "EntityFrameworkCore\src\Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.csproj", "{8A7D0D2D-A5F1-4DF7-BBAA-9A0EFDBB5224}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.EntityFrameworkCore", "EntityFrameworkCore\src\Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.csproj", "{8A7D0D2D-A5F1-4DF7-BBAA-9A0EFDBB5224}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test", "EntityFrameworkCore\test\Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test.csproj", "{74CE0E8B-DE23-4B53-8D02-69D6FB849ADC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test", "EntityFrameworkCore\test\Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test.csproj", "{74CE0E8B-DE23-4B53-8D02-69D6FB849ADC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCoreSample", "samples\EntityFrameworkCoreSample\EntityFrameworkCoreSample.csproj", "{DA4C8B07-05F5-4C59-A578-7438E9BFF79F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -80,9 +82,6 @@ Global Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {18BE6FD1-1EB1-44AD-A3AE-398C990060F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {18BE6FD1-1EB1-44AD-A3AE-398C990060F5}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -372,6 +371,21 @@ Global {74CE0E8B-DE23-4B53-8D02-69D6FB849ADC}.Release|x64.Build.0 = Release|Any CPU {74CE0E8B-DE23-4B53-8D02-69D6FB849ADC}.Release|x86.ActiveCfg = Release|Any CPU {74CE0E8B-DE23-4B53-8D02-69D6FB849ADC}.Release|x86.Build.0 = Release|Any CPU + {DA4C8B07-05F5-4C59-A578-7438E9BFF79F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DA4C8B07-05F5-4C59-A578-7438E9BFF79F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DA4C8B07-05F5-4C59-A578-7438E9BFF79F}.Debug|x64.ActiveCfg = Debug|Any CPU + {DA4C8B07-05F5-4C59-A578-7438E9BFF79F}.Debug|x64.Build.0 = Debug|Any CPU + {DA4C8B07-05F5-4C59-A578-7438E9BFF79F}.Debug|x86.ActiveCfg = Debug|Any CPU + {DA4C8B07-05F5-4C59-A578-7438E9BFF79F}.Debug|x86.Build.0 = Debug|Any CPU + {DA4C8B07-05F5-4C59-A578-7438E9BFF79F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DA4C8B07-05F5-4C59-A578-7438E9BFF79F}.Release|Any CPU.Build.0 = Release|Any CPU + {DA4C8B07-05F5-4C59-A578-7438E9BFF79F}.Release|x64.ActiveCfg = Release|Any CPU + {DA4C8B07-05F5-4C59-A578-7438E9BFF79F}.Release|x64.Build.0 = Release|Any CPU + {DA4C8B07-05F5-4C59-A578-7438E9BFF79F}.Release|x86.ActiveCfg = Release|Any CPU + {DA4C8B07-05F5-4C59-A578-7438E9BFF79F}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {18BE6FD1-1EB1-44AD-A3AE-398C990060F5} = {ABD364B3-09A1-4CFE-8D26-FF6417DDEC84} @@ -398,5 +412,9 @@ Global {E578D5C2-76AD-4A9B-A4F0-3A74D7ACD98E} = {9DF098B3-C8ED-471C-AE03-52E3196C1811} {8A7D0D2D-A5F1-4DF7-BBAA-9A0EFDBB5224} = {64FD02D7-B6F4-4C77-A3F8-E6BD6404168E} {74CE0E8B-DE23-4B53-8D02-69D6FB849ADC} = {64FD02D7-B6F4-4C77-A3F8-E6BD6404168E} + {DA4C8B07-05F5-4C59-A578-7438E9BFF79F} = {9DF098B3-C8ED-471C-AE03-52E3196C1811} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EA6767C5-D46B-4DE7-AB1A-E5244F122C64} EndGlobalSection EndGlobal diff --git a/src/DataProtection/EntityFrameworkCore/src/EntityFrameworkCoreXmlRepository.cs b/src/DataProtection/EntityFrameworkCore/src/EntityFrameworkCoreXmlRepository.cs index 62250cf3efb7205d67e433d68873af6caead7ac7..3af024996ac83200478bc51a3065afff16e6a702 100644 --- a/src/DataProtection/EntityFrameworkCore/src/EntityFrameworkCoreXmlRepository.cs +++ b/src/DataProtection/EntityFrameworkCore/src/EntityFrameworkCoreXmlRepository.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -43,7 +43,10 @@ namespace Microsoft.AspNetCore.DataProtection.EntityFrameworkCore using (var scope = _services.CreateScope()) { var context = scope.ServiceProvider.GetRequiredService<TContext>(); - return context.DataProtectionKeys.AsNoTracking().Select(key => TryParseKeyXml(key.Xml)).ToList().AsReadOnly(); + + // Put logger in a local such that `this` isn't captured. + var logger = _logger; + return context.DataProtectionKeys.AsNoTracking().Select(key => TryParseKeyXml(key.Xml, logger)).ToList().AsReadOnly(); } } @@ -65,7 +68,7 @@ namespace Microsoft.AspNetCore.DataProtection.EntityFrameworkCore } } - private XElement TryParseKeyXml(string xml) + private static XElement TryParseKeyXml(string xml, ILogger logger) { try { @@ -73,7 +76,7 @@ namespace Microsoft.AspNetCore.DataProtection.EntityFrameworkCore } catch (Exception e) { - _logger?.LogExceptionWhileParsingKeyXml(xml, e); + logger?.LogExceptionWhileParsingKeyXml(xml, e); return null; } } diff --git a/src/DataProtection/samples/EntityFrameworkCoreSample/Program.cs b/src/DataProtection/samples/EntityFrameworkCoreSample/Program.cs index d4e978a7b850cffea2276e3c84c695ca4226d780..896fcf2b52a041445314b078b84f235f17754d8a 100644 --- a/src/DataProtection/samples/EntityFrameworkCoreSample/Program.cs +++ b/src/DataProtection/samples/EntityFrameworkCoreSample/Program.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -20,6 +20,8 @@ namespace EntityFrameworkCoreSample .AddDbContext<DataProtectionKeyContext>(o => { o.UseInMemoryDatabase("DataProtection_EntityFrameworkCore"); + // Make sure to create a sql server called DataProtectionApp + //o.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=DataProtectionApp;Trusted_Connection=True;Connect Timeout=5;ConnectRetryCount=0"); o.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); o.EnableSensitiveDataLogging(); }) @@ -29,7 +31,7 @@ namespace EntityFrameworkCoreSample .Services .BuildServiceProvider(validateScopes: true); - using(services) + using (services) { // Run a sample payload var protector = services.GetDataProtector("sample-purpose"); diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/IdentityServerBuilderConfigurationExtensions.cs b/src/Identity/ApiAuthorization.IdentityServer/src/IdentityServerBuilderConfigurationExtensions.cs index 363356873084273561242a5c8b4f2b64c1319719..b6e2fac1c8bc251ca1895400c4938252825a17d0 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/IdentityServerBuilderConfigurationExtensions.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/IdentityServerBuilderConfigurationExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -236,7 +236,14 @@ namespace Microsoft.Extensions.DependencyInjection builder.Services.AddSingleton<IValidationKeysStore>(sp => { var options = sp.GetRequiredService<IOptions<ApiAuthorizationOptions>>(); - return new DefaultValidationKeysStore(new[] { options.Value.SigningCredential.Key }); + return new DefaultValidationKeysStore(new[] + { + new SecurityKeyInfo + { + Key = options.Value.SigningCredential.Key, + SigningAlgorithm = options.Value.SigningCredential.Algorithm + } + }); }); return builder; diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package-lock.json b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package-lock.json index 1318c47924151ab3eeade9014693ac23dfc77425..ac403abd0fb7d1a192b93ca4cccd95061ffd97e9 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package-lock.json +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package-lock.json @@ -7157,9 +7157,9 @@ "dev": true }, "oidc-client": { - "version": "1.9.0-beta.4", - "resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.9.0-beta.4.tgz", - "integrity": "sha512-BE6o220w9kDTicmsX324Z5t3Gg20G9NgQjCOFP6SUY7glJYBohyw9DVPt/khPmmg+wabufJq1tH2zyEadMf7Pw==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.9.0.tgz", + "integrity": "sha512-fJradf/BsRYh96YzWPlm38DRQJRg1wm1nZU21OX8P9NBNxBXRems9BmvOIoh8sO8Y7gmMemESOn4A2TgId+36g==", "requires": { "base64-js": "^1.3.0", "core-js": "^2.6.4", diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package.json b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package.json index c30b740221dfaf9533df577291509e71856ef9f3..31a5c34692854015b568541db64d7862f722e430 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package.json +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/package.json @@ -26,7 +26,7 @@ "bootstrap": "^4.3.1", "core-js": "^2.6.5", "jquery": "3.4.1", - "oidc-client": "^1.9.0-beta.4", + "oidc-client": "^1.9.0", "popper.js": "^1.14.3", "rxjs": "^6.4.0", "zone.js": "~0.9.1" diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs index d79b0e6698a654fe265d563d80b69ec6b221baa8..c17ab45e19570aba12ccadcee80ef9dad9d0c2f3 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs @@ -10,14 +10,14 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Company.WebApplication1.Data.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("20190808120446_CreateIdentitySchema")] + [Migration("00000000000000_CreateIdentitySchema")] partial class CreateIdentitySchema { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13") + .HasAnnotation("ProductVersion", "3.0.0-rc1.19455.8") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -161,7 +161,9 @@ namespace Company.WebApplication1.Data.Migrations b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("PersistedGrants"); }); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs index 151e8b220608d21dde3198f903b0065aca84915a..ce9a727d1ae4664b4b66fd99b144fd8baa0962c0 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs @@ -237,9 +237,14 @@ namespace Company.WebApplication1.Data.Migrations column: "Expiration"); migrationBuilder.CreateIndex( - name: "IX_PersistedGrants_SubjectId_ClientId_Type_Expiration", + name: "IX_PersistedGrants_Expiration", table: "PersistedGrants", - columns: new[] { "SubjectId", "ClientId", "Type", "Expiration" }); + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_SubjectId_ClientId_Type", + table: "PersistedGrants", + columns: new[] { "SubjectId", "ClientId", "Type" }); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs index 6f19b5d805a09d092554272c54159c026791e1b2..0ce86894d5d35eb41fa53774b89fe2b23846b862 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs @@ -15,7 +15,7 @@ namespace Company.WebApplication1.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13") + .HasAnnotation("ProductVersion", "3.0.0-rc1.19455.8") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -159,7 +159,9 @@ namespace Company.WebApplication1.Data.Migrations b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("PersistedGrants"); }); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs index 445f3f946d1b5cbc8dda0820c4a07418c82cbb42..3a8bebcf4dd674255d171dd96e7de0d1f168e221 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs @@ -16,7 +16,7 @@ namespace Company.WebApplication1.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13"); + .HasAnnotation("ProductVersion", "3.0.0-rc1.19455.8"); modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => { @@ -157,7 +157,9 @@ namespace Company.WebApplication1.Data.Migrations b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("PersistedGrants"); }); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs index 19502e4c12edcbf5274eaaad9cf07a9cd5571c04..8ffa93f693d4a85e491e28782ebd7705529f8a6e 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs @@ -235,9 +235,14 @@ namespace Company.WebApplication1.Data.Migrations column: "Expiration"); migrationBuilder.CreateIndex( - name: "IX_PersistedGrants_SubjectId_ClientId_Type_Expiration", + name: "IX_PersistedGrants_Expiration", table: "PersistedGrants", - columns: new[] { "SubjectId", "ClientId", "Type", "Expiration" }); + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_SubjectId_ClientId_Type", + table: "PersistedGrants", + columns: new[] { "SubjectId", "ClientId", "Type" }); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs index 00494952dd9598617f32e92830c461961398805d..52809076bf62fbb401c3a2dab03154853a3ef7b2 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs @@ -14,7 +14,7 @@ namespace Company.WebApplication1.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13"); + .HasAnnotation("ProductVersion", "3.0.0-rc1.19455.8"); modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => { @@ -155,7 +155,9 @@ namespace Company.WebApplication1.Data.Migrations b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("PersistedGrants"); }); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/app.db b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/app.db index d28dbed8379b1f0a5fa75a46ac181886511455f8..1f4261428921fa7da2622f12eeb1399f23023b2c 100644 Binary files a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/app.db and b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/app.db differ diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package-lock.json b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package-lock.json index d603279670d94e53fae76efe77952fd17575ecd7..d608850055053b60d3236646c7cd53489b6db2f8 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package-lock.json +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package-lock.json @@ -8565,9 +8565,9 @@ "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==" }, "oidc-client": { - "version": "1.9.0-beta.4", - "resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.9.0-beta.4.tgz", - "integrity": "sha512-BE6o220w9kDTicmsX324Z5t3Gg20G9NgQjCOFP6SUY7glJYBohyw9DVPt/khPmmg+wabufJq1tH2zyEadMf7Pw==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.9.0.tgz", + "integrity": "sha512-fJradf/BsRYh96YzWPlm38DRQJRg1wm1nZU21OX8P9NBNxBXRems9BmvOIoh8sO8Y7gmMemESOn4A2TgId+36g==", "requires": { "base64-js": "^1.3.0", "core-js": "^2.6.4", diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package.json b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package.json index 83352c75b3d9d471bebed0a2bec2ef84018e58c6..7bcbc8e8a4fc2fc2e9560cc1318569bf6b787b38 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package.json +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package.json @@ -7,7 +7,7 @@ "bootstrap": "^4.1.3", "jquery": "^3.4.1", "merge": "^1.2.1", - "oidc-client": "^1.9.0-beta.4", + "oidc-client": "^1.9.0", "react": "^16.0.0", "react-dom": "^16.0.0", "react-router-bootstrap": "^0.24.4", diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs index d79b0e6698a654fe265d563d80b69ec6b221baa8..c17ab45e19570aba12ccadcee80ef9dad9d0c2f3 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.Designer.cs @@ -10,14 +10,14 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Company.WebApplication1.Data.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("20190808120446_CreateIdentitySchema")] + [Migration("00000000000000_CreateIdentitySchema")] partial class CreateIdentitySchema { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13") + .HasAnnotation("ProductVersion", "3.0.0-rc1.19455.8") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -161,7 +161,9 @@ namespace Company.WebApplication1.Data.Migrations b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("PersistedGrants"); }); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs index 151e8b220608d21dde3198f903b0065aca84915a..ce9a727d1ae4664b4b66fd99b144fd8baa0962c0 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/00000000000000_CreateIdentitySchema.cs @@ -237,9 +237,14 @@ namespace Company.WebApplication1.Data.Migrations column: "Expiration"); migrationBuilder.CreateIndex( - name: "IX_PersistedGrants_SubjectId_ClientId_Type_Expiration", + name: "IX_PersistedGrants_Expiration", table: "PersistedGrants", - columns: new[] { "SubjectId", "ClientId", "Type", "Expiration" }); + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_SubjectId_ClientId_Type", + table: "PersistedGrants", + columns: new[] { "SubjectId", "ClientId", "Type" }); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs index 6f19b5d805a09d092554272c54159c026791e1b2..0ce86894d5d35eb41fa53774b89fe2b23846b862 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLServer/ApplicationDbContextModelSnapshot.cs @@ -15,7 +15,7 @@ namespace Company.WebApplication1.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13") + .HasAnnotation("ProductVersion", "3.0.0-rc1.19455.8") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -159,7 +159,9 @@ namespace Company.WebApplication1.Data.Migrations b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("PersistedGrants"); }); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs index 445f3f946d1b5cbc8dda0820c4a07418c82cbb42..3a8bebcf4dd674255d171dd96e7de0d1f168e221 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.Designer.cs @@ -16,7 +16,7 @@ namespace Company.WebApplication1.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13"); + .HasAnnotation("ProductVersion", "3.0.0-rc1.19455.8"); modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => { @@ -157,7 +157,9 @@ namespace Company.WebApplication1.Data.Migrations b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("PersistedGrants"); }); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs index 19502e4c12edcbf5274eaaad9cf07a9cd5571c04..8ffa93f693d4a85e491e28782ebd7705529f8a6e 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/00000000000000_CreateIdentitySchema.cs @@ -235,9 +235,14 @@ namespace Company.WebApplication1.Data.Migrations column: "Expiration"); migrationBuilder.CreateIndex( - name: "IX_PersistedGrants_SubjectId_ClientId_Type_Expiration", + name: "IX_PersistedGrants_Expiration", table: "PersistedGrants", - columns: new[] { "SubjectId", "ClientId", "Type", "Expiration" }); + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_SubjectId_ClientId_Type", + table: "PersistedGrants", + columns: new[] { "SubjectId", "ClientId", "Type" }); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs index 00494952dd9598617f32e92830c461961398805d..52809076bf62fbb401c3a2dab03154853a3ef7b2 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Data/SQLite/ApplicationDbContextModelSnapshot.cs @@ -14,7 +14,7 @@ namespace Company.WebApplication1.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview9.19405.13"); + .HasAnnotation("ProductVersion", "3.0.0-rc1.19455.8"); modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => { @@ -155,7 +155,9 @@ namespace Company.WebApplication1.Data.Migrations b.HasKey("Key"); - b.HasIndex("SubjectId", "ClientId", "Type", "Expiration"); + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("PersistedGrants"); }); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/app.db b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/app.db index d28dbed8379b1f0a5fa75a46ac181886511455f8..1f4261428921fa7da2622f12eeb1399f23023b2c 100644 Binary files a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/app.db and b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/app.db differ diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs index 9320980de238f6e58c2ed3bba5bfb6399b7997ea..7f10c3af64ccbf51a4c0d6392f8299f4eeaeacf7 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs @@ -1009,6 +1009,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http return Task.CompletedTask; } + _isLeasedMemoryInvalid = true; + if (_requestRejectedException != null || _applicationException != null) { if (HasResponseStarted) @@ -1339,8 +1341,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http if (_isLeasedMemoryInvalid) { - throw new InvalidOperationException("Invalid ordering of calling StartAsync and Advance. " + - "Call StartAsync before calling GetMemory/GetSpan and Advance."); + throw new InvalidOperationException("Invalid ordering of calling StartAsync or CompleteAsync and Advance."); } if (_canWriteResponseBody) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs index 1e5f09732a7bdc85016e7ce683477ce3df8730c2..18adcc1a825101880a4dad1da09cbe20bebeee13 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs @@ -80,6 +80,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 Stop(); + // Make sure the writing side is completed. + _pipeWriter.Complete(); + if (_fakeMemoryOwner != null) { _fakeMemoryOwner.Dispose(); @@ -104,7 +107,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 lock (_dataWriterLock) { - ThrowIfSuffixSent(); + ThrowIfSuffixSentOrDisposed(); if (_completed) { @@ -130,7 +133,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 { lock (_dataWriterLock) { - ThrowIfSuffixSent(); + ThrowIfSuffixSentOrDisposed(); if (_completed) { @@ -185,7 +188,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 lock (_dataWriterLock) { - ThrowIfSuffixSent(); + ThrowIfSuffixSentOrDisposed(); // This length check is important because we don't want to set _startedWritingDataFrames unless a data // frame will actually be written causing the headers to be flushed. @@ -233,7 +236,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 { lock (_dataWriterLock) { - ThrowIfSuffixSent(); + ThrowIfSuffixSentOrDisposed(); if (_completed) { @@ -250,7 +253,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 { lock (_dataWriterLock) { - ThrowIfSuffixSent(); + ThrowIfSuffixSentOrDisposed(); if (_completed) { @@ -265,7 +268,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 { lock (_dataWriterLock) { - ThrowIfSuffixSent(); + ThrowIfSuffixSentOrDisposed(); if (_completed) { @@ -298,7 +301,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 lock (_dataWriterLock) { - ThrowIfSuffixSent(); + ThrowIfSuffixSentOrDisposed(); // This length check is important because we don't want to set _startedWritingDataFrames unless a data // frame will actually be written causing the headers to be flushed. @@ -345,10 +348,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 _completed = true; - // Complete with an exception to prevent an end of stream data frame from being sent without an - // explicit call to WriteStreamSuffixAsync. ConnectionAbortedExceptions are swallowed, so the - // message doesn't matter - _pipeWriter.Complete(new OperationCanceledException()); + _pipeReader.CancelPendingRead(); _frameWriter.AbortPendingStreamDataWrites(_flowControl); } @@ -369,7 +369,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 { readResult = await _pipeReader.ReadAsync(); - if (readResult.IsCompleted && _stream.ResponseTrailers?.Count > 0) + if (readResult.IsCanceled) + { + // Response body is aborted, break and complete reader. + break; + } + else if (readResult.IsCompleted && _stream.ResponseTrailers?.Count > 0) { // Output is ending and there are trailers to write // Write any remaining content then write trailers @@ -405,10 +410,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 _pipeReader.AdvanceTo(readResult.Buffer.End); } while (!readResult.IsCompleted); } - catch (OperationCanceledException) - { - // Writes should not throw for aborted streams/connections. - } catch (Exception ex) { _log.LogCritical(ex, nameof(Http2OutputProducer) + "." + nameof(ProcessDataWrites) + " observed an unexpected exception."); @@ -435,12 +436,17 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 } [StackTraceHidden] - private void ThrowIfSuffixSent() + private void ThrowIfSuffixSentOrDisposed() { if (_suffixSent) { ThrowSuffixSent(); } + + if (_disposed) + { + ThrowDisposed(); + } } [StackTraceHidden] @@ -449,6 +455,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 throw new InvalidOperationException("Writing is not allowed after writer was completed."); } + [StackTraceHidden] + private static void ThrowDisposed() + { + throw new InvalidOperationException("Cannot write to response after the request has completed."); + } + private static Pipe CreateDataPipe(MemoryPool<byte> pool) => new Pipe(new PipeOptions ( diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs index c74f321a51f4e53652db4b325b5e81f6b6b8ee17..4937000db9e187f3f16cdf2e8991fb1fcbc0cae7 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs @@ -3737,6 +3737,52 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests Assert.Equal("Hello World", Encoding.UTF8.GetString(bodyFrame.Payload.Span)); } + [Fact] + public async Task CompleteAsync_AdvanceAfterComplete_AdvanceThrows() + { + var tcs = new TaskCompletionSource<object>(); + var headers = new[] + { + new KeyValuePair<string, string>(HeaderNames.Method, "GET"), + new KeyValuePair<string, string>(HeaderNames.Path, "/"), + new KeyValuePair<string, string>(HeaderNames.Scheme, "http"), + }; + await InitializeConnectionAsync(async context => + { + var memory = context.Response.BodyWriter.GetMemory(12); + await context.Response.CompleteAsync(); + try + { + context.Response.BodyWriter.Advance(memory.Length); + } + catch (InvalidOperationException) + { + tcs.SetResult(null); + return; + } + + Assert.True(false); + }); + + await StartStreamAsync(1, headers, endStream: true); + + var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, + withLength: 55, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), + withStreamId: 1); + + await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); + + _hpackDecoder.Decode(headersFrame.PayloadSequence, endHeaders: false, handler: this); + + Assert.Equal(3, _decodedHeaders.Count); + Assert.Contains("date", _decodedHeaders.Keys, StringComparer.OrdinalIgnoreCase); + Assert.Equal("200", _decodedHeaders[HeaderNames.Status]); + Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); + + await tcs.Task.DefaultTimeout(); + } + [Fact] public async Task CompleteAsync_AfterPipeWrite_WithTrailers_SendsBodyAndTrailersWithEndStream() { diff --git a/src/SiteExtensions/LoggingAggregate/src/Microsoft.AspNetCore.AzureAppServices.SiteExtension/Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj b/src/SiteExtensions/LoggingAggregate/src/Microsoft.AspNetCore.AzureAppServices.SiteExtension/Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj index 7054d0908db3fdaf668679c1c9839711998af163..e1f4b6d6709e10abe8460aed873c7127fbf26c74 100644 --- a/src/SiteExtensions/LoggingAggregate/src/Microsoft.AspNetCore.AzureAppServices.SiteExtension/Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj +++ b/src/SiteExtensions/LoggingAggregate/src/Microsoft.AspNetCore.AzureAppServices.SiteExtension/Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj @@ -15,6 +15,7 @@ <GeneratePackageOnBuild>true</GeneratePackageOnBuild> <DisablePackageReferenceRestrictions>true</DisablePackageReferenceRestrictions> <NoSemVer20>true</NoSemVer20> + <IsShippingPackage>true</IsShippingPackage> <!-- Grab packages LB.csproj should have just built. --> <RestoreAdditionalProjectSources>$(RestoreAdditionalProjectSources);$(ArtifactsNonShippingPackagesDir)</RestoreAdditionalProjectSources>