From f7f0624c07eb4e13a0e777f1f0a0fe740463538e Mon Sep 17 00:00:00 2001 From: thomasb Date: Mon, 25 Oct 2010 17:32:58 +0000 Subject: Work-in-progress Kolab address book plugin git-svn-id: https://svn.roundcube.net/trunk@4134 208e9e7b-5314-0410-a742-e7e81cd9613c --- plugins/kolab_addressbook/lib/rcube_kolab.php | 39 ++++++++++++++++++++------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'plugins/kolab_addressbook/lib') diff --git a/plugins/kolab_addressbook/lib/rcube_kolab.php b/plugins/kolab_addressbook/lib/rcube_kolab.php index e3588f8f5..44c37a68f 100644 --- a/plugins/kolab_addressbook/lib/rcube_kolab.php +++ b/plugins/kolab_addressbook/lib/rcube_kolab.php @@ -1,5 +1,11 @@ imap_init(); - - // get some config settings for the IMAP connection - $imap_auth_method = $rcmail->config->get('imap_auth_type', 'check'); - $imap_delimiter = isset($_SESSION['imap_delimiter']) ? $_SESSION['imap_delimiter'] : $rcmail->config->get('imap_delimiter'); - - // this is how we get the current IMAP authentication credentials: - // $_SESSION['imap_host'], $_SESSION['username'], $rcmail->decrypt($_SESSION['password']), $_SESSION['imap_port'], $_SESSION['imap_ssl'] + // load ldap credentials from local config + $conf['kolab'] = $rcmail->config->get('kolab'); + $conf['kolab']['ldap']['server'] = 'ldap://' . $_SESSION['imap_host'] . ':389'; + $conf['kolab']['imap']['server'] = $_SESSION['imap_host']; + $conf['kolab']['imap']['port'] = $_SESSION['imap_port']; + // pass the current IMAP authentication credentials to the Horde auth system + self::$horde_auth = Auth::singleton('kolab'); + if (self::$horde_auth->authenticate($_SESSION['username'], array('password' => ($pwd = $rcmail->decrypt($_SESSION['password']))), false)) { + $_SESSION['__auth'] = array( + 'authenticated' => true, + 'userId' => $_SESSION['username'], + 'timestamp' => time(), + 'remote_addr' => $_SERVER['REMOTE_ADDR'], + ); + Auth::setCredential('password', $pwd); + } } -- cgit v1.2.3