Page MenuHomePhabricator

"Minimum Name Length" extension: Migrate to use a PreAuthenticationProvider
Closed, ResolvedPublic

Description

According to the wiki docu the Minimum Name Length extension needs a "PreAuthenticationProvider" or a "SecondaryAuthenticationProvider" since it is using the "AbortNewAccount" hook. Probably the "PreAuthenticationProvider" seems to be the one to go for due to the nature of this extension. However the docu is not very verbose on what this may be and how this may be implemented. So an expert is needed to tackle this issue. Greatly appreciated!

Event Timeline

Kghbln renamed this task from MinimumName Lenght to Migrate "MinimumName Lenght" extension to use a "PreAuthenticationProvider".Jun 13 2016, 11:24 AM

Such an issue seems to be tracked via T110291.

The interface is documented at MediaWiki\Auth\PreAuthenticationProvider, although you'd likely want to subclass MediaWiki\Auth\AbstractPreAuthenticationProvider so you don't have to implement all the methods. You'd most likely put your check in the testUserForCreation method, being sure to only reject a name if the $autocreate parameter is falsey.

Then, in place of adding an entry to $wgHooks, you'd add an appropriate entry into $wgAuthManagerAutoConfig instead. Possibly something like this:

$wgAuthManagerAutoConfig['preauth'] += [
    MinimumNameLengthPreAuthenticationProvider::class => [
        'class' => MinimumNameLengthPreAuthenticationProvider::class,
    ],
];
Nemo_bis triaged this task as Medium priority.Jun 13 2016, 7:09 PM
Nemo_bis added a project: MW-1.27-release.
demon added a subscriber: demon.

Does not block 1.27 release.

@Anomie Thank you for your valuable input!

Kghbln renamed this task from Migrate "MinimumName Lenght" extension to use a "PreAuthenticationProvider" to "MinimumName Lenght" extension / Migrate to use a "PreAuthenticationProvider".Jul 2 2016, 3:53 PM
Aklapper renamed this task from "MinimumName Lenght" extension / Migrate to use a "PreAuthenticationProvider" to "MinimumName Lenght" extension: Migrate to use a PreAuthenticationProvider.Jul 21 2016, 8:41 AM
Tgr renamed this task from "MinimumName Lenght" extension: Migrate to use a PreAuthenticationProvider to "Minimum Name Length" extension: Migrate to use a PreAuthenticationProvider.Jul 21 2016, 7:22 PM
Tgr updated the task description. (Show Details)

Change 300557 had a related patch set uploaded (by Florianschmidtwelzow):
Convert this extension to AuthManager

https://gerrit.wikimedia.org/r/300557

Change 300557 merged by Kghbln:
Convert this extension to AuthManager

https://gerrit.wikimedia.org/r/300557