1

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

sbi
  • 219,715
  • 46
  • 258
  • 445
forestclown
  • 1,582
  • 4
  • 25
  • 39

4 Answers4

1

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

Community
  • 1
  • 1
rkosegi
  • 14,165
  • 5
  • 50
  • 83
  • 1
    Thanks for the info :) I have mentioned LDAP, but it requires us to setup and deploy LDAP, hence Exchange was mentioned to see if it is possible that we can leverage it. For example, ActiveSync? OWA? – forestclown Jan 04 '12 at 10:39
1

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

1

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);
Rocklan
  • 7,888
  • 3
  • 34
  • 49
  • Whoops, realised that you were hoping to do it in PHP, let me know if you need help translating this. – Rocklan Jan 12 '12 at 04:02
  • Thanks :) I found a PHP version which uses NetworkCredentials/NTLM. But not sure how to do it in PHP with WebCredentials? (Where it uses the email as username) – forestclown Jan 13 '12 at 09:41
1

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~

Community
  • 1
  • 1
Maiiku
  • 305
  • 1
  • 9