[horde] Horde / IMP preauthenticate hook

maxime maxime at frequence-ecoles.net
Tue Jun 7 10:22:29 UTC 2011


Hello,
First thank you for all the great work that you are doing.

My usernames are like "user" in the horde_users table
and i want to authenticate with the imap server with username like :
user at domaine.tld
It was running well with IMP 5.0.1 and the preauthenticate hook from
imp/config/hooks.php :

<code>
public function preauthenticate($userId, $credentials)
{
   $credentials['server'] = 'imap';
   $credentials['transparent'] = true;
   if (!substr_count($userId, '@')) {
       $userId = $userId.'@dompaine.tld';
   }
   $result['userId'] = $userId;
   $result['credentials'] = $credentials;

   return $result;
}
</code>

After upgrading to IMP 5.0.5 this don't work any more.
If i login to horde i have usernale like "user at domaine.tld" for horde
too (so i'am not the same user).

I have to write another hook in horde/config/hooks.php like this to
strip the '@domaine.tld' from thez horde username :

<code>
public function authusername($userId, $toHorde)
{
    if (substr_count($userId, '@')) {
        $parts = explode('@',$userId);
        $userId = $parts[0];
    }
    return $userId;
}
</code>

So now it only works with the 2 hooks.
Is it a normal beaviour ?

-- 
Maxime Chavagne
maxime at frequence-ecoles.org

Fréquence écoles
8, rue Chaponnay
69003 Lyon
04 72 98 38 32

Et plus d'infos sur notre site : www.frequence-ecoles.org



More information about the horde mailing list