Login Name and Apache

Folks,

I use Apache to access my Tamino application. Now I would like to get the current username from within my Java application. What statement do I have to use to get the name of the current logged in user?

Harald

You can send me a message to Harald.Kirschner@valuerisk.com

Hello Harald,

can you give me a little more information? Where is your java application running? In a servlet/not in a servlet? Which user do you mean? User logged in to the OS? If you are in a servlet, the user authenticated by the servlet engine? or the user send to Tamino as part of the http request or passed throught the Tamino Java API?

regards Eckehard

I will use a servlet which will be called from a JSP. Of cource we are using Apache as our webserver with BASIC authentification. So a user has to enter login and password. Now I want to use this username within my JSP or HTML page. How can I do that?

Harald

quote:
Originally posted by Eckehard:
Hello Harald,

can you give me a little more information? Where is your java application running? In a servlet/not in a servlet? Which user do you mean? User logged in to the OS? If you are in a servlet, the user authenticated by the servlet engine? or the user send to Tamino as part of the http request or passed throught the Tamino Java API?

regards Eckehard


Hello Harald,

if you are using a webserver and a servlet engine I would do the authentication by the servlet engine (I didn’t tried it in the opposed way). In this case, the servlet container creates an HttpServletRequest object and passes it as an argument of the servlet’s service methods (doGet, doPost). The HttpServletRequest contains a method getUserPrincipal that returns a java.security.Principal object containing the name of the current authenticated user. If the user has not been authenticated, the method returns null.

hope it helps
Eckehard

Eckehard,

thanks. This will help.

Harald