Esempio n. 1
0
        public string GenerateOAuthParametersForHeader()
        {
            var builder = new StringBuilder();

            if (Realm != null)
            {
                builder.Append("realm=\"").Append(Realm).Append("\"");
            }

            IEnumerable <QueryParameter> parameters = UriUtility.ToQueryParametersExcludingTokenSecret(AuthorizationHeaderParameters);

            foreach (var parameter in parameters)
            {
                if (parameter.Key != Parameters.Realm)
                {
                    if (builder.Length > 0)
                    {
                        builder.Append(",");
                    }
                    builder.Append(UriUtility.UrlEncode(parameter.Key)).Append("=\"").Append(
                        UriUtility.UrlEncode(parameter.Value)).Append("\"");
                }
            }

            builder.Insert(0, "OAuth ");

            return(builder.ToString());
        }
Esempio n. 2
0
        static string FormatParameterNames(IEnumerable <string> names)
        {
            var builder = new StringBuilder();

            foreach (string name in names)
            {
                if (builder.Length > 0)
                {
                    builder.Append("&");
                }
                builder.Append(UriUtility.UrlEncode(name));
            }

            return(builder.ToString());
        }