Get windows username using JAVA or JSP [closed]

Getting the name of the user logged into your web application (which I think is what you want to do, based on your comments) entirely depends on how you have implemented authentication in your system. However, if your login mechanism adds this information, the username might be available in request.getRemoteUser() or request.getUserPrincipal(). But as mentioned, it all depends. Your authentication mechanism might expose this otherwise, but then we would need more information to assist.

System.getProperty("user.name") will only give you the username of the user running the java process.

Leave a Comment