Skip to content

Commit

Permalink
remove redundant allocation in ProtectedResourceErrorResult
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Dec 9, 2024
1 parent bb383dd commit 1d5f82a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ public Task WriteHttpResponse(ProtectedResourceErrorResult result, HttpContext c
var errorString = string.Format($"error=\"{error}\"");
if (errorDescription.IsMissing())
{
context.Response.Headers.Append(HeaderNames.WWWAuthenticate, new StringValues(new[] { "Bearer realm=\"IdentityServer\"", errorString }).ToString());
context.Response.Headers.Append(HeaderNames.WWWAuthenticate, new StringValues(new[] { "Bearer realm=\"IdentityServer\"", errorString }));
}
else
{
var errorDescriptionString = string.Format($"error_description=\"{errorDescription}\"");
context.Response.Headers.Append(HeaderNames.WWWAuthenticate, new StringValues(new[] { "Bearer realm=\"IdentityServer\"", errorString, errorDescriptionString }).ToString());
context.Response.Headers.Append(HeaderNames.WWWAuthenticate, new StringValues(new[] { "Bearer realm=\"IdentityServer\"", errorString, errorDescriptionString }));
}

return Task.CompletedTask;
Expand Down

0 comments on commit 1d5f82a

Please sign in to comment.