Via Lattanzio,23 Milano
+39 02 36592025
info@synaptica.info

Java code for NTLM User Identification

Java code for NTLM User Identification

The following code perfrom NTLM Identification (NOT authentication) of a Windows user connecting to a Java Web app.
This will happen automatically only using IE as the client. With Firefox for example the username will be asked through pop-up, and then used by the web-app (again, this code doesn’t perform authentication…)

The original code come from jGuru

My little contribute is the following

    first of all telling that i’ve tested this code and it works (Tomcat 6, IE 6)
    second, i changed the lines like String username = new String(msg, offset, length); to
    String username = new String(msg, offset, length,"UTF-16LE"); to remove blank spaces from the useful strings
    clarify that this is only needs for identificating the user, do not use in a secure environment. If you need authenticating take a look to jCifs project

Tags: , , ,

Lascia un commento