Commit 2d0e78c1 authored by Andreas Fink's avatar Andreas Fink

Made envrionment variable configurable #5

parent 3d189457
......@@ -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\\",
......
......@@ -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
......
{
"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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment