public void addAuthHeader(WebRequest request, string bucket, string key, SortedList <string, string> query) { if (request.Headers["x-amz-date"] == null) { request.Headers.Add("x-amz-date", Utils.getHttpDate()); } string str = Utils.encode(this.awsSecretAccessKey, AwsConnection.makeCanonicalString(bucket, key, query, request), false); request.Headers.Add("Authorization", "AWS " + this.awsAccessKeyId + ":" + str); }
internal static string makeCanonicalString(string bucket, string key, SortedList <string, string> query, WebRequest request) { SortedList headers = new SortedList(); foreach (string header in (NameObjectCollectionBase)request.Headers) { headers.Add((object)header, (object)request.Headers[header]); } if (headers[(object)"Content-Type"] == null) { headers.Add((object)"Content-Type", (object)request.ContentType); } return(AwsConnection.makeCanonicalString(request.Method, bucket, key, query, headers, (string)null)); }
internal static string makeCanonicalString(string bucket, string key, WebRequest request) { return(AwsConnection.makeCanonicalString(bucket, key, new SortedList <string, string>(), request)); }