Extension talk:HttpAuth

Hook HttpAuthPlugin::autoAuthenticate failed (solved)
I encountered the following error: Detected bug in an extension! Hook HttpAuthPlugin::autoAuthenticate failed to return a value; should return true to continue hook processing or false to abort.

I'm not sure if this changed in a later version of MediaWiki, but I solved it by adding return 1; at the end of the autoAuthenticate function.

--Divide 21:00, 14 September 2007 (UTC)

I had this same problem, and solved it with pretty much the same thing (return true;). Incase it helps someone in the future, heres roughly the specs of the problem system:


 * MediaWiki: 1.11.2
 * PHP: 5.2.4-2ubuntu5.3 (apache2handler)
 * MySQL: 5.0.51a-3ubuntu5.1

Kgoetz 03:52, 5 September 2008 (UTC)

Using PHP as a CGI rather than an Apache module
If you're using php as a CGI rather than a apache module, you can get this plugin to work by replacing all instances of PHP_AUTH_USER in the module and the lines added to LocalSettings.php with REMOTE_USER. -Mork the delayer

Is it possible to disable the auto-creation of new accounts? How?

Not working for me...
This extension does not work for me on my Mac Server. Here is some info:

PHP Version 5.1.2 Apache/1.3.33

Don't you have to call this?:

header( 'WWW-Authenticate: Basic realm="Private"' );

I don't see where it calls that...

Thanks,

John


 * I guess it expects you to do that by .htaccess -- Duesentrieb ⇌ 00:21, 13 April 2007 (UTC)

Why do I get this Warninig? (solved)
Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of [runtime function name]. If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. in /is/htdocs/wp1XXXXXXXX_XXXXXX/www06/UTILISE/wiki/extensions/HttpAuthPlugin.php on line 261

I am using a virual server and can not edit the PHP Setup

allow_call_time_pass_reference needs to be true, and can be set in the PHP-setup, HOST-Europe lets you manipulate this, others may be too.

(--Mrmuehle 16:23, 17 May 2007 (UTC))

This is great - what about htgroups?
This plugin works well for me - good work Jeremiah. However I'd like something that can keep mediawiki user groups in sync with apache's htgroup file in a similar manner. Unfortunately for me php's $_SERVER array does not seem to contain the groups a user belongs to. Ideas appreciated.

(--Dkerse 06:54, 17 July 2007 (UTC))

Disable manual account creation
This is a nice plugin and I would like to be able to disable manual signups for my wiki. Unfortunately $wgGroupPermissions['*']['createaccount'] = false; does not work any more :(

User authenticated from http, but identified from cookies (and minor suggestions)
Great plugin.

Some suggested corrections:

User authentication (verifying username/password) gets from httpRequest. But identification goes from cookies.

To reproduce: login into wiki as user1, then as user2, then as user1 again and look at the top of the wiki page (where logged user name is specified). Don't logout. Restart browser instead.

Fix: insert this into HttpAuthPlugin.php, in the function autoAuthenticate, replace if($user->mId != 0) { return 0; } with if ( strtolower($user->mName) != (strtolower($this->getNameSub($_SERVER['PHP_AUTH_USER']))) ) { $user->loadDefaults; } if($user->mId != 0) { return 0; }

To disable "Create new account" replace whole function modifyUITemplate with: function modifyUITemplate( &$template ) { $template->set('useemail', false); $template->set('remember', false); $template->set('create', false); $template->set('domain', false); $template->set('usedomain', false); }

To disable "change password" option from UserPreferences replace whole function allowPasswordChange with: function allowPasswordChange { return false; }

and replace function authenticate with: function authenticate( $username, $password ) { if(strcmp(strtolower($username),strtolower($_SERVER['REDIRECT_REMOTE_USER'])) == 0) return true; else return false; }

To remove Login/Logout from every page edit includes/SkinTemplate.php. Find lines: $personal_urls['logout'] = array( 'text' => wfMsg( 'userlogout' ),  'href' => self::makeSpecialUrl( 'Userlogout', $wgTitle->isSpecial( 'Preferences' ) ? '' : "returnto={$this->thisurl}" ), 'active' => false ); and $personal_urls['login'] = array( 'text' => wfMsg('userlogin'),  'href' => self::makeSpecialUrl( 'Userlogin', 'returnto='. $this->thisurl ), 'active' => $wgTitle->isSpecial( 'Userlogin' ) );

And comment them (or remove). In my case (mediawiki 1.11.0) numers of those lines: 546..552 and 577..581

Using proxy - consider replacing every occurrence of PHP_AUTH_USER with REDIRECT_REMOTE_USER (inside HttpAuthPlugin.php)

B aniaczek 14:49, 19 October 2007 (UTC)

IMPORTANT
If you also enable anonymous browsing make absolutely sure its behaving correctly. In some situations, PHP_AUTH_USER gets set regardless of a successful login. You can test with:

curl http://baduser:badpassword@your.domain/wiki/ | grep -i baduser

if you see a page that looks like the bad user is logged in, your setup is misconfigured. In previous install versions it was suggested to use PHP_AUTH_USER, always use REMOTE_USER as it only gets set on successful login.

Error with mediawiki 1.12.0 when an account does not exist
When logging through http without an existing mediawiki account generates an exception. Then if you refresh, the account was created and all is ok.

Removal of disconnect link
Indeed since the auth is done through http, the disconnect link should be removed.

Problems
I use mediawiki1.7 with php 5.2.0 and after install HttpAuth plugin all work fine for me except new account creation page. When I try to create a new account I recive the following error:

A database query syntax error has occurred. The last attempted database query was:

(SQL query hidden)

MySQL returned error "1062: Duplicate entry 'WikiSysop' for key 1 (localhost)".

Ecerutti 21:56, 18 June 2008 (UTC)

Solution: I have got this to work for Mediawiki 1.14, by applying three changes:
 * Follow the rewrite suggestion concerning the UserLoadFromSession hook in LocalSettings.php
 * Modify function userExists as to always return true
 * In function autoAuthenticate comment out $user->saveSettings, as this is the cause of your SQL error.

Bart Du Bois, 16:11, 24 February 2008 (UTC)

SHA instead of MD5
Is there a way to get mediawiki to use SHA-1 instead of MD5? I believe Apache supports SHA-1 passwords. Would it therefore be possible to configure apache to do the http auth against the mediawiki users table using SHA-1?

In its present state, this extension does the reverse of what I'm trying to accomplish. I'd like to manage users via mediawiki, but use http auth.