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.
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.