Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Groovy get put with NTLM

Amy Martin June 11, 2025

Hi All, 

We are trying to prepare to upgrade to v10.x for Jira SM. In doing so we're validating our current Groovy scripts. 

We have several that make a call to an internal HTTP site (not Atlassian) that requires NTLM Authentication. 

We had previously used the HTTPBuilder and RESTClient from the groovyx.net.http, however this functionality is no longer available. Support document suggest to use native Groovy calls. 

While I can do a call such as 

def urlobj = new URL("https://mywebsite.com.au/").openConnection()

def getRC = urlobj.getResponseCode()

 

Obviously the returned is 401 Unauthorized. 

 

While I've seen options for .setRequestProperty or using a BufferReader, I'm quite unclear on how or where appropriate credentials are supplied. 

1 answer

0 votes
Tuncay Senturk _Snapbytes_
Community Champion
June 12, 2025

Hi @Amy Martin 

afaik, Jira 10.x (based on Java 17 and its tightened security) no longer supports third-party Groovy libraries like HttpBuilder or RestClient, so you're now limited to native Java/Groovy HTTP clients. As I said, I am unsure though.

To handle NTLM authentication with native Groovy or Java classes (HttpUrlConnection), it's not simple and straightforward, because NTLM may not accept Basic authorization method, very unlikely. Java’s built-in HttpUrlConnection does not natively support NTLM.

So, it is tough, but you can create a Java class (via ScriptRunner's classpath)

For instance, using Apache HttpClient, this class may set AuthScope and NTCredentials and create the connection. You can deploy this class and invoke it from your Groovy scripts. Please bear in mind that I haven't tested such a case. This is what I would do if I were in your position.

Amy Martin June 12, 2025

Hi Tuncay, 

Yes the HttpBuilder/RestClient is no longer available in Groovy4. 

Sadly we do not have Script Runner. So we are looking at having to write a full script that will contact a internally hosted website that requires NTLM. 

I have been looking in to the Java and Apache built in options, just getting a little lost. 

Amy

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events