Windows Authentication in groovy rest api

Neha Sharma August 7, 2018

Hi,

I'm tying to make a post request to an API which accepts only Windows authentication. I'm not sure (and couldn't find anything helpful online) how to do it in a groovy script.

I have an issue listener where I'll be posting the comment (whenever a new comment is added to the issue) to a different application using an api call. This api call is based on NTLM authentication.

Any idea how this can be done ?

Below is a sample code for the same in C# 

 var uri = new Uri(baseURL+ "xyz");
using (var wc = new WebClient())
{
wc.UseDefaultCredentials = true;
wc.Headers.Set("Content-Type", "application/json");
var res = wc.UploadString(uri, "POST", json);
return wc.ResponseHeaders.Get("ABC");
}

So, basically I want to implement the wc.UseDefaultCredentials = true part in groovy.

Thanks,

Neha

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events