autologin based on redirect.php

Liam Hoekenga liamr@umich.edu
Thu, 11 Apr 2002 10:46:26 -0400


We currently handle logging in using a form based on redirect.php, as we don't
want our users to see a seperate IMP login screen (we have our own
authentication software that sets REMOTE_USER, so we want them to use *that*
user name, and our mailservers use krb4 authentication, so we don't want them
asked for a password).

In any event, this works fine for Horde 2.0 / IMP 3.0.

I'm playing around with RC2, and I'm having some problems.

Currently, our login script looks like:


--- redirect.php        Sat Apr  6 11:19:17 2002
+++ UMlogin.php Thu Apr 11 10:37:32 2002
@@ -19,4 +19,19 @@
 }
 
+if (!isset($HTTP_POST_VARS['imapuser'])) {
+    $HTTP_POST_VARS['imapuser'] = $GLOBALS['HTTP_SERVER_VARS']['REMOTE_USER'];
+    $HTTP_POST_VARS['pass'] = 'cheese';
+    $HTTP_POST_VARS['mailbox'] = 'INBOX';
+    $HTTP_POST_VARS['server'] =
+            substr ($GLOBALS['HTTP_SERVER_VARS']['REMOTE_USER'],0,1) .
+            '.imap.itd.umich.edu';
+    $HTTP_POST_VARS['port'] = '143';
+    $HTTP_POST_VARS['namespace'] = '';
+    $HTTP_POST_VARS['maildomain'] = 'umich.edu';
+    $HTTP_POST_VARS['protocol'] = 'imap';
+    $HTTP_POST_VARS['folders'] = 'mail/';
+    $HTTP_POST_VARS['button'] = 'Log+in';
+    }
+
 $imapuser = Horde::getFormData('imapuser');
 $pass = Horde::getFormData('pass');


As it turns out, we made need to support IMAP servers other than the ones we
run.  So, I'm trying to play with the servers.php - since I'd prefer to use the
"prefered" mechanism, instead of having to have a bunch of SERVER_NAME based
conditionals in our login script.  I was hoping that maybe I could just force
the username and password, and let servers.php fill the rest of the stuff in. 
Alas, that doesn't work.  I get a bunch of

xxx.xxx.xxx.xxx - liamr [11/Apr/2002:10:30:53 -0400] "GET
/horde/imp/login.php?1=1&imapuser=liamr&reason=failed HTTP/1.0" 302 0 "-"
"Mozilla/4.76 [en] (X11; U; SunOS 5.8 sun4u; Nav)"


if I don't post *all* of the above - which would mean using some

   if ( $GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME'] == 'blah' ) {
   }

blocks if I want to support additional servers..

Is this possible?

Liam

Is it possible to