4 * HTTP Basic Authentication
6 * Make use of an existing HTTP authentication and perform login with the existing user credentials
9 * @author Thomas Bruederli
11 class http_authentication extends rcube_plugin
13 public $task = 'login';
17 $this->add_hook('startup', array($this, 'startup'));
18 $this->add_hook('authenticate', array($this, 'authenticate'));
21 function startup($args)
23 // change action to login
24 if (empty($args['action']) && empty($_SESSION['user_id'])
25 && !empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW']))
26 $args['action'] = 'login';
31 function authenticate($args)
33 if (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) {
34 $args['user'] = $_SERVER['PHP_AUTH_USER'];
35 $args['pass'] = $_SERVER['PHP_AUTH_PW'];
38 $args['cookiecheck'] = false;
39 $args['valid'] = true;