Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

J2EE - Intranet application - Automatically get WINDOWS User Id

 
Venkataramanan Amirthalingam
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
Chris Paulraj
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic