コード例 #1
0
ファイル: auth.php プロジェクト: numas/dokuwiki
 /**
  * Constructor
  */
 public function __construct()
 {
     global $INPUT;
     parent::__construct();
     // ldap extension is needed
     if (!function_exists('ldap_connect')) {
         $this->_debug("LDAP err: PHP LDAP extension not found.", -1, __LINE__, __FILE__);
         $this->success = false;
         return;
     }
     // Prepare SSO
     if (!empty($_SERVER['REMOTE_USER'])) {
         // make sure the right encoding is used
         if ($this->getConf('sso_charset')) {
             $_SERVER['REMOTE_USER'] = iconv($this->getConf('sso_charset'), 'UTF-8', $_SERVER['REMOTE_USER']);
         } elseif (!utf8_check($_SERVER['REMOTE_USER'])) {
             $_SERVER['REMOTE_USER'] = utf8_encode($_SERVER['REMOTE_USER']);
         }
         // trust the incoming user
         if ($this->conf['sso']) {
             $_SERVER['REMOTE_USER'] = $this->cleanUser($_SERVER['REMOTE_USER']);
             // we need to simulate a login
             if (empty($_COOKIE[DOKU_COOKIE])) {
                 $INPUT->set('u', $_SERVER['REMOTE_USER']);
                 $INPUT->set('p', 'sso_only');
             }
         }
     }
     // Add the capabilities to change the password
     $this->cando['modPass'] = $this->getConf('modPass');
 }
コード例 #2
0
 public function __construct()
 {
     parent::__construct();
     // check pwauth executable
     $this->pwauth_path = $this->getConf('pwauth_path');
     $this->passwd_path = $this->getConf('passwd_path');
     $this->shells_path = $this->getConf('shells_path');
     $this->email_domain_name = $this->getConf('email_domain_name');
     if (is_executable($this->pwauth_path)) {
         $this->cando['addUser'] = false;
         $this->cando['delUser'] = false;
         $this->cando['modLogin'] = false;
         $this->cando['modPass'] = false;
         $this->cando['modName'] = false;
         $this->cando['modMail'] = false;
         $this->cando['modGroups'] = false;
         if (is_readable($this->passwd_path)) {
             $this->cando['getUsers'] = true;
             $this->cando['getUserCount'] = true;
         } else {
             $this->cando['getUsers'] = false;
             $this->cando['getUserCount'] = false;
         }
         $this->cando['getGroups'] = false;
         $this->cando['external'] = false;
         $this->cando['logout'] = true;
         $this->success = true;
     } else {
         $this->success = false;
         echo "pwauth not found!";
     }
 }
コード例 #3
0
ファイル: auth.php プロジェクト: jotttt/ttu-wiki
 /**
  * Constructor
  *
  * checks if the pgsql interface is available, otherwise it will
  * set the variable $success of the basis class to false
  *
  * @author Matthias Grimm <*****@*****.**>
  * @author Andreas Gohr <*****@*****.**>
  */
 public function __construct()
 {
     // we don't want the stuff the MySQL constructor does, but the grandparent might do something
     DokuWiki_Auth_Plugin::__construct();
     if (!function_exists('pg_connect')) {
         $this->_debug("PgSQL err: PHP Postgres extension not found.", -1, __LINE__, __FILE__);
         $this->success = false;
         return;
     }
     $this->loadConfig();
     // set capabilities based upon config strings set
     if (empty($this->conf['user']) || empty($this->conf['password']) || empty($this->conf['database'])) {
         $this->_debug("PgSQL err: insufficient configuration.", -1, __LINE__, __FILE__);
         $this->success = false;
         return;
     }
     $this->cando['addUser'] = $this->_chkcnf(array('getUserInfo', 'getGroups', 'addUser', 'getUserID', 'getGroupID', 'addGroup', 'addUserGroup'));
     $this->cando['delUser'] = $this->_chkcnf(array('getUserID', 'delUser', 'delUserRefs'));
     $this->cando['modLogin'] = $this->_chkcnf(array('getUserID', 'updateUser', 'UpdateTarget'));
     $this->cando['modPass'] = $this->cando['modLogin'];
     $this->cando['modName'] = $this->cando['modLogin'];
     $this->cando['modMail'] = $this->cando['modLogin'];
     $this->cando['modGroups'] = $this->_chkcnf(array('getUserID', 'getGroups', 'getGroupID', 'addGroup', 'addUserGroup', 'delGroup', 'getGroupID', 'delUserGroup'));
     /* getGroups is not yet supported
        $this->cando['getGroups']    = $this->_chkcnf(array('getGroups',
        'getGroupID')); */
     $this->cando['getUsers'] = $this->_chkcnf(array('getUsers', 'getUserInfo', 'getGroups'));
     $this->cando['getUserCount'] = $this->_chkcnf(array('getUsers'));
 }
コード例 #4
0
ファイル: auth.php プロジェクト: spoonysonny/dokuwiki-ucenter
 /**
  * Constructor
  *
  * checks if the mysql interface is available, otherwise it will
  * set the variable $success of the basis class to false
  *
  * @author Matthias Grimm <*****@*****.**>
  */
 public function __construct()
 {
     parent::__construct();
     if (!function_exists('uc_authcode')) {
         $this->_debug("Cannot find UC client API.", -1, __LINE__, __FILE__);
         $this->success = false;
         return;
     }
     if (UC_CHARSET != 'utf-8') {
         $this->cnf['charset'] = 'utf-8';
     }
     if (!isset($this->cnf['sync'])) {
         $this->cnf['sync'] = true;
     }
     if (!isset($this->cnf['cookie'])) {
         $this->cnf['cookie'] = 'dokuwiki_uc_auth';
     }
     // must forward clear pass.
     $this->cnf['forwardClearPass'] = 1;
     $this->cando['addUser'] = true;
     $this->cando['delUser'] = true;
     $this->cando['modLogin'] = false;
     $this->cando['modPass'] = false;
     $this->cando['modName'] = true;
     $this->cando['modMail'] = true;
     $this->cando['modGroups'] = false;
     $this->cando['getUsers'] = true;
     $this->cando['getUserCount'] = false;
     $this->cando['getGroups'] = false;
     $this->cando['external'] = $this->cnf['sync'];
     $this->cando['logoff'] = true;
 }
コード例 #5
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct();
     // Plugin capabilities
     $this->cando['logout'] = true;
     $this->success = true;
 }
コード例 #6
0
ファイル: auth.php プロジェクト: sploadie/authldaplocal
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     global $config_cascade;
     if (!@is_readable($config_cascade['plainauth.users']['default'])) {
         $this->success = false;
     } else {
         if (@is_writable($config_cascade['plainauth.users']['default'])) {
             $this->cando['addUser'] = true;
             $this->cando['delUser'] = true;
             $this->cando['modLogin'] = true;
             $this->cando['modGroups'] = true;
         }
         $this->cando['getUsers'] = true;
         $this->cando['getGroups'] = true;
         $this->cando['getUserCount'] = true;
         $this->cando['logout'] = true;
     }
     // ldap extension is needed
     if (!function_exists('ldap_connect')) {
         $this->_debug("LDAP err: PHP LDAP extension not found.", -1, __LINE__, __FILE__);
         $this->success = false;
         return;
     }
 }
コード例 #7
0
ファイル: auth.php プロジェクト: jankowa/kolab-octo-dokuwiki
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     global $INPUT;
     // ldap extension is needed
     if (!function_exists('ldap_connect')) {
         $this->_debug("LDAP err: PHP LDAP extension not found.", -1, __LINE__, __FILE__);
         $this->success = false;
         return;
     }
     parse_str(base64_decode(str_pad(strrev($INPUT->get->str('kolab_auth')), strlen($INPUT->get->str('kolab_auth')) % 4, '=', STR_PAD_RIGHT)), $request);
     $postdata = http_build_query($request, '', '&');
     $postdata .= '&hmac=' . hash_hmac('sha256', $postdata, $this->getConf('kolab_secret'));
     $context = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n" . "Content-Length: " . strlen($postdata) . "\r\n" . "Cookie: " . $request['cname'] . '=' . $request['session'] . "\r\n", 'content' => $postdata)));
     $res = file_get_contents($this->getConf('kolab_server') . '?_action=dokuwikisso', false, $context);
     $auth = @json_decode($res, true);
     if ($auth['user'] && $auth['pass']) {
         $login = $auth['user'];
         $password = $auth['pass'];
     }
     $INPUT->set('u', $login);
     $INPUT->set('p', $password);
     // Add the capabilities to change the password
     $this->cando['modPass'] = $this->getConf('modPass');
     // kolab auth
 }
コード例 #8
0
ファイル: auth.php プロジェクト: janzoner/dokuwiki
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     // ldap extension is needed
     if (!function_exists('ldap_connect')) {
         $this->_debug("LDAP err: PHP LDAP extension not found.", -1, __LINE__, __FILE__);
         $this->success = false;
         return;
     }
     // Add the capabilities to change the password
     $this->cando['modPass'] = $this->getConf('modPass');
 }
コード例 #9
0
ファイル: auth.php プロジェクト: ngharaibeh/Methodikos
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     // ldap extension is needed
     if (!function_exists('ldap_connect')) {
         $this->_debug("LDAP err: PHP LDAP extension not found.", -1, __LINE__, __FILE__);
         $this->success = false;
         return;
     }
     // auth_ldap currently just handles authentication, so no
     // capabilities are set
 }
コード例 #10
0
ファイル: auth.php プロジェクト: xenim/django-external-auth
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct();
     // for compatibility
     $this->cando['getGroups'] = true;
     // can a list of available groups be retrieved?
     $this->cando['external'] = true;
     // does the module do external auth checking?
     $this->cando['logout'] = false;
     // can the user logout again? (eg. not possible with HTTP auth)
     $this->success = true;
 }
コード例 #11
0
ファイル: auth.php プロジェクト: msims04/eveseat-addon-auth
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->cando['addUser'] = false;
     $this->cando['delUser'] = false;
     $this->cando['modLogin'] = false;
     $this->cando['modPass'] = false;
     $this->cando['modName'] = false;
     $this->cando['modMail'] = false;
     $this->cando['modGroups'] = false;
     $this->cando['getUsers'] = false;
     $this->cando['getUserCount'] = false;
     $this->cando['getGroups'] = false;
     $this->cando['external'] = true;
     $this->cando['logout'] = true;
     $this->success = true;
 }
コード例 #12
0
ファイル: auth.php プロジェクト: splitbrain/dokuwiki
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct();
     // for compatibility
     if (!class_exists('PDO')) {
         $this->_debug('PDO extension for PHP not found.', -1, __LINE__);
         $this->success = false;
         return;
     }
     if (!$this->getConf('dsn')) {
         $this->_debug('No DSN specified', -1, __LINE__);
         $this->success = false;
         return;
     }
     try {
         $this->pdo = new PDO($this->getConf('dsn'), $this->getConf('user'), conf_decodeString($this->getConf('pass')), array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => true, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
     } catch (PDOException $e) {
         $this->_debug($e);
         msg($this->getLang('connectfail'), -1);
         $this->success = false;
         return;
     }
     // can Users be created?
     $this->cando['addUser'] = $this->_chkcnf(array('select-user', 'select-user-groups', 'select-groups', 'insert-user', 'insert-group', 'join-group'));
     // can Users be deleted?
     $this->cando['delUser'] = $this->_chkcnf(array('select-user', 'select-user-groups', 'select-groups', 'leave-group', 'delete-user'));
     // can login names be changed?
     $this->cando['modLogin'] = $this->_chkcnf(array('select-user', 'select-user-groups', 'update-user-login'));
     // can passwords be changed?
     $this->cando['modPass'] = $this->_chkcnf(array('select-user', 'select-user-groups', 'update-user-pass'));
     // can real names be changed?
     $this->cando['modName'] = $this->_chkcnf(array('select-user', 'select-user-groups', 'update-user-info:name'));
     // can real email be changed?
     $this->cando['modMail'] = $this->_chkcnf(array('select-user', 'select-user-groups', 'update-user-info:mail'));
     // can groups be changed?
     $this->cando['modGroups'] = $this->_chkcnf(array('select-user', 'select-user-groups', 'select-groups', 'leave-group', 'join-group', 'insert-group'));
     // can a filtered list of users be retrieved?
     $this->cando['getUsers'] = $this->_chkcnf(array('list-users'));
     // can the number of users be retrieved?
     $this->cando['getUserCount'] = $this->_chkcnf(array('count-users'));
     // can a list of available groups be retrieved?
     $this->cando['getGroups'] = $this->_chkcnf(array('select-groups'));
     $this->success = true;
 }
コード例 #13
0
ファイル: auth.php プロジェクト: omusico/isle-web-framework
 /**
  * Constructor
  *
  * Carry out sanity checks to ensure the object is
  * able to operate. Set capabilities.
  *
  * @author  Christopher Smith <*****@*****.**>
  */
 public function __construct()
 {
     parent::__construct();
     global $config_cascade;
     if (!@is_readable($config_cascade['plainauth.users']['default'])) {
         $this->success = false;
     } else {
         if (@is_writable($config_cascade['plainauth.users']['default'])) {
             $this->cando['addUser'] = true;
             $this->cando['delUser'] = true;
             $this->cando['modLogin'] = true;
             $this->cando['modPass'] = true;
             $this->cando['modName'] = true;
             $this->cando['modMail'] = true;
             $this->cando['modGroups'] = true;
         }
         $this->cando['getUsers'] = true;
         $this->cando['getUserCount'] = true;
     }
 }
コード例 #14
0
 /**
  * Constructor
  *
  * checks if the mysql interface is available, otherwise it will
  * set the variable $success of the basis class to false
  *
  * @author Matthias Grimm <*****@*****.**>
  */
 public function __construct()
 {
     parent::__construct();
     if (!function_exists('mysql_connect')) {
         $this->_debug("MySQL err: PHP MySQL extension not found.", -1, __LINE__, __FILE__);
         $this->success = false;
         return;
     }
     // set capabilities based upon config strings set
     if (!$this->getConf('server') || !$this->getConf('user') || !$this->getConf('database')) {
         $this->_debug("MySQL err: insufficient configuration.", -1, __LINE__, __FILE__);
         $this->success = false;
         return;
     }
     $this->cando['addUser'] = $this->_chkcnf(array('getUserInfo', 'getGroups', 'addUser', 'getUserID', 'getGroupID', 'addGroup', 'addUserGroup'), true);
     $this->cando['delUser'] = $this->_chkcnf(array('getUserID', 'delUser', 'delUserRefs'), true);
     $this->cando['modLogin'] = $this->_chkcnf(array('getUserID', 'updateUser', 'UpdateTarget'), true);
     $this->cando['modPass'] = $this->cando['modLogin'];
     $this->cando['modName'] = $this->cando['modLogin'];
     $this->cando['modMail'] = $this->cando['modLogin'];
     $this->cando['modGroups'] = $this->_chkcnf(array('getUserID', 'getGroups', 'getGroupID', 'addGroup', 'addUserGroup', 'delGroup', 'getGroupID', 'delUserGroup'), true);
     /* getGroups is not yet supported
        $this->cando['getGroups']    = $this->_chkcnf(array('getGroups',
        'getGroupID'),false); */
     $this->cando['getUsers'] = $this->_chkcnf(array('getUsers', 'getUserInfo', 'getGroups'), false);
     $this->cando['getUserCount'] = $this->_chkcnf(array('getUsers'), false);
     if ($this->getConf('debug') >= 2) {
         $candoDebug = '';
         foreach ($this->cando as $cd => $value) {
             if ($value) {
                 $value = 'yes';
             } else {
                 $value = 'no';
             }
             $candoDebug .= $cd . ": " . $value . " | ";
         }
         $this->_debug("authmysql cando: " . $candoDebug, 0, __LINE__, __FILE__);
     }
 }
コード例 #15
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct();
     // for compatibility
     $this->cando['addUser'] = false;
     // can Users be created?
     $this->cando['delUser'] = false;
     // can Users be deleted?
     $this->cando['modLogin'] = false;
     // can login names be changed?
     $this->cando['modPass'] = false;
     // can passwords be changed?
     $this->cando['modName'] = false;
     // can real names be changed?
     $this->cando['modMail'] = false;
     // can emails be changed?
     $this->cando['modGroups'] = false;
     // can groups be changed?
     $this->cando['getUsers'] = false;
     // can a (filtered) list of users be retrieved?
     $this->cando['getUserCount'] = false;
     // can the number of users be retrieved?
     $this->cando['getGroups'] = false;
     // can a list of available groups be retrieved?
     $this->cando['logout'] = true;
     // can the user logout again? (eg. not possible with HTTP auth)
     $this->cando['external'] = true;
     // does the module do external auth checking?
     // $this->loadConfig(); // deprecated seit 2012
     $this->ssourl = $this->getConf('ssourl');
     $ov = $this->getConf('ov');
     if (!empty($ov)) {
         $this->ssourl = $this->addUrlParams($this->ssourl, array("ov" => $ov));
     }
     $this->data = array();
     $this->triedsilent = isset($_SESSION[DOKU_COOKIE]['auth']['hiorg']['triedsilent']) && $_SESSION[DOKU_COOKIE]['auth']['hiorg']['triedsilent'] == true;
     $this->success = true;
 }
コード例 #16
0
ファイル: auth.php プロジェクト: yjliugit/dokuwiki
 /**
  * Load domain config on capability check
  *
  * @param string $cap
  * @return bool
  */
 public function canDo($cap)
 {
     //capabilities depend on config, which may change depending on domain
     $domain = $this->_userDomain($_SERVER['REMOTE_USER']);
     $this->_loadServerConfig($domain);
     return parent::canDo($cap);
 }
コード例 #17
0
ファイル: auth.php プロジェクト: ofsole/dokuwiki
 public function useSessionCache($user)
 {
     global $conf;
     if (is_null($this->chained_auth)) {
         return parent::useSessionCache($user);
     } else {
         return $this->chained_auth->useSessionCache($user);
     }
 }
コード例 #18
0
 /**
  * Sets the name of the auth plugin currently in use.
  *
  * @param DokuWiki_Auth_Plugin $plugin
  */
 protected function setCurrentPluginName(DokuWiki_Auth_Plugin $plugin)
 {
     $_SESSION[DOKU_COOKIE][$this->getPluginName()]['current'] = $plugin->getPluginName();
 }
コード例 #19
0
ファイル: auth.php プロジェクト: amulheirn/authphpbb3
 /**
  * Constructor.
  */
 public function __construct()
 {
     global $conf;
     parent::__construct();
     // Set capabilities accordingly
     $this->cando['addUser'] = false;
     // can Users be created?
     $this->cando['delUser'] = false;
     // can Users be deleted?
     $this->cando['modLogin'] = false;
     // can login names be changed?
     $this->cando['modPass'] = false;
     // can passwords be changed?
     $this->cando['modName'] = false;
     // can real names be changed?
     $this->cando['modMail'] = false;
     // can emails be changed?
     $this->cando['modGroups'] = false;
     // can groups be changed?
     $this->cando['getUsers'] = false;
     // can a (filtered) list of users be retrieved?
     $this->cando['getUserCount'] = false;
     // can the number of users be retrieved?
     $this->cando['getGroups'] = true;
     // can a list of available groups be retrieved?
     $this->cando['external'] = true;
     // does the module do external auth checking?
     $this->cando['logout'] = false;
     // can the user logout again?
     //  Load the config
     $this->loadConfig();
     // set and check the config values
     $wikirootpath = realpath(dirname(__FILE__) . "/../../../");
     $phpbb3relpath = $this->getConf("phpbb3rootpath");
     $phpbb3relpath = trim($phpbb3relpath);
     // remove (if exist) spases from start/end of path
     $phpbb3relpath = trim($phpbb3relpath, "/\\");
     // remove (if exist) slashes from start/end of path
     $phpbb3config = $wikirootpath . '/' . $phpbb3relpath . '/config.php';
     if (!$phpbb3config) {
         // Error : $phpbb3config not set
         dbglog("authphpbb3 error: phpbb3config is not set");
         msg("Configuration error. Contact wiki administrator", -1);
         $this->success = false;
         return;
     }
     if (!file_exists($phpbb3config)) {
         // Error: phpbb3 config file not found
         dbglog("authphpbb3 error: phpbb3 config {$phpbb3config} not found");
         msg("Configuration error. Contact wiki administrator", -1);
         $this->success = false;
         return;
     }
     include $phpbb3config;
     $this->phpbb3_dbhost = $dbhost;
     $this->phpbb3_dbname = $dbname;
     $this->phpbb3_dbuser = $dbuser;
     $this->phpbb3_dbpasswd = $dbpasswd;
     $this->phpbb3_table_prefix = $table_prefix;
     foreach (array("phpbb3_dbhost", "phpbb3_dbname", "phpbb3_dbuser", "phpbb3_dbpasswd") as $cfgvar) {
         if (is_null($this->{$cfgvar})) {
             msg("Configuration error. Contact wiki administrator", -1);
             dbglog("authphpbb3 error: phpbb3 config variable {$cfgvar} not set");
             $this->success = false;
             return;
         }
     }
     $this->success = true;
 }
コード例 #20
0
ファイル: auth.php プロジェクト: papillon326/authplaincas
 /**
  * Inherited canDo function, may be useful for localusers
  *
  * @param string $cap
  * @return bool
  */
 public function canDo($cap)
 {
     // We might need to do something to redefine the capabilities for local users
     return parent::canDo($cap);
 }