protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { var signature = G2OData.CreateSignature( version: this.Version, edgeIP: this.EdgeIP, clientIP: this.ClientIP, time: DateTimeOffset.UtcNow, uniqueId: Guid.NewGuid().ToString(), nonce: this.Nonce, nonceValue: this.NonceValue, path: request.RequestUri.LocalPath); request.SetG2OSignatureHeaders(signature); return(await base.SendAsync(request, cancellationToken)); }
public bool Validate(string path, Func <string, string> keyResolver) { var nonceValue = keyResolver(this.Fields.Nonce); var recreatedSignature = G2OData.CreateSignature( version: this.Fields.Version, edgeIP: this.Fields.EdgeIP, clientIP: this.Fields.ClientIP, time: this.Fields.Time, uniqueId: this.Fields.UniqueID, nonce: this.Fields.Nonce, nonceValue: nonceValue, path: path); return(this.Value.Equals(recreatedSignature.Value)); }