【问题标题】:How to use PHP to authenticate against a remote Microsoft Exchange 2010如何使用 PHP 对远程 Microsoft Exchange 2010 进行身份验证
【发布时间】:2012-01-12 19:46:43
【问题描述】:

像往常一样,这是来自高层管理人员的奇怪且不可协商的要求。 无论如何,故事如下:

  • 我将在位置 A 建立一个网站,比如说英国(使用 CentOS、PHP、Apache)
  • 上面有一个登录表单,用户可以输入他们的 Exchange 2010 用户名(电子邮件)和密码登录。 Exchange 2010 位于位置 B,假设是美国。

所以简而言之,我如何通过远程 Exchange 2010 进行身份验证?

向我提出了一些建议,但我什至不确定这是否可以首先完成......

  • 我们可以利用 Exchange 2010 的 OWA 吗?
  • 我们可以使用 ActiveSync 吗?
  • 我们可以使用 EWS 吗? (交换网络服务)

我不熟悉微软的相关技术,所以我的问题是我可以在其中进行身份验证的网络服务方法或类似方法吗?

最好的问候

【问题讨论】:

    标签: php authentication exchange-server exchangewebservices outlook-web-app


    【解决方案1】:

    您可能是指针对集成了 Exchange 服务器的 Active Directory 进行身份验证。然后您可以使用 LDAP:

    Authenticating in PHP using LDAP through Active Directory

    【讨论】:

    • 感谢您的信息 :) 我提到了 LDAP,但它需要我们设置和部署 LDAP,因此提到了 Exchange,看看我们是否可以利用它。例如,ActiveSync? OWA?
    【解决方案2】:

    我会查看 Source Forge 上的 adLDAP 库。给我发电子邮件,我会将我的文档发送给您,设置大约需要 20 分钟,您只需要 MS Active Directory,您不需要 LDAP。 KWSoutherlandJr 在 yahoo dot com。

    adLDAP.courceforge.net

    【讨论】:

      【解决方案3】:

      是的,您可以使用 Exchange Web 服务来执行此操作,我推荐使用托管 API。在这里下载:http://www.microsoft.com/download/en/details.aspx?id=13480,文档在这里:http://msdn.microsoft.com/en-us/library/dd633710%28EXCHG.80%29.aspx

      这里是你如何做到的。首先包括正确的命名空间:

      // use the exchange library:
      
      using System.Security.Cryptography.X509Certificates;
      using Microsoft.Exchange.WebServices.Data;
      

      然后写一些类似这样的代码:

      ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
      
      // If you've got a dodgy SSL cert on your exchange box then do this:
      
      System.Net.ServicePointManager.ServerCertificateValidationCallback =
          delegate(
              Object obj,
              X509Certificate certificate,
              X509Chain chain,
              SslPolicyErrors errors)
          {
              return true;
          };
      
      service.Credentials = new WebCredentials(Username, Password, domain);
      
      service.Url = new Uri(url);
      
      // this will fail if the username+password are incorrect:
      
      Folder.Bind(service, WellKnownFolderName.MsgFolderRoot);
      

      【讨论】:

      • 哎呀,意识到你希望用 PHP 来做,如果你需要帮助翻译这个,请告诉我。
      • 谢谢 :) 我找到了一个使用 NetworkCredentials/NTLM 的 PHP 版本。但不确定如何在 PHP 中使用 WebCredentials 进行操作? (它使用电子邮件作为用户名)
      【解决方案4】:

      你可以试试 EWSWrapper - http://ewswrapper.lafiel.net/ 它是 Exchange Web 服务的 PHP 包装器。它将让您了解如何使用 Ex Server 进行身份验证以及使用 EWS 可以做什么。 Python 版本具有更好的身份验证,因为它循环通过各种身份验证方法。

      另外,你可以看看@这个:Access Exchange Web Services with PHP and cURL

      干杯~

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-09-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-01-04
        相关资源
        最近更新 更多