Archive for September, 2010

WebClient with NTLM and SPNEGO authentication

September 17, 2010

A post on the Squeak mailing list made me reevaluate how difficult it would be to add NTLM and SPNEGO support to WebClient. Since I had done this at work before (via a plugin interface to support both Windows and Mac transparently) I figured it would be straightforward to implement it using the Squeak FFI interface. And indeed it is. The code is pretty small and a reasonable example on how to use the FFI to access the Microsoft SSP interface.

To try out NTLM authentication in WebClient, you first need to install the FFI (the latest version since I’m using a feature I only just added):

(Installer repository: 'http://source.squeak.org/FFI')
    install: 'FFI-Pools';
    install: 'FFI-Kernel';
    install: 'FFI-Tests'. 

Once the FFI is installed, load the WebClient-SSP package:

(Installer repository: 'http://squeaksource.com/WebClient')
    install: 'WebClient-SSP'. 

The WebClient-SSP package includes class WebClientSSP which provides support for NTLM and SPNEGO. You can use it with explicit authentication like here:

(WebClientSSP new)
	username: 'DOMAIN\username';
	password: 'password';
	httpGet: 'http://your.domain.com/'.

or you can fire off WebClientSSP without credentials and let it use SSO or ask you for credentials.