File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Security and the fly likes J2EE - Intranet application - Automatically get WINDOWS User Id Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "J2EE - Intranet application - Automatically get WINDOWS User Id" Watch "J2EE - Intranet application - Automatically get WINDOWS User Id" New topic
Author

J2EE - Intranet application - Automatically get WINDOWS User Id

Venkataramanan Amirthalingam
Greenhorn

Joined: Nov 27, 2008
Posts: 20
We are developing a intranet site based on J2EE techs. The requirement is, as soon as the user logs into intranet application, we should be able to show his/her windows network user id.

For. e.g Assuming, mylibrary is developed in J2EE, as soon as we click http://mylibrary, it should display the logged in windows user id.

Kindly assist.

--venkat
raj sekar
Ranch Hand

Joined: Mar 11, 2002
Posts: 79
Hi Venkat,
You have to configure your web application to use integrated windows Authentication. Setting in the IIS and use servlet api to get the user info and display in the web page.

and then try this
<html><body>
<p>
<b>Information about request:</b><br/>
<%

out.println("Auth Type: "+request.getAuthType()+"<br/>");
out.println("Remote User: "+request.getRemoteUser()+"<br/>");
out.println("Requested Session ID: "+request.getRequestedSessionId()
+"<br/>");
out.println("Headers:<br/>");
java.util.Enumeration e = request.getHeaderNames();
while (e.hasMoreElements()) {
String n = (String) e.nextElement();
out.println("   "+n+": "+request.getHeader(n)+"<br/>");
}
%>
</p>
</body></html>

Thanks,
RajN - (SCJP,SCWCD,SCBCD,SCSA,IBM XML 142 )
http://www.geocities.com/n_rajasekar/index.html
You do what you love, love what you do and always deliver more than you promise
Chris Paulraj
Greenhorn

Joined: Oct 14, 2007
Posts: 7
Venkat, Most of J2EE appservers support SPNEGO feature, which would pass you the client's logon credentials to J2EE application. You should be able to find the necessary configuration document, specific to your appserver.

Good Luck
Chris Paulraj
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: J2EE - Intranet application - Automatically get WINDOWS User Id