diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..b04fff14a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Visual Studio Code workspace options +.vscode/settings.json diff --git a/identity-server/Directory.Build.targets b/identity-server/Directory.Build.targets index 7b3436797..a1f512d4c 100644 --- a/identity-server/Directory.Build.targets +++ b/identity-server/Directory.Build.targets @@ -27,6 +27,7 @@ + diff --git a/identity-server/src/IdentityServer/Endpoints/Results/ProtectedResourceErrorResult.cs b/identity-server/src/IdentityServer/Endpoints/Results/ProtectedResourceErrorResult.cs index ba73ef94f..f0504e8d5 100644 --- a/identity-server/src/IdentityServer/Endpoints/Results/ProtectedResourceErrorResult.cs +++ b/identity-server/src/IdentityServer/Endpoints/Results/ProtectedResourceErrorResult.cs @@ -9,6 +9,7 @@ using Microsoft.Extensions.Primitives; using Microsoft.AspNetCore.Http; using Microsoft.Net.Http.Headers; using Duende.IdentityModel; +using System.Collections.Generic; namespace Duende.IdentityServer.Endpoints.Results; @@ -59,16 +60,24 @@ internal class ProtectedResourceErrorHttpWriter : IHttpResponseWriter { - context.Response.Headers.Append(HeaderNames.WWWAuthenticate, new StringValues(new[] { "Bearer realm=\"IdentityServer\"", errorString })); - } - else + """ + Bearer realm="IdentityServer" + """, + $""" + error="{error}" + """ + }; + + if (!errorDescription.IsMissing()) { - var errorDescriptionString = string.Format($"error_description=\"{errorDescription}\""); - context.Response.Headers.Append(HeaderNames.WWWAuthenticate, new StringValues(new[] { "Bearer realm=\"IdentityServer\"", errorString, errorDescriptionString })); + values.Add($""" + error_description="{errorDescription}" + """); } + + context.Response.Headers.Append(HeaderNames.WWWAuthenticate, string.Join(",", values)); return Task.CompletedTask; } diff --git a/identity-server/test/Configuration.IntegrationTests/Configuration.IntegrationTests.csproj b/identity-server/test/Configuration.IntegrationTests/Configuration.IntegrationTests.csproj index 2f225ae68..89291c4a0 100644 --- a/identity-server/test/Configuration.IntegrationTests/Configuration.IntegrationTests.csproj +++ b/identity-server/test/Configuration.IntegrationTests/Configuration.IntegrationTests.csproj @@ -23,6 +23,7 @@ all + diff --git a/identity-server/test/EntityFramework.IntegrationTests/EntityFramework.IntegrationTests.csproj b/identity-server/test/EntityFramework.IntegrationTests/EntityFramework.IntegrationTests.csproj index 90ab0a162..7d232874c 100644 --- a/identity-server/test/EntityFramework.IntegrationTests/EntityFramework.IntegrationTests.csproj +++ b/identity-server/test/EntityFramework.IntegrationTests/EntityFramework.IntegrationTests.csproj @@ -9,6 +9,7 @@ + diff --git a/identity-server/test/EntityFramework.Storage.IntegrationTests/EntityFramework.Storage.IntegrationTests.csproj b/identity-server/test/EntityFramework.Storage.IntegrationTests/EntityFramework.Storage.IntegrationTests.csproj index 2eaec819d..75e1c0799 100644 --- a/identity-server/test/EntityFramework.Storage.IntegrationTests/EntityFramework.Storage.IntegrationTests.csproj +++ b/identity-server/test/EntityFramework.Storage.IntegrationTests/EntityFramework.Storage.IntegrationTests.csproj @@ -13,6 +13,7 @@ + @@ -21,7 +22,7 @@