summaryrefslogtreecommitdiff
path: root/roundcubemail/plugins/http_authentication
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-04-19 17:44:29 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-04-19 17:44:29 +0000
commitc4185d03cfb5c4e9df4c004b2c13a9b3c3196eac (patch)
tree4f7ca23360a62cf181bb23a0f2264d69481cac03 /roundcubemail/plugins/http_authentication
parent137ee56eda15ecccb6a619a906ac532fc5d6c042 (diff)
Merged branch devel-api (from r2208 to r2387) back into trunk (omitting some sample plugins)
git-svn-id: https://svn.roundcube.net/trunk@2401 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/plugins/http_authentication')
-rw-r--r--roundcubemail/plugins/http_authentication/http_authentication.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/roundcubemail/plugins/http_authentication/http_authentication.php b/roundcubemail/plugins/http_authentication/http_authentication.php
new file mode 100644
index 000000000..57422a74d
--- /dev/null
+++ b/roundcubemail/plugins/http_authentication/http_authentication.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * HTTP Basic Authentication
+ *
+ * Make use of an existing HTTP authentication and perform login with the existing user credentials
+ *
+ * @version 1.0
+ * @author Thomas Bruederli
+ */
+class http_authentication extends rcube_plugin
+{
+
+ function init()
+ {
+ $this->add_hook('startup', array($this, 'startup'));
+ $this->add_hook('authenticate', array($this, 'authenticate'));
+ }
+
+ function startup($args)
+ {
+ // change action to login
+ if ($args['task'] == 'mail' && empty($args['action']) && empty($_SESSION['user_id'])
+ && !empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW']))
+ $args['action'] = 'login';
+
+ return $args;
+ }
+
+ function authenticate($args)
+ {
+ if (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) {
+ $args['user'] = $_SERVER['PHP_AUTH_USER'];
+ $args['pass'] = $_SERVER['PHP_AUTH_PW'];
+ }
+
+ return $args;
+ }
+
+}
+