From 48e9c14ebded89d858c8be0333f77f77a81b0877 Mon Sep 17 00:00:00 2001 From: thomascube Date: Sat, 31 Mar 2012 12:25:48 +0000 Subject: Move plugins repository into roundcubemail root folder; svn:externals are not defined anymore --- .../http_authentication/http_authentication.php | 67 ++++++++++++++++++++++ plugins/http_authentication/logout.html | 29 ++++++++++ plugins/http_authentication/package.xml | 48 ++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 plugins/http_authentication/http_authentication.php create mode 100644 plugins/http_authentication/logout.html create mode 100644 plugins/http_authentication/package.xml (limited to 'plugins/http_authentication') diff --git a/plugins/http_authentication/http_authentication.php b/plugins/http_authentication/http_authentication.php new file mode 100644 index 000000000..6c873713e --- /dev/null +++ b/plugins/http_authentication/http_authentication.php @@ -0,0 +1,67 @@ +add_hook('startup', array($this, 'startup')); + $this->add_hook('authenticate', array($this, 'authenticate')); + $this->add_hook('logout_after', array($this, 'logout')); + } + + function startup($args) + { + // change action to login + if (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) + { + // Allow entering other user data in login form, + // e.g. after log out (#1487953) + if (!empty($args['user'])) { + return $args; + } + + if (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) { + $args['user'] = $_SERVER['PHP_AUTH_USER']; + $args['pass'] = $_SERVER['PHP_AUTH_PW']; + } + + $args['cookiecheck'] = false; + $args['valid'] = true; + + return $args; + } + + function logout($args) + { + // redirect to configured URL in order to clear HTTP auth credentials + if (!empty($_SERVER['PHP_AUTH_USER']) && $args['user'] == $_SERVER['PHP_AUTH_USER'] && ($url = rcmail::get_instance()->config->get('logout_url'))) { + header("Location: $url", true, 307); + } + } + +} + diff --git a/plugins/http_authentication/logout.html b/plugins/http_authentication/logout.html new file mode 100644 index 000000000..0a78a62f2 --- /dev/null +++ b/plugins/http_authentication/logout.html @@ -0,0 +1,29 @@ + + + + +Logout + + + + +

You've successully been logged out!

+ + \ No newline at end of file diff --git a/plugins/http_authentication/package.xml b/plugins/http_authentication/package.xml new file mode 100644 index 000000000..d8f2036b6 --- /dev/null +++ b/plugins/http_authentication/package.xml @@ -0,0 +1,48 @@ + + + http_authentication + pear.roundcube.net + HTTP Basic Authentication + Make use of an existing HTTP authentication and perform login with the existing user credentials. + + Thomas Bruederli + thomasb + roundcube@gmail.com + yes + + 2011-11-21 + + 1.4 + 1.4 + + + stable + stable + + GNU GPLv3+ + - + + + + + + + + + + + + + + 5.2.1 + + + 1.7.0 + + + + + -- cgit v1.2.3