diff --git a/AuthRemoteuser.body.php b/AuthRemoteuser.body.php index 9635a0d4c6ef9666b9ec19e4d6ce4152c6220d35..2941ad6bee90a43ffe688026273a9403204f8fda 100644 --- a/AuthRemoteuser.body.php +++ b/AuthRemoteuser.body.php @@ -167,10 +167,11 @@ class AuthRemoteuser extends MediaWiki\Session\ImmutableSessionProviderWithCooki */ protected function getRemoteUsername() { + global $wgAuthRemoteuserEnvVariable; global $wgAuthRemoteuserDomain; - if (isset($_SERVER['REMOTE_USER'])) { - $username = $_SERVER['REMOTE_USER']; + if (isset($_SERVER[$wgAuthRemoteuserEnvVariable])) { + $username = $_SERVER[$wgAuthRemoteuserEnvVariable]; if ($wgAuthRemoteuserDomain) { $username = str_replace("$wgAuthRemoteuserDomain\\", diff --git a/README.md b/README.md index 83d54ca21011ad76becd9a55ebb5b8697883b0bd..7f4e26c756be39b6fcd333f2104f84a20f34dff5 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,11 @@ It will be appended to the username and should form a valid email address. If i.e. your username to login (==`REMOTE_USER`) is `jdoe`, the email of the user will be `jdoe@example.com`. +If your environment uses a different variable then `REMOTE_USER` +you can adjust this like so: + + $wgAuthRemoteuserEnvVariable = 'HTTP_X_REMOTE_USER'; + ## Implementation The constructor of AuthRemoteuser registers a hook to do the automatic login. Storing the AuthRemoteuser object in $wgAuth tells MediaWiki that instead of the diff --git a/extension.json b/extension.json index 051176e23e2f57857a723c781ccb663cf241afb9..c059779baace05a07d3f874dada3047aa3238b18 100644 --- a/extension.json +++ b/extension.json @@ -1,7 +1,7 @@ { "name": "AuthRemoteuser", "namemsg": "authremoteuser-extensionname", - "version": "1.3.0", + "version": "1.3.1", "author": ["Otheus Shelling", "Rusty Burchfield", "James Kinsman", "Daniel Thomas", "Ian Ward Comfort", "[[mw:User:MarkAHershberger|Mark A. Hershberger]]", "Jonas Gröger", "Andreas Fink"], "url": "https://www.mediawiki.org/wiki/Extension:AuthRemoteuser", "descriptionmsg": "authremoteuser-desc", @@ -25,7 +25,8 @@ "_prefix": "", "wgAuthRemoteuserDomain": "", "wgAuthRemoteuserMailDomain": "example.wiki", - "wgAuthRemoteuserNotify": false + "wgAuthRemoteuserNotify": false, + "wgAuthRemoteuserEnvVariable" : "REMOTE_USER" }, "manifest_version": 1 } \ No newline at end of file