Ejemplo n.º 1
0
        static async Task <Crumb> GetCrumb(HttpClient httpClient)
        {
            string endPoint = string.Format(GET_CRUMB_URI);

            HttpResponseMessage response = await httpClient.GetAsync(endPoint);

            if (!response.IsSuccessStatusCode)
            {
                return(null);
            }

            string responseContents = await response.Content.ReadAsStringAsync();

            if (string.IsNullOrEmpty(responseContents))
            {
                return(null);
            }

            Crumb crumb = new Crumb();

            crumb.FieldName = XmlNodeLoader.LoadValue(
                responseContents, "/defaultCrumbIssuer/crumbRequestField");
            crumb.Value = XmlNodeLoader.LoadValue(
                responseContents, "/defaultCrumbIssuer/crumb");

            return(crumb);
        }
 public static string GetAuthToken(XmlDocument projectDescriptor)
 {
     return(XmlNodeLoader.GetNodeValue(projectDescriptor, "/*/authToken"));
 }