aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/plugins/authad
diff options
context:
space:
mode:
authorfiwswe <53953985+fiwswe@users.noreply.github.com>2022-09-21 23:37:57 +0200
committerGitHub <noreply@github.com>2022-09-21 23:37:57 +0200
commit1d5848a6aaaaa63311d817f85deca9cf129531fd (patch)
treeae7204e7cb427b4277db50ab596348b6909fc4d0 /lib/plugins/authad
parent9f48b7048bfe54113e7d2ea528e226b1e3e2ab1d (diff)
downloaddokuwiki-1d5848a6aaaaa63311d817f85deca9cf129531fd.tar.gz
dokuwiki-1d5848a6aaaaa63311d817f85deca9cf129531fd.zip
Replace direct access to $_SERVER with $INPUT->server->…
2nd try on a separate branch Also fixes a line that was too long Note: As I do not use this plugin, this is completely untested. It should fix splitbrain#3778 (unless I made a stupid mistake). See https://github.com/fiwswe/dokuwiki/commit/ce0feb5f5c38d0e698bd162105fbe61ceb27fca8
Diffstat (limited to 'lib/plugins/authad')
-rw-r--r--lib/plugins/authad/auth.php23
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/plugins/authad/auth.php b/lib/plugins/authad/auth.php
index 05d3a11bd..8090b5670 100644
--- a/lib/plugins/authad/auth.php
+++ b/lib/plugins/authad/auth.php
@@ -97,21 +97,22 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin
}
// Prepare SSO
- if (!empty($_SERVER['REMOTE_USER'])) {
+ if (!empty($INPUT->server->str('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 (!\dokuwiki\Utf8\Clean::isUtf8($_SERVER['REMOTE_USER'])) {
- $_SERVER['REMOTE_USER'] = utf8_encode($_SERVER['REMOTE_USER']);
+ $INPUT->server->set('REMOTE_USER',
+ iconv($this->getConf('sso_charset'), 'UTF-8', $INPUT->server->str('REMOTE_USER')));
+ } elseif (!\dokuwiki\Utf8\Clean::isUtf8($INPUT->server->str('REMOTE_USER'))) {
+ $INPUT->server->set('REMOTE_USER', utf8_encode($INPUT->server->str('REMOTE_USER')));
}
// trust the incoming user
if ($this->conf['sso']) {
- $_SERVER['REMOTE_USER'] = $this->cleanUser($_SERVER['REMOTE_USER']);
+ $INPUT->server->set('REMOTE_USER', $this->cleanUser($INPUT->server->str('REMOTE_USER')));
// we need to simulate a login
if (empty($_COOKIE[DOKU_COOKIE])) {
- $INPUT->set('u', $_SERVER['REMOTE_USER']);
+ $INPUT->set('u', $INPUT->server->str('REMOTE_USER'));
$INPUT->set('p', 'sso_only');
}
}
@@ -131,8 +132,9 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin
*/
public function canDo($cap)
{
+ global $INPUT;
//capabilities depend on config, which may change depending on domain
- $domain = $this->getUserDomain($_SERVER['REMOTE_USER']);
+ $domain = $this->getUserDomain($INPUT->server->str('REMOTE_USER'));
$this->loadServerConfig($domain);
return parent::canDo($cap);
}
@@ -151,8 +153,8 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin
*/
public function checkPass($user, $pass)
{
- if ($_SERVER['REMOTE_USER'] &&
- $_SERVER['REMOTE_USER'] == $user &&
+ global $INPUT;
+ if ($INPUT->server->str('REMOTE_USER') == $user &&
$this->conf['sso']
) return true;
@@ -197,6 +199,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin
global $conf;
global $lang;
global $ID;
+ global $INPUT;
$adldap = $this->initAdLdap($this->getUserDomain($user));
if (!$adldap) return array();
@@ -262,7 +265,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin
$info['expiresin'] = round(($info['expiresat'] - time())/(24*60*60));
// if this is the current user, warn him (once per request only)
- if (($_SERVER['REMOTE_USER'] == $user) &&
+ if (($INPUT->server->str('REMOTE_USER') == $user) &&
($info['expiresin'] <= $this->conf['expirywarn']) &&
!$this->msgshown
) {