Vekseid / ForumSessionProvider

MediaWiki extension to use Elkarte and SMF as a session provider, allowing single-sign on in versions 1.27+
BSD 3-Clause "New" or "Revised" License
5 stars 1 forks source link

Am I missing something? #3

Closed berianwilliams closed 4 years ago

berianwilliams commented 4 years ago

Hi. I've unzipped the folder ForumSessionProvider into my extensions folder.

I've added the below lines to LocalSettings.php:

// Disable creation of accounts
$wgGroupPermissions['*']['createaccount']               = false;

# This requires a user be logged into the wiki to make changes.
$wgGroupPermissions['*']['edit']                        = false; // MediaWiki Setting

$wgGroupPermissions['user']['edit']                     = true;
$wgGroupPermissions['user']['autoconfirmed']            = true;
$wgGroupPermissions['user']['emailconfirmed']           = true;

wfLoadExtension('ForumSessionProvider');

$wgFSPPath = "../forums";
$wgFSPSoftware = "smf2.0";
$wgFSPNameStyle = "smf";

$wgFSPAdminGroups = [1, 51, 61];        // Optional array, defaults to [1]. Assigns sysop group. User group 1 (Administrators) is always added even if missing. 
$wgFSPInterfaceGroups = [1];    // Optional array, defaults to [1]. Assigns interface-admin group. User group 1 (Administrators) is always added even if missing. 
$wgFSPAllowGroups = [3, 4, 49, 53, 55, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, 77, 80, 81, 82, 83];             // Technically optional array. Those signed into this group gain normal user rights. 
$wgFSPDenyGroups = [];                  // Optional array. Anyone in one of the groups doesn't get signed in, unless they are part of an admin group. Supersedes AllowGroups. 
$wgFSPSuperGroups = [1];                // Optional array. Grants the bureaucrat group. Not forced onto admins. 

But when I open the wiki, following the 'log in' link then logging in doesn't seem to have any effect. Any advice?

Vekseid commented 4 years ago

Load the extension after you define the variables. Not missing anything I guess, but I should make that more obvious, I think. >_>

Also be careful of assigning the bureaucrat group, unless you really seriously need to. Most of what it does is going to get clobbered by the extension.

berianwilliams commented 4 years ago

I've tried it before and after the variable definitions, but it didn't make any visible difference. I also tried emptying out of bureaucrat array.

I've attached my LocalSettings.php (with all secret data removed), could you please look and see if I'm doing something dumb?

Vekseid commented 4 years ago

Set $wgDebugLogFile to a path you have write access to, preferably in a private directory.

For example:

$wgDebugLogFile = "../../logs/mediawiki.log";

Grep it for ForumSessionProvider lines.

This bloats pretty quickly, but it should tell you what is wrong, though I have a couple bugs and omissions in it. I'll patch this up in the 1.1 branch shortly.

Vekseid commented 4 years ago

Oh right.

If you have upgraded to SMF 2.0.16, you will need to use the 1.1 branch - SMF 2.0.16 changes how cookies are validated.

I've polished things there, regardless.

See #2

berianwilliams commented 4 years ago

I'm now running version 1.1, and tried it with debug on. Somehow I'm seeing no logs for ForumSessionProvider though! Special:Version does show version 1.1.0 of ForumSessionProvider though, so no idea what's happening...

Vekseid commented 4 years ago

Whoops, see my latest commit.

Missed that you were already logging in your LocalSettings. Are you sure it's logging there though? It ought to have caught that...

Vekseid commented 4 years ago

@berianwilliams is your issue resolved?

berianwilliams commented 4 years ago

Still nothing, I'm afraid.

I've tried installing the latest 1.1 branch changes from today (I'm running SMF 2.0.16), and set there to be only one $wgDebugLogFile entry. There are still no ForumSessionProvider entries in the log though!

Vekseid commented 4 years ago

Okay, for some reason the LoggerFactory instance isn't doing its thing inside of provideSessionInfo.

Fixed in latest commit.

Set

$wgFSPDebug = true;

It will definitely send ForumSessionProvider entries throughout the login process now. If you see 'Access Granted!' and still aren't logged in, something is terribly wrong.

berianwilliams commented 4 years ago

I now get:

[ForumSessionProvider] Constructor initialized, debug log enabled.
[ForumSessionProvider] Loading Settings.php...
[ForumSessionProvider] User detected, attempting to load database...
[ForumSessionProvider] Database loaded, attempting to load forum member...
[ForumSessionProvider] Forum member found, verifying cookie...
[ForumSessionProvider] Member ID 39 failed to validate. Remote IP:82.9.110.127

I definitely am logged in as user 39 though; the wiki still shows the 'log in' link, and if I click that the forum login page opens with the header showing me logged in as said user. Further up in the log I see a list of cookies, and the forum cookie is one of them.

Just in case it makes a difference, I'm running MediaWiki version 1.31.1, SMF version 2.0.16.

Vekseid commented 4 years ago

@berianwilliams see latest commit. Should work now. No small embarrassment on my part. >_>

berianwilliams commented 4 years ago

Works now! Thanks very much for the help, it's a very useful tool to have!