diff options
author | Jan Schumann <js@schumann-it.com> | 2012-02-20 19:51:26 +0100 |
---|---|---|
committer | Jan Schumann <js@schumann-it.com> | 2012-02-20 19:51:26 +0100 |
commit | f4476bd9b5badd36cd0617d76538e47d9649986b (patch) | |
tree | 8100a814f4ccc279694f0a77596ce498a6eb4a0c /inc/auth.php | |
parent | 396b87bebcb14765849b43a259a2b6cf2aff98f3 (diff) | |
download | rpg-f4476bd9b5badd36cd0617d76538e47d9649986b.tar.gz rpg-f4476bd9b5badd36cd0617d76538e47d9649986b.tar.bz2 |
Refactored auth system: All auth methods are now introduced as plugins.
Diffstat (limited to 'inc/auth.php')
-rw-r--r-- | inc/auth.php | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/inc/auth.php b/inc/auth.php index b11a14d50..aac7a2fca 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -45,35 +45,19 @@ function auth_setup(){ $plugins = $plugin_controller->getList('auth'); foreach ($plugin_controller->getList('auth') as $plugin) { if ($conf['authtype'] === $plugin) { - $auth = $plugin_controller->load('auth', $plugin)->getAuth(); + $auth = $plugin_controller->load('auth', $plugin); break; } } - if (!$auth) { - // load the the backend auth functions and instantiate the auth object XXX - if (@file_exists(DOKU_INC.'inc/auth/'.$conf['authtype'].'.class.php')) { - require_once(DOKU_INC.'inc/auth/basic.class.php'); - require_once(DOKU_INC.'inc/auth/'.$conf['authtype'].'.class.php'); - - $auth_class = "auth_".$conf['authtype']; - if (class_exists($auth_class)) { - $auth = new $auth_class(); - if ($auth->success == false) { - // degrade to unauthenticated user - unset($auth); - auth_logoff(); - msg($lang['authtempfail'], -1); - } - } else { - nice_die($lang['authmodfailed']); - } - } else { - nice_die($lang['authmodfailed']); - } - } + if(!$auth) return; - if(!$auth) return; + if ($auth && $auth->success == false) { + // degrade to unauthenticated user + unset($auth); + auth_logoff(); + msg($lang['authtempfail'], -1); + } // do the login either by cookie or provided credentials XXX if (!isset($_REQUEST['u'])) $_REQUEST['u'] = ''; @@ -102,7 +86,10 @@ function auth_setup(){ } // apply cleaning - $_REQUEST['u'] = $auth->cleanUser($_REQUEST['u']); + if (true === $auth->success) + { + $_REQUEST['u'] = $auth->cleanUser($_REQUEST['u']); + } if(isset($_REQUEST['authtok'])){ // when an authentication token is given, trust the session |