[imp] Login in with e-mail alias (was: Server select)

Otto Stolz Otto.Stolz at uni-konstanz.de
Wed Jan 24 11:25:35 PST 2007


Hello Markus Braun,

you wrote:
> we had a webhosting provider, which has 
> user accounts with numbers. At the moment i cant login with my full 
> email adress. I must typ e.g. 384753 and then the password.

We have a similar setup here, so my approach may be an example
you could start from.

- I have configured Horde and Imp so that login is only possible
   via the Imp login page.

- In the Imp login page, I provide a selection of IMAP servers
   (no free input possible).

- Now, every IMAP server in our shop has an LDAP server associated
   with it, and you can get the pertinent IMAP user-id (the "mailbox")
   from that LDAP server, if you know the e-mail addresss.
   Hence, I provide in imp/config/servers.php a mapping from the
   possible IMAP servers to the pertinent LDAP servers. I do this
   by adding the following fields to each IMAP server definition:
   · 'LDAP-host'   => pertinent LDAP server
   · 'LDAP-port'   => pertinent port nummer
   · 'LDAP-base'   => pertinent search base
   · 'LDAP-fields' => Array describing possible search arguments:
                      'cn'   => Name of common-name field
                      'uid'  => Name of mailbox field
                      'mail' => Name of e-mail-address field
   · 'LDAP-code'   => Encoding for both queries and results

- In horde/config/hooks.php, I have provided several custom hooks
   that use these fields, in particular (but in no particular order):

   · string function _prefs_hook_from_addr ([string $name]) and
     string function _prefs_hook_fullname(string $user)
     yields the user's e-mail address and common name, respectively;
     these are used, e. g., for the From field during message composition;
     note that these functions are invoked with an empty argument in 80%
     of all cases, and then they should return immediately, and
     their result will not be used.

   · string function _username_hook_frombackend(string $userID) and
     string function _username_hook_tobackend(string $uid):
     convert an LDAP user id to an unambiguous Horde username
     (e. g. to index the users' preferencies), and vice versa;
     actually, I use the e-mail address as Horde username,
     because it is unambiguous and readily available.

   · string function _imp_hook_vinfo ([string $type])
     must fit in an extremly weird interface:
     _imp_hook_vinfo('vdomain') yields the 'maildomain' field
     of the currently selected IMAP server's definition
     (cf. imp/config/servers.php);
     _imp_hook_vinfo('username') yields the Horde username
     discussed above;
     this function can not rely on the usual Horde, or Imp,
     methods and variables, rather, it must pull its input data
     from the login mask, which will mostly use POST, but GET,
     in a particular case.

   To avoid unneccessary LDAP requests, these functions store the
   server, and user, information in the session data, and update it
   only on the 1st invocation of any one of them (not counting the
   80% invocations of _prefs_hook_from_addr and _prefs_hook_fullname
   with empty arguments).

This should be enough to understand the configuration, in principle.
I fear I do not have the time to elaborate this in more detail. If you
can read German, you can have my comprehensive internal documentation
(covering also other aspects of my installation), and the source code
of my hooks, to start from.

Good luck,
   Otto Stolz



More information about the imp mailing list