通过用户名和从 PHP 到 Apache 的密码
我有一个登录表单,用户可以使用两个不同的帐户登录 - 一个是 SolarisLDAP 帐户,另一个是 Active Directory 帐户。 当用户尝试登录时,我想找出他使用哪个帐户(这不是问题)。
如果他使用 SolarisLDAP 帐户,则身份验证是在 PHP 中完成的。 但如果它是 AD 帐户,则必须将其传递给 Apache(因为我必须使用 mod_auth_kerb 对我们的 AD 进行身份验证)。
我想知道这是否有可能以任何方式实现。我可以设置 $_SERVER['PHP_AUTH_USER']
和 $_SERVER['PHP_AUTH_PW']
或 $_SERVER['REMOTE_USER']
,就是这样?
或者是否有可能通过标头或重定向来做到这一点?
希望你明白我想做什么..
干杯
I have a loginform where users can login with two different accounts - one is a SolarisLDAP account and the other is an Active Directory account.
When the user tries to log in I want to find out which account he uses (which is not the problem).
If he's using the SolarisLDAP account, the authentication is done in PHP.
But if it is an AD account it must be passed to Apache (because I have to use the mod_auth_kerb to authenticate against our AD).
I wonder if this is possible in any way. Could I just set $_SERVER['PHP_AUTH_USER']
and $_SERVER['PHP_AUTH_PW']
, or $_SERVER['REMOTE_USER']
, and that's it?
Or would it be a possibility to kinda do it via the headers or a redirect?
Hope you understand what I'm trying to do..
Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是——没有。
另请注意,在这种情况下,将任何变量从 PHP 传递到 Apache 都是没有意义的。
您想要使用 Apache 进行身份验证的不是 PHP,而是浏览器,而且显然您无法控制。
Unfortunately - no.
Also note that passing whatever variables from PHP to Apache makes no sense in that context.
It is not PHP but browser you want to authenticate with Apache, and, obviously, you have no control of.
这取决于 apache 为请求设置的环境变量。执行 a
获取所有可用的列表。浏览该列表并找出哪些与身份验证相关。这可能是非标准的,这是一个一般列表: http://php.net/_SERVER,比较一下与您的
var_dump
输出。此外,这可能取决于您使用的服务器 API (SAPI) PHP文档。
This depends on which environment variables apache does set for the request. Do a
to get a list of all available ones. Go through that list and find out which ones are related to the authentication. It's probably something non-standard, this is a general list: http://php.net/_SERVER, compare it with your
var_dump
output.Also this might depend on which Server-API (SAPI) you're using with PHPDocs.