Thanks! Unfortunately my application is running in Weblogic Server on
Solaris. I agree you can use the getRemoteUser () if the user is already
authenticated. In my case just I need to get the NT Username and domain from
the client machine..I found some sample code from the internet after so many
searches...HOPE IT MAY HELP OTHERS!!
I don't know if there will be any performance issue....Please let me know if
any body knows more about this
<%
String auth = request.getHeader("Authorization");
out.println("Header :: :"+auth+"<BR>");
if (auth == null)
{
response.setStatus(response.SC_UNAUTHORIZED);
response.setHeader("WWW-Authenticate", "NTLM");
response.flushBuffer();
return;
}
if (auth.startsWith("NTLM "))
{
byte[] msg = new sun.misc.BASE64Decoder().decodeBuffer(auth.substring(5));
out.println("Message :: :"+msg+"<BR>");
int off = 0, length, offset;
if (msg[8] == 1)
{
byte z = 0;
byte[] msg1 = {(byte)'N', (byte)'T', (byte)'L', (byte)'M', (byte)'S',
(byte)'S', (byte)'P', z,(byte)2, z, z, z, z, z, z, z,(byte)40, z, z, z,
(byte)1, (byte)130, z, z,z, (byte)2, (byte)2, (byte)2, z, z, z, z, z, z, z,
z, z, z, z, z};
response.setHeader("WWW-Authenticate", "NTLM " + new
sun.misc.BASE64Encoder().encodeBuffer(msg1));
response.sendError(response.SC_UNAUTHORIZED);
return;
}
else if (msg[8] == 3)
{
off = 30;
length = msg[off+17]*256 + msg[off+16];
offset = msg[off+19]*256 + msg[off+18];
String remoteHost = new String(msg, offset, length);
length = msg[off+1]*256 + msg[off];
offset = msg[off+3]*256 + msg[off+2];
String domain = new String(msg, offset, length);
length = msg[off+9]*256 + msg[off+8];
offset = msg[off+11]*256 + msg[off+10];
String username = new String(msg, offset, length);
out.println("Username:"+username+"<BR>");
out.println("RemoteHost:"+remoteHost+"<BR>");
out.println("Domain:"+domain+"<BR>");
}
}
%>
-Manju
-----Original Message-----
From: Dave Weis [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 5:05 PM
To: Struts Users Mailing List
Subject: RE: Help!! Getting NT User
if you are using iis in front of your servlet engine you can require ntlm
authentication. then you can probably use getRemoteUser().
dave
> > Thanks for the reply! But it will not give the NT User information. It
> > returns null.
> >
> > -Manju
> >
> > -----Original Message-----
> > From: Robert Taylor [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 29, 2003 4:40 PM
> > To: Struts Users Mailing List
> > Subject: RE: Help!! Getting NT User
> >
> >
> > HttpServletRequest.getRemoteUser() (I think)
> >
> > robert
> >
> > > Hello,
> > > Is there any easy way to get client's NT User from JSP/Servlet
> > > without using JAAS? My requirement: Once the user access
> > the application
> > > URL, I want to get the use profile based on NT User
> > name(Assuming that the
> > > user already authenticated by the NT domain).
--
Dave Weis "I believe there are more instances of the abridgment
[EMAIL PROTECTED] of the freedom of the people by gradual and silent
encroachments of those in power than by violent
and sudden usurpations."- James Madison
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]