Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Fix 401 malformed WWW-Authenticate #4649

Merged
merged 3 commits into from
Jul 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ public Task ExecuteAsync(HttpContext context)
var errorString = string.Format($"error=\"{Error}\"");
if (ErrorDescription.IsMissing())
{
context.Response.Headers.Add(HeaderNames.WWWAuthenticate, new StringValues(new[] { "Bearer", errorString }));
context.Response.Headers.Add(HeaderNames.WWWAuthenticate, new StringValues(new[] { "Bearer realm=\"IdentityServer\"", errorString }));
}
else
{
var errorDescriptionString = string.Format($"error_description=\"{ErrorDescription}\"");
context.Response.Headers.Add(HeaderNames.WWWAuthenticate, new StringValues(new[] { "Bearer", errorString, errorDescriptionString }));
context.Response.Headers.Add(HeaderNames.WWWAuthenticate, new StringValues(new[] { "Bearer realm=\"IdentityServer\"", errorString, errorDescriptionString }));
}

return Task.CompletedTask;
}
}
}
}