added AP call date check
This commit is contained in:
parent
c86847a146
commit
9ff5707e92
1 changed files with 8 additions and 0 deletions
|
@ -164,6 +164,14 @@ namespace BirdsiteLive.Domain
|
|||
|
||||
private async Task<SignatureValidationResult> ValidateSignature(string actor, string rawSig, string method, string path, string queryString, Dictionary<string, string> requestHeaders)
|
||||
{
|
||||
//Check Date Validity
|
||||
var date = requestHeaders["date"];
|
||||
var d = DateTime.Parse(date).ToUniversalTime();
|
||||
var now = DateTime.UtcNow;
|
||||
var delta = Math.Abs((d - now).TotalSeconds);
|
||||
if (delta > 30) return new SignatureValidationResult { SignatureIsValidated = false };
|
||||
|
||||
//Check Signature
|
||||
var signatures = rawSig.Split(',');
|
||||
var signature_header = new Dictionary<string, string>();
|
||||
foreach (var signature in signatures)
|
||||
|
|
Reference in a new issue