public String ComposeStringToSign(MethodType?method, String uriPattern, Signer signer,
                                          Dictionary <string, string> queries, Dictionary <string, string> headers,
                                          Dictionary <string, string> paths)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(method).Append(HEADER_SEPARATOR);
            if (headers.ContainsKey("Accept"))
            {
                sb.Append(headers["Accept"]);
            }
            sb.Append(HEADER_SEPARATOR);
            if (headers.ContainsKey("Content-MD5"))
            {
                sb.Append(headers["Content-MD5"]);
            }
            sb.Append(HEADER_SEPARATOR);
            if (headers.ContainsKey("Content-Type"))
            {
                sb.Append(headers["Content-Type"]);
            }
            sb.Append(HEADER_SEPARATOR);
            if (headers.ContainsKey("Date"))
            {
                sb.Append(headers["Date"]);
            }
            sb.Append(HEADER_SEPARATOR);
            string uri = ReplaceOccupiedParameters(uriPattern, paths);

            sb.Append(BuildCanonicalHeaders(headers, "x-acs-"));
            sb.Append(BuildQuerystring(uri, queries));
            return(sb.ToString());
        }
Beispiel #2
0
        public string ComposeStringToSign(MethodType?method, string uriPattern, Signer signer,
                                          Dictionary <string, string> queries, Dictionary <string, string> headers, Dictionary <string, string> paths)
        {
            var sortedDictionary = SortDictionary(queries);

            StringBuilder canonicalizedQueryString = new StringBuilder();

            foreach (var p in sortedDictionary)
            {
                canonicalizedQueryString.Append("&")
                .Append(AcsURLEncoder.PercentEncode(p.Key)).Append("=")
                .Append(AcsURLEncoder.PercentEncode(p.Value));
            }

            StringBuilder stringToSign = new StringBuilder();

            stringToSign.Append(method.ToString());
            stringToSign.Append(SEPARATOR);
            stringToSign.Append(AcsURLEncoder.PercentEncode("/"));
            stringToSign.Append(SEPARATOR);
            stringToSign.Append(AcsURLEncoder.PercentEncode(
                                    canonicalizedQueryString.ToString().Substring(1)));

            return(stringToSign.ToString());
        }
        private string ComposeStringToSign(MethodType?method, Dictionary <string, string> queries)
        {
            //排序
            var sortedDictionary = SortDictionary(queries);

            StringBuilder canonicalizedQueryString = new StringBuilder();

            foreach (var p in sortedDictionary)
            {
                canonicalizedQueryString.Append("&")
                .Append(AcsURLEncoder.PercentEncode(p.Key)).Append("=")
                .Append(AcsURLEncoder.PercentEncode(p.Value));
            }

            var t = canonicalizedQueryString.ToString().Substring(1);

            StringBuilder stringToSign = new StringBuilder();

            stringToSign.Append(method.ToString());
            stringToSign.Append(SEPARATOR);
            stringToSign.Append(AcsURLEncoder.PercentEncode("/"));
            stringToSign.Append(SEPARATOR);
            stringToSign.Append(AcsURLEncoder.PercentEncode(
                                    canonicalizedQueryString.ToString().Substring(1)));

            return(stringToSign.ToString());
        }
Beispiel #4
0
 public OrderByField(string name, OrderByFieldType orderingType, bool ascending, MethodType?method = null, Argument[] arguments = null)
 {
     Method       = method;
     Name         = name;
     OrderingType = orderingType;
     Ascending    = ascending;
     Arguments    = arguments;
 }
Beispiel #5
0
 public OrderByField(QueryFieldName name, OrderByFieldType orderingType, bool ascending, MethodType?method = null, Argument[] arguments = null)
 {
     Method               = method;
     Name                 = name;
     OrderingType         = orderingType;
     Ascending            = ascending;
     Arguments            = arguments;
     AggregationOperation = AggregationOperation.None;
 }
Beispiel #6
0
 public static Method <HelloRequest, HelloReply> GetServiceMethod(MethodType?methodType = null, Marshaller <HelloRequest>?requestMarshaller = null)
 {
     return(new Method <HelloRequest, HelloReply>(methodType ?? MethodType.Unary, "ServiceName", "MethodName", requestMarshaller ?? HelloRequestMarshaller, HelloReplyMarshaller));
 }