// This API is a helper method to create auth header based on client request. // Uri is split into resourceType/resourceId - // For feed/post/put requests, resourceId = parentId, // For point get requests, resourceId = last segment in URI public static string GenerateGatewayAuthSignatureWithAddressResolution(string verb, Uri uri, INameValueCollection headers, IComputeHash stringHMACSHA256Helper, string clientVersion = "") { if (uri == null) { throw new ArgumentNullException(nameof(uri)); } // Address request has the URI fragment (dbs/dbid/colls/colId...) as part of // either $resolveFor 'or' $generate queries of the context.RequestUri. // Extracting out the URI in the form https://localhost/dbs/dbid/colls/colId/docs to generate the signature. // Authorizer uses the same URI to verify signature. if (uri.AbsolutePath.Equals(Paths.Address_Root, StringComparison.OrdinalIgnoreCase)) { uri = AuthorizationHelper.GenerateUriFromAddressRequestUri(uri); } return(GenerateKeyAuthorizationSignature(verb, uri, headers, stringHMACSHA256Helper, clientVersion)); }