如何使用 PHP 对远程 Microsoft Exchange 2010 进行身份验证

发布于 2024-12-24 21:00:48 字数 479 浏览 4 评论 0原文

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

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

简而言之,问题是如何通过远程 Exchange 2010 进行身份验证?

有几个建议向我提出,但我什至不确定这是否可以首先完成...

  • 我们可以利用 Exchange 2010 的 OWA 吗?
  • 我们可以使用 ActiveSync 吗?
  • 我们可以使用 EWS 吗? (Exchange Web Services)

我不熟悉微软的相关技术,所以我的问题简而言之是有没有一种Web服务方法或类似的方法可以让我进行身份验证?

此致

As usual, this is a weird and non-negotiable request from top management.
Anyway, the story is as following:

  • I will build a website at location A, let say UK (Using CentOS, PHP, Apache)
  • There is a login form on it, and user can enter their Exchange 2010 username (email), and password to login. Where the Exchange 2010 is at location B, let say US.

So the issue in short is that how I can authenticate with a remote Exchange 2010?

There are several suggestions thrown at me but I am not even sure this can be done in the first place...

  • Can we leverage Exchange 2010's OWA?
  • Can we use ActiveSync?
  • Can we use EWS? (Exchange Web Services)

I am not familiar with Microsoft's related technologies, so my question in short is that is there a web service method or similar where I can do my authentication?

Best Regards

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

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

发布评论

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

评论(4

不打扰别人 2024-12-31 21:00:48

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

通过 Active Directory 使用 LDAP 在 PHP 中进行身份验证

You probably mean authenticate against Active directory in which Exchange server is integrated.Then you can use LDAP:

Authenticating in PHP using LDAP through Active Directory

演出会有结束 2024-12-31 21:00:48

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

adLDAP.courceforge.net

I would look into the adLDAP library on Source Forge. Email me and I will send you my documentation, it takes about 20 minutes to set up and all you need is MS Active Directory, you do not need LDAP. KWSoutherlandJr At yahoo dot com.

adLDAP.courceforge.net

苍白女子 2024-12-31 21:00:48

是的,您可以使用 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);

Yes, you can use Exchange Web Service to do this, I recommend the managed API's. Download here: http://www.microsoft.com/download/en/details.aspx?id=13480 , documentation is here: http://msdn.microsoft.com/en-us/library/dd633710%28EXCHG.80%29.aspx

Here how you could do it. First off include the right namespaces:

// use the exchange library:

using System.Security.Cryptography.X509Certificates;
using Microsoft.Exchange.WebServices.Data;

Then write some code similar to this:

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);
浅沫记忆 2024-12-31 21:00:48

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

另外,您可以看看@:使用 PHP 访问 Exchange Web 服务和cURL

干杯~

You can give EWSWrapper a try - http://ewswrapper.lafiel.net/
It's a PHP wrapper for Exchange Web Services. It will give you an idea how you can authenticate with Ex Server and what can be done with EWS. Python version has a bit better authentication as it cycles through various auth methods.

Also, you can take a look @ this: Access Exchange Web Services with PHP and cURL

Cheers~

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