mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-02 01:58:40 +00:00
Add debug logging for digest failure, reset body stream when reading alt key
This commit is contained in:
parent
b4509c9906
commit
489da20395
1 changed files with 9 additions and 0 deletions
|
@ -183,9 +183,18 @@ public class Startup
|
||||||
// If we got here, the normal ServerDigestKey failed to validate. Lets try again with the alternate digest key.
|
// If we got here, the normal ServerDigestKey failed to validate. Lets try again with the alternate digest key.
|
||||||
usedAlternateDigestKey = true;
|
usedAlternateDigestKey = true;
|
||||||
|
|
||||||
|
// Reset the body stream
|
||||||
|
body.Position = 0;
|
||||||
|
|
||||||
clientRequestDigest = await HashHelper.ComputeDigest(digestPath, authCookie, body, ServerSettings.Instance.AlternateDigestKey);
|
clientRequestDigest = await HashHelper.ComputeDigest(digestPath, authCookie, body, ServerSettings.Instance.AlternateDigestKey);
|
||||||
if (clientRequestDigest != sentDigest)
|
if (clientRequestDigest != sentDigest)
|
||||||
{
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Digest failed");
|
||||||
|
Console.WriteLine("digestKey: " + ServerSettings.Instance.ServerDigestKey);
|
||||||
|
Console.WriteLine("altDigestKey: " + ServerSettings.Instance.AlternateDigestKey);
|
||||||
|
Console.WriteLine("computed digest: " + clientRequestDigest);
|
||||||
|
#endif
|
||||||
// We still failed to validate. Abort the request.
|
// We still failed to validate. Abort the request.
|
||||||
context.Response.StatusCode = 403;
|
context.Response.StatusCode = 403;
|
||||||
context.Abort();
|
context.Abort();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue