diff options
author | Andreas Gohr <andi@splitbrain.org> | 2013-10-22 21:45:37 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2013-10-22 21:45:37 +0200 |
commit | d34a2a38603431bc5caa74b726a6f58d86a70530 (patch) | |
tree | d860b2c9fa5ccb254673d5b9dec597339068736c /lib/plugins/authad/auth.php | |
parent | 1d8036c2a36d5e226e4a58657e9d859cbc241508 (diff) | |
download | rpg-d34a2a38603431bc5caa74b726a6f58d86a70530.tar.gz rpg-d34a2a38603431bc5caa74b726a6f58d86a70530.tar.bz2 |
allow charset for SSO to be configured FS#2148
Diffstat (limited to 'lib/plugins/authad/auth.php')
-rw-r--r-- | lib/plugins/authad/auth.php | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/lib/plugins/authad/auth.php b/lib/plugins/authad/auth.php index fcbd2eeef..e1d758fb8 100644 --- a/lib/plugins/authad/auth.php +++ b/lib/plugins/authad/auth.php @@ -92,16 +92,24 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin { } // Prepare SSO - if(!utf8_check($_SERVER['REMOTE_USER'])) { - $_SERVER['REMOTE_USER'] = utf8_encode($_SERVER['REMOTE_USER']); - } - if($_SERVER['REMOTE_USER'] && $this->conf['sso']) { - $_SERVER['REMOTE_USER'] = $this->cleanUser($_SERVER['REMOTE_USER']); + 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']); + } - // we need to simulate a login - if(empty($_COOKIE[DOKU_COOKIE])) { - $INPUT->set('u', $_SERVER['REMOTE_USER']); - $INPUT->set('p', 'sso_only'); + // 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'); + } } } |