internal static String BuildHeaderSigStr(IDictionary <String, String> headers) { List <KeyValuePair <string, string> > headerLst = new List <KeyValuePair <string, string> >(); foreach (KeyValuePair <string, string> pair in headers) { if (pair.Key.StartsWith("x-log-") && pair.Key.CompareTo(LogConsts.NAME_HEADER_DATE) != 0) { headerLst.Add(new KeyValuePair <String, String>(pair.Key.Trim().ToLower(), pair.Value.Trim())); } } headerLst.Sort(new KeyValueComparer()); StringBuilder reqUri = new StringBuilder(); reqUri.Append(LogClientTools.GetValeFromDic(headers, LogConsts.NAME_HEADER_MD5)).Append("\n") .Append(LogClientTools.GetValeFromDic(headers, LogConsts.NAME_HEADER_CONTENTTYPE)).Append("\n") .Append(LogClientTools.GetValeFromDic(headers, LogConsts.NAME_HEADER_DATE)).Append("\n") .Append(GetRequestString(headerLst, ":", "\n")); return(reqUri.ToString()); }
public void Sign(ServiceRequest request, ServiceCredentials credentials) { request.Headers.Add(LogConsts.NAME_HEADER_AUTH, LogClientTools.Signature(request.Headers, request.Parameters, this.httpMethod, this.httpResource, credentials.AccessId, credentials.AccessKey)); }