Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using NTLM authentication in Java applications

I want to use Windows NTLM authentication in my Java application to authenticate intranet users transparently. The users should not notice any authentication if using their browsers (single sign-on).

I've found a few libs with NTLM support, but don't know which one to use:

  • http://spnego.sourceforge.net/
  • http://sourceforge.net/projects/ntlmv2auth/
  • http://jcifs.samba.org/
  • http://www.ioplex.com/jespa.html
  • http://www.luigidragone.com/software/ntlm-authentication-in-java/

Any suggestions where to start?

like image 918
deamon Avatar asked Feb 22 '13 09:02

deamon


People also ask

What is NTLM authentication in Java?

NTLM is a proprietary protocol employed by many Microsoft products to perform challenge response authentication and it is the default authentication scheme used by Microsoft firewall and proxy server products.

What applications use NTLM authentication?

Applications That Use NTLM For example, computers still running Windows 95, Windows 98, or Windows NT 4.0 will use the NTLM protocol for network authentication with a Windows 2000 domain.

Should I use NTLM or Kerberos?

Kerberos provides several advantages over NTLM: - More secure: No password stored locally or sent over the net. - Best performance: improved performance over NTLM authentication. - Delegation support: Servers can impersonate clients and use the client's security context to access a resource.


1 Answers

Out of the above list, only ntlmv2-auth and Jespa support NTLMv2. Jespa is workable but commercial. ntlmv2-auth I haven't tried but it's based on the code from Liferay, which I've seen working before.

'ntlm-authentication-in-java' is only NTLMv1, which is old, insecure, and works in a dwindling number of environments as people upgrade to newer Windows versions. JCIFS used to have an NTLMv1 HTTP auth filter, but it was removed in later versions, as the way it was implemented amounts to a man-in-the-middle attack on the insecure protocol. (The same appears to be true of 'ntlm-authentication-in-java'.)

The 'spnego' project is Kerberos not NTLM. If you want to replicate full IWA as IIS does it, you'd need to support both NTLMv2 and Kerberos ('NTLM' auth, 'Negotiate' auth, NTLMSSP-in-SPNego auth and NTLM-masquerading-as-Negotiate auth).

like image 175
bobince Avatar answered Sep 19 '22 13:09

bobince