简体   繁体   中英

request.getRemoteUser() gives null after successful ldap authentication

I had a working application which fetches the username after ldap authentication using request.getRemoteUser() in apache httpd.

Authentication is working because the redirection is happening to a backend tomcat server where application is hosted.But i am not able to get the username using request.getRemoteUser()

But after applying some sshd ciphers. The code is giving null as result.

I want to know what exactly has happened and how to bring changes to sshd so that my code will work like before.

NOTE: I noticed that some ports are also not working. But i am least concered about that. x11 something is also applied in the server. I am not sure.

Found the exact issue after a long day.

The problem is that I had to shutdown ajp port. So when ajp port is closed, request.getRemoteUser() gives null because the headers are not passed to http port.

We have to manually add headers for it In the httpd configuration add these lines to add a header.

RewriteEngine On RewriteRule ^ - [E=MY_REMOTE_USER:%{LA-U:REMOTE_USER}] RequestHeader set X-Proxy-USER %{MY_REMOTE_USER}e

You can get the username in the application using request.getHeader("X-Proxy-USER")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM