在 php 中使用 Windows 身份验证?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2501729/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 06:43:04  来源:igfitidea点击:

Using windows authentication with php?

phpwindowsauthentication

提问by dcp3450

Scenario:

设想:

I have a area of a website that needs to be secure and accessible when offsite. I want the user to enter the username and password used to login at work in a web form. The form will send the username and password to authenticate it. If it works the user is logged in.

我有一个网站区域,需要在异地时保持安全和可访问。我希望用户在 Web 表单中输入用于登录工作的用户名和密码。该表单将发送用户名和密码以对其进行身份验证。如果它有效,则用户已登录。

I need to use a form not a pop-up login box. PHP is preferred but I'm flexible. Any ideas to point me in the right direction?

我需要使用表单而不是弹出式登录框。PHP 是首选,但我很灵活。有什么想法可以指出我正确的方向吗?



My employer has a few secure areas they have set up that uses the "pop-up box". For what I need to accomplish I need to use a web form.

我的雇主设置了一些使用“弹出框”的安全区域。对于我需要完成的工作,我需要使用网络表单。

回答by Levi Hackwith

Try LDAP

尝试 LDAP

I've written intranet web applications that use the local windows username and password to authenticate and LDAP is by far the best solution.

我编写了使用本地 Windows 用户名和密码进行身份验证的 Intranet Web 应用程序,而 LDAP 是迄今为止最好的解决方案。

回答by jpabluz

If you are using LDAP at work, go with that, if not, well you have to access it thru .NET.

如果您在工作中使用 LDAP,请使用它,否则,您必须通过 .NET 访问它。

Since there are several but not fully reliable .NET implementations for PHP, I would recommend using a WebService, which PHP would consume, that will pass the user and pass - encrypted would be nice - to it, and it will return if the credentials are valid or not.

由于 PHP 有几个但不完全可靠的 .NET 实现,我建议使用 PHP 将使用的 WebService,它将传递用户并传递 - 加密会很好 - 给它,如果凭据是,它将返回有效与否。

回答by SDGuero

You should be able to use LDAP, in your case it is most likely Windows Active Directory via IIS. There are php packages out there to interact with various types of LDAP implementations. Here is a link:
http://php.net/manual/en/book.ldap.php

您应该能够使用 LDAP,在您的情况下,它很可能是通过 IIS 的 Windows Active Directory。有一些 php 包可以与各种类型的 LDAP 实现交互。这是一个链接:http:
//php.net/manual/en/book.ldap.php

回答by kguest

use this http://pear.php.net/package/Authand tie it in to ldap authentication at the back-end. of especial interest to you would be the Auth::setShowLogin method...

使用这个http://pear.php.net/package/Auth并将其绑定到后端的 ldap 身份验证。您特别感兴趣的是 Auth::setShowLogin 方法...