[imp] Dynamically selecting an IMAP server for authentication in IMP5

Michael M Slusarz slusarz at horde.org
Wed Feb 1 20:19:04 UTC 2012


Quoting Arminas <g.arminas at gmail.com>:

> Hi,
>
> We're using imap servers for an authentication. I'm trying to implement
> automatic imap server selection/detection for authentication, but I wasn't
> able to find any tutorial about it for IMP5. An article in
> http://wiki.horde.org/ImapSelect seems like is "out of date". So I have
> some questions:
>
> Which application should alter authentication server's string to the right
> one - weather the preauthenticate function must be defined in
> horde/config/hooks.php, or in horde/imp/config/hooks.php?

It depends on if you are using IMAP authentication (Horde) or IMP  
application authentication (IMP).  If your primary usage of the Horde  
installation is IMP, you should ALWAYS be using IMP application  
authentication.

> If IMP app should
> handle this, then what must be done to call this hook function? If I define
> simple function
>       public function preauthenticate($userId, $credentials) { return
> false; }
> in imp/config/hooks.php, I can see it is never called.

No, that should cause any IMP authentication to fail.  Which I can  
verify happens.

> Which variables must be set so IMP can know where to try to authenticate?
> Probably this piece of code won't do the work:
>  // Set IMAP server values.
>          foreach (array('server', 'folders', 'namespace') as $key) {
>              $_SESSION['imp'][$key] = $servers[$server[0]][$key];
>          }

No.  This won't work with IMP 5.  The comments in imp/config/hooks.php  
clearly explain that you need to set the 'server' parameter in the  
preauthenticate hook.

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the imp mailing list