In this article, Assad shows how to configure a Sharepoint NTLM authentication process when using Convertigo Mobility Platform. The source code for this sample can be downloaded here: sampleSharepointAuth.car

HTTP Connector configuration

When you create a new HTTP Connector, first thing to do is to set its Authentication property to NTLM. Then you configure Server, Root path, Port and isHttps depending on your environment parameters.


Connector

You will notice a user and a password property. In our project, we would like to set those parameters as variables in order to check the user credentials, so we leave them blank. Now we will create a new Convertigo Transaction, “GetUser” , with three variables, user, password and domain, and we will implement its handler “onTransactionStarted” with this code:

	// Handles the transaction start event.
function onTransactionStarted() {
    // TODO: add your code here

    // TODO: customize the returned value (if you omit returned value, the 
    // algorithm will continue its process).
    // Possible values are:
    //    cancel - means the algorithm cancels the transaction core process.

    // return "cancel";
    context.connector.setAuthUser(user);
    context.connector.setAuthPassword(password);
    context.connector.setNTLMAuthenticationDomain(domain);
}
Once a user is correctly authenticated, the HTTP session between Sharepoint and Convertigo will have the “authenticated” header. If we do not close this connection, the session will still be acknowledged as authenticated and unauthorized accesses will further be possible in this session. So we will also create a “CloseConnection” Convertigo Transaction, with its “HTTP Header” property set like below : Content-Type: application/x-www-form-urlencoded Connection : close


header

Authentication response

Last part of the process, we will create a Sequence in order to always close any existing connection between Sharepoint and Convertigo in order to ensure true authentication.


Sequence

Conclusion

In conclusion, Convertigo Mobility Platform gives lots of flexibility to set many parameters of the http protocol via the Expert property panel of the HTTP Connector. Enjoy testing this sample and we hope to see you on the Forum to share with us your feedbacks.

Leave a comment