Webservices NTLM Auth

I am working on a project that will integrate Ignition with SharePoint 2013 and another one of our systems.

I am attempting to setup Ignition with REST services to SharePoint. This works great for reading, however I am having issues posting data. It appears to boil down to the need to use NTLM auth. The system.net.* functions do what we need otherwise.

I did a trial of the SepaSoft Web Services Module and it it works OOB for what I need, but the $2500 cost (times many gateways…) is going to be a hard sell to my management just to add the ability to do NTLM auth to a web service.

I have tried using the requests-ntlm python module, but unfortunately this is only python 2.6+ compatible and errors out in jython. Any other ideas?

I do not think NTLM is the only auth method for SP.

It’s not, but I don’t have any control over our SharePoint environment and the team that owns it is not very receptive to changes.

You could try using Java’s HttpURLConnection directly: docs.oracle.com/javase/8/docs/a … ction.html

It may support NTLM auth as of Java 8.

HI Ryan,

Did you find a solution here? If you’re still working on it, feel free to give me a call and we can discuss bulk pricing if that is the barrier to using our Webservices module.

Best regards,
Mark
800.207.5506x107

P.S. Sorry - we don’t closely monitor the IA forum…I might have to change that!

Or this?

JXBrowser example code

Wondering if there are any new ways to handle this using the new system.net.httpClient() to allow an NTLM auth? It seems there is more exposure to the Java objects, but the java docs for httpclient go down a rabbit hole real quick.

Right now system.net.httpClient just uses the Java HTTPClient, which, at least in Java 11, only supports Basic authentication. Either our implementation or Java’s may change in the future. Could be an ideas post, if it’s not already :slight_smile:

After some playing around I was able to setup a basic HTTP GET using Java and supplying NTLM auth.

However, I am finding that I am getting import errors in the Gateway Scope, but not in the Designer scope. I am running the same Java (8.231) on both designer and gateway, is there some odd difference in context of why the below might fail?

# Perform a basic HTTP Get to the provided URL using the NTLM auth in the function
def _httpGetNTLM(url):	
	from org.apache.http.auth import AuthScope
	from org.apache.http.auth import NTCredentials
	from org.apache.http.client.methods import HttpGet
	from org.apache.http.impl.client import DefaultHttpClient
	from org.apache.http.impl.client import BasicResponseHandler
	from org.apache.http.entity import ContentType
	
	# Setup the client with NTLM Auth
	httpclient = DefaultHttpClient()
	
	# Define the credentials to use
	creds = NTCredentials("USERNAME", "PASSWORD", system.net.getHostName(), "DOMAINHERE")
	httpclient.getCredentialsProvider().setCredentials(AuthScope.ANY, creds)
	
	# Define the host and URL to call
	httpget = HttpGet(url)
	
	# Execute the request
	response = httpclient.execute(httpget)   
	
	# Handle the response
	content = BasicResponseHandler().handleResponse(response)
	contentType = ContentType.getOrDefault(response.getEntity()).getMimeType()
	
	# Return the result
	if 'json' in contentType.lower():
		return system.util.jsonDecode(content)
	else:
		return content

Results return fine in the Designer (script console). On the gateway, I get the following:

Traceback (most recent call last):
...
...
File "", line 33, in _httpGetNTLM
ImportError: No module named http
1 Like

Look in the vision module file. You’ll see httpclient and httpcore JAR files set to deploy in Client and Designer scopes. These aren’t part of the common gateway in v7.9.

They are part of the common gateway in v8.

2 Likes

That makes sense, I assume there would not be a workaround? Can I drop the JARs in common to force to all scopes?

You can try :slight_smile:
It’s unsupported and you could cause other issues for yourself, especially if there are any version mismatches.