Page MenuHomePhabricator

AutoAuthenticate hook disappeared in r15823
Closed, ResolvedPublic

Description

Author: pdd

Description:
The AutoAuthenticate hook is specially crafted for intranets with single signon
environments so that they can automatically authenticate in Mediawiki, however
in revision 15823 the hook has disappeared while applying the Stub Object code.

in includes/Setup.php the code should be changed from:
if( !is_object( $wgAuth ) ) {

$wgAuth = new StubObject( 'wgAuth', 'AuthPlugin' );

}

to:
if( !is_object( $wgAuth ) ) {

$wgAuth = new StubObject( 'wgAuth', 'AuthPlugin' );

}
if(! $wgCommandLineMode ) {

wfRunHooks('AutoAuthenticate',array(&$wgUser));

}


Version: 1.8.x
Severity: critical

Details

Reference
bz6929

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 9:17 PM
bzimport set Reference to bz6929.
bzimport added a subscriber: Unknown Object (MLST).

jasonspiro4 wrote:

I am not a developer, and I don't know much about how the MediaWiki bug tracker
works, but your bug has been sitting here for a month. You may want to reassign
this bug to the person who committed the offending revision. Also, you may get a
quicker response if you post your patch in standard patch format using the Unix
'diff -pruN' command.

rotemliss wrote:

(In reply to comment #1)

Also, you may get a
quicker response if you post your patch in standard patch format using the Unix
'diff -pruN' command.

Using "svn diff", not "diff -pruN". Please see
http://www.mediawiki.org/wiki/Subversion#Making_a_diff .

pdd wrote:

Assigning bug to tim starling, since the autoauthenticate hook disappeared after
his implementation of the Stub Object code.

pdd wrote:

Changes to includes/setup.php to reinistate the AutoAuthenticate hook.

the patch as an svn diff.

attachment setup.patch ignored as obsolete

Please do not reassign bugs away from wikibugs-l without adding it to the CC list.

Also, Tim is out sick and will not likely be paying attention to bugs for a while.

The patch looks wrong; shouldn't it be in StubUser::_newObject() so you're not wasting time running an
authentication hook if the user object never gets used?

pdd wrote:

the user is always initialized in setup.php I think, but you're right
StubUser::_newObject() is a better place for the autoauthentication hook, I have
created a new patch for this.

pdd wrote:

Changes to includes/stubobject.php to reapply the autoauthentication hook. (ignore the patch provided in includes/setup.php)

Changes to includes/stubobject.php to reinstate the autoauthentication hook.

Attached:

pdd wrote:

the patch in text format in case you prefer it that way... :)

open includes/stubobject.php and search for:
function _newObject() {

		global $wgCommandLineMode;
		if( $wgCommandLineMode ) {
			$user = new User;
			$user->setLoaded( true );
		} else {
			$user = User::loadFromSession();
		}
		return $user;

}

replace this with:
function _newObject() {

		global $wgCommandLineMode;
		if( $wgCommandLineMode ) {
			$user = new User;
			$user->setLoaded( true );
		} else {
			$user = User::loadFromSession();
			wfRunHooks('AutoAuthenticate',array($user));
		}
		return $user;

}

pdd wrote:

Added wikibugs to the cc as asked by brion.

Assign bug to Tim, I saw him active on the mailing list so I hope he's no longer
sick, so that he can apply this one line patch. :)

pdd wrote:

*sigh*
All the trouble to create bug-reports and patches doesn't seem to help much...

I just read on the mailing list that Tim Starling doesn't even look at bugzilla
mails, so I'm assigning it back to wikibugs-l in the hope that someone else can
fix his bug. See attached patch for the bugfix.

Don't just assign bugs to people and never mention it to them --
they probably just won't see it. :)

Applied in r16911