[horde] how to determine horde username from a different app
Uttiya Chowdhury
chowdhury_uttiya at yahoo.com
Thu Oct 18 04:12:46 UTC 2012
> See http://wiki.horde.org/Doc/Dev/LegacyApps
> though that's still for Horde 3.
Thanks! That link, followed by some more reading got me there. I used the following code to implement SSO single-sign-on in Wordpress using horde authentication. This needed the use of two wordpress plugins:
* restricted-site-access (to prevent Wordpress to give access without login)
* http-authentication (use external login mechanism)
Then the code below was used in the http-authentication.php to determine if anybody is logged-in and the value of username/e-mail/
Tested using unreleased H5.
==
define('HORDE_BASE',__DIR__ . '/path/to/horde');
/* Horde determine username */
require_once HORDE_BASE . '/lib/core.php';
Horde_Registry::appInit('horde', array('authentication' => 'none', 'nologintasks' => true));
$injector=$GLOBALS['injector'];
$identity=$injector->getInstance('Horde_Core_Factory_Identity')->create();
global $horde_username;
$horde_username=$identity->getDefaultFromAddress();
function hordeuser()
{
global $horde_username;
return $horde_username;
}
==
More information about the horde
mailing list