request.getRemoteuser()在成功的LDAP身份验证后给出零

发布于 2025-02-02 00:29:44 字数 305 浏览 3 评论 0原文

我有一个工作应用程序,该应用程序在apache httpd中使用request.getRemoteuser()在LDAP身份验证后获取用户名。

身份验证之所以有效,是因为重定向发生在托管应用程序的后端Tomcat服务器上。但是我无法使用request.getRemoteuser()获得用户名,

但是在应用了一些SSHD密码之后。该代码结果为null。

我想知道到底发生了什么以及如何为SSHD带来更改,以便我的代码像以前一样工作。

注意:我注意到某些端口也无法正常工作。但是我对此最不受欢迎。 X11在服务器中也应用了某些东西。我不知道。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野鹿林 2025-02-09 00:29:44

漫长的一天后发现了确切的问题。

问题是我必须关闭AJP端口。因此,当关闭AJP端口时,请求。getRemoteuser()给出null,因为标题未传递给HTTP端口。

我们必须手动添加标题
在HTTPD配置中,添加这些行以添加标头。

重新创新
重写 ^ - [e = my_remote_user:%{la -u:remote_user}]
requestHeader集X-Proxy-user%{my_remote_user} e

您可以使用应用程序中的用户名。
request.getheader(“ x-proxy-user”)

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")

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文