diff --git a/Directory.Packages.props b/Directory.Packages.props index b0395a27..cb74a9dc 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -20,41 +20,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + - - - - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + - + + + diff --git a/sandbox/OpenIddict.Sandbox.AspNet.Client/Web.config b/sandbox/OpenIddict.Sandbox.AspNet.Client/Web.config index 611c0da5..5884defb 100644 --- a/sandbox/OpenIddict.Sandbox.AspNet.Client/Web.config +++ b/sandbox/OpenIddict.Sandbox.AspNet.Client/Web.config @@ -67,7 +67,7 @@ - + diff --git a/sandbox/OpenIddict.Sandbox.AspNet.Server/Web.config b/sandbox/OpenIddict.Sandbox.AspNet.Server/Web.config index 96487957..5b3af713 100644 --- a/sandbox/OpenIddict.Sandbox.AspNet.Server/Web.config +++ b/sandbox/OpenIddict.Sandbox.AspNet.Server/Web.config @@ -91,7 +91,7 @@ - + diff --git a/src/OpenIddict.Abstractions/OpenIddict.Abstractions.csproj b/src/OpenIddict.Abstractions/OpenIddict.Abstractions.csproj index 05fc3fd6..b8ae6582 100644 --- a/src/OpenIddict.Abstractions/OpenIddict.Abstractions.csproj +++ b/src/OpenIddict.Abstractions/OpenIddict.Abstractions.csproj @@ -27,6 +27,7 @@ + diff --git a/src/OpenIddict.AspNetCore/OpenIddict.AspNetCore.csproj b/src/OpenIddict.AspNetCore/OpenIddict.AspNetCore.csproj index 3e39660c..8cc45bfb 100644 --- a/src/OpenIddict.AspNetCore/OpenIddict.AspNetCore.csproj +++ b/src/OpenIddict.AspNetCore/OpenIddict.AspNetCore.csproj @@ -4,7 +4,6 @@ $(NetFrameworkTargetFrameworks);$(NetCoreTargetFrameworks) false false - false false diff --git a/src/OpenIddict.Client.SystemIntegration/OpenIddict.Client.SystemIntegration.csproj b/src/OpenIddict.Client.SystemIntegration/OpenIddict.Client.SystemIntegration.csproj index 1aa3a77d..252699ff 100644 --- a/src/OpenIddict.Client.SystemIntegration/OpenIddict.Client.SystemIntegration.csproj +++ b/src/OpenIddict.Client.SystemIntegration/OpenIddict.Client.SystemIntegration.csproj @@ -44,7 +44,6 @@ - diff --git a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs index 3e22bf09..0081fe0d 100644 --- a/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs +++ b/src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHandlers.cs @@ -8,6 +8,7 @@ using System.Collections.Immutable; using System.ComponentModel; using System.Diagnostics; using System.Net; +using System.Net.Http.Headers; using System.Runtime.CompilerServices; using System.Security.Claims; using System.Text; @@ -15,7 +16,6 @@ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Microsoft.Extensions.Primitives; -using Microsoft.Net.Http.Headers; using static OpenIddict.Client.SystemIntegration.OpenIddictClientSystemIntegrationConstants; namespace OpenIddict.Client.SystemIntegration; @@ -456,7 +456,7 @@ public static partial class OpenIddictClientSystemIntegrationHandlers // If no encoding was set or if the received value is not valid, fall back to UTF-8. context.Transaction.Request = new OpenIddictRequest(await OpenIddictHelpers.ParseFormAsync( stream : request.InputStream, - encoding : type.Encoding is { CodePage: not 65000 } encoding ? encoding : Encoding.UTF8, + encoding : GetEncoding(type) is { CodePage: not 65000 } encoding ? encoding : Encoding.UTF8, cancellationToken: CancellationToken.None)); } @@ -471,6 +471,24 @@ public static partial class OpenIddictClientSystemIntegrationHandlers return; } + + static Encoding? GetEncoding(MediaTypeHeaderValue type) + { + if (string.IsNullOrEmpty(type.CharSet)) + { + return null; + } + + try + { + return Encoding.GetEncoding(type.CharSet); + } + + catch (ArgumentException) + { + return null; + } + } } } diff --git a/src/OpenIddict.Owin/OpenIddict.Owin.csproj b/src/OpenIddict.Owin/OpenIddict.Owin.csproj index 4fc52a06..0e99088b 100644 --- a/src/OpenIddict.Owin/OpenIddict.Owin.csproj +++ b/src/OpenIddict.Owin/OpenIddict.Owin.csproj @@ -4,7 +4,6 @@ $(NetFrameworkTargetFrameworks) false false - false false diff --git a/src/OpenIddict/OpenIddict.csproj b/src/OpenIddict/OpenIddict.csproj index 6f41ae5d..b88f3bda 100644 --- a/src/OpenIddict/OpenIddict.csproj +++ b/src/OpenIddict/OpenIddict.csproj @@ -24,7 +24,6 @@ Condition=" $([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETCoreApp' ">.NETCoreApp false false - false false