Search code examples
javajbossproxyldapjava-ee-6

Access User of Proxy in HttpServletRequest


I need to acess the name of the user of the Proxy, our server is Jboss6.4, when this user enter in my URL, I'm using ServletRequestListener, with the object HttpServletRequest, but I can't find the user.

String user1= request.getUserPrincipal().getName();

String user2 = request.getRemoteUser();

Both's are null, I need to do authentication without use a typical modal window or formular, I want to do this automatic, my idea it's use the LogonId of the User that he use in the Proxyof the browser and afterwards check in my LDAP directory if exist and the rights are correct.

To acess to the URL, the user first has to login in the browser because we have a proxy, my idea is take the id of the user from the proxy, but Ican't find it..


Solution

  • Unless your proxy is setting a header containing the username in the forwarded HTTP requests, you won't have the ability to retrieve the username used to connect to the proxy.

    What you want to achieve looks like SSO but a simple proxy won't achieve SSO.