Extension talk:Phpbb Single Sign-On

Jump to navigation Jump to search

About this board

New Extension MW1.30+ & phpBB 3.2+!

1
AJ Quick (talkcontribs)

Just developed a new extension that works after the 1.27 changes that crippled the old one. I now use the Extension:Auth_remoteuser extension, which handles the logging in and have added a very simple amount of code that checks for a phpBB session and logs them into MediaWiki! It is quite easy now thanks to that extension (also the same extension that phpBBSSO was originally based upon).

You can download the code from Github, or install with composer.

https://github.com/multidimension-al/phpbbauth

This was tested using MW 1.30+ and phpBB 3.2+. Works great as far as I can see!

Reply to "New Extension MW1.30+ & phpBB 3.2+!"
108.11.216.62 (talkcontribs)

Since this is no longer maintained, I thought I'd share my alternate solution using:

Extension:PluggableAuth

In order for this to work you'll need to write your own auth that can tap into PHPBB3. Here's mine:

PHPBBAuth (in the the extensions, folder named PHPBBAuth with the rest of the pluggable auth code)

<?php

class PHPBBAuth extends PluggableAuth

{

public function authenticate( &$id, &$username, &$realname, &$email )

{

global $db, $cache, $config, $user, $auth, $template, $phpbb_root_path, $phpEx, $request, $symfony_request, $phpbb_filesystem, $phpbb_container, $phpbb_dispatcher;

$forumDirectory = '/var/www/forum/';

define('PHPBB_ROOT_PATH', $forumDirectory);

define('IN_PHPBB', true);

define('FROM_MEDIAWIKI', true);

$phpbb_root_path = PHPBB_ROOT_PATH;

$phpEx = substr(strrchr(__FILE__, '.'), 1);

include($phpbb_root_path . 'common.' . $phpEx);

$request->enable_super_globals();

$user->session_begin();

$login = $user->data['username'];

unset($db); unset($cache); unset($config); unset($user); unset($auth); unset($template); unset($phpbb_root_path); unset($phpEx); unset($request); unset($symfony_request); unset($phpbb_filesystem); unset($phpbb_container); unset($phpbb_dispatcher);

if ($login == 'Anonymous')

return false;

$username     = $login = ucfirst(strtolower($login));

$id         = null;

$realname    = '';

$email        = '';

$res = wfGetDB( DB_SLAVE )->query("SELECT user_id FROM user WHERE user_name = '" . $login . "' LIMIT 1;");

foreach ($res as $row)

$id = $row->user_id;

return true;

}

public function deauthenticate( User &$user ) {}

public function saveExtraAttributes( $id ) {}

}

IN LocalSettings.php

wfLoadExtension( 'PHPBBAuth' );

$PluggableAuth_Timeout      = 900;         // Keep alive time for session before re-authenticating.

$PluggableAuth_AutoLogin = true;

$PluggableAuth_Class      = 'PHPBBAuth';

186.215.17.232 (talkcontribs)

I tried to use your solution but it didnt work.

Is there detailed instructions about how to install the whole thing?

Regards,

206.51.161.242 (talkcontribs)

Also looking for a better explained solution if this still works...

Reply to "Alternate SSO solution"

Not working in Mediawiki 1.27. No more support?

1
186.215.19.250 (talkcontribs)

I got this message from Adam Meyer today:

"Sadly, it looks like they completely redid the authentication system as you noted. I just read through some of the changes and it looks like I’d have to nearly start from scratch.

I’m not developing anything around mediawiki anymore so I don’t know that I will ever get around to rewriting this.

I’m sorry I couldn't be of more help

-Adam"

Reply to "Not working in Mediawiki 1.27. No more support?"
79.235.219.117 (talkcontribs)

Has anyone tried this extension with new phpBB 3.1? Can it work with phpBB 3.1?

71.215.80.62 (talkcontribs)

phpBB 3.1 now has a better external login method. This extension might not work the same way, or in the very least may be overkill.

AJ Quick (talkcontribs)

I have updated the code to work with phpBB 3.1.3 now.

The code actually should have worked just fine, there were just some weird things done with the original SSO code that actually didn't make much sense. Now it has been changed and it appears to be working correctly!

2003:73:8E06:A782:EC94:1759:3CD8:72E4 (talkcontribs)

I used the SSO plugin for a while now, but after apdating phpBB (to 3.1.3) and MediaWiki to (1.24.2) enabling the SSO plugin gives me: Fatal error: Call to a member function get_extension_path() on a non-object in foo/forum/phpbb/user.php on line 631

Any clue?

173.60.199.91 (talkcontribs)

I think this issue is related to the either 1.24 banch, they changed how the login works, I am still awaiting a patch, but thanks for the conformation that it is not just me.

72.224.68.84 (talkcontribs)

Fatal error: Call to a member function get_extension_path() on a non-object in /usr/www/foo/public/phpbb/user.php on line 631

Also getting this error in Mediawiki 1.23.9 and phpBB 3.1.3.

Is this extension dead then?

100.11.93.217 (talkcontribs)

We're not rendering any PHPBB pages with SSO backend, so here's my little fix:

function set_lang(&$lang, &$help, $lang_file, $use_db = false, $use_help = false, $ext_name = '')
        {       
                global $phpbb_root_path, $phpEx;

                // Make sure the language name is set (if the user setup did not happen it is not set)
                if (!$this->lang_name)
                {
                        global $config;
                        $this->lang_name = basename($config['default_lang']);
                }

                if(defined('FROM_MEDIAWIKI')) {
                    return;
                }
86.176.149.221 (talkcontribs)

I have this same problem with phpBB 3.1.9, I get an empty page when I try to access the wiki. I've added the code above but it doesn't seem to make any difference to my problem. Anyone have any other thoughts, apart from reverting to an earlier version of phpbb?

98.246.91.207 (talkcontribs)

I am running 3.1.9 w/ MediaWiki 1.26.2, and it works fine for me.

Reply to "Single Sign-On with phpBB 3.1"

Fatal error: Call to undefined method LoginForm::authenticateUserData()

2
Andonier (talkcontribs)

I'm just trying the extension with :

- phpBB 3.1.9

- php 5.6.19

- MySQL 5.7.11

But it seems there is something wrong with phpBBSSO.php code. When I click on Log in, I've got this error message :

Fatal error: Call to undefined method LoginForm::authenticateUserData() in mypath\wiki\extensions\phpBBSSO\phpBBSSO.php on line 78

Does anybody know where could be the error ?

Swennet (talkcontribs)

The latest MediaWiki update (1.27) made a lot of changes to it's authentication system. This extension probably needs updating to work with 1.27.

Reply to "Fatal error: Call to undefined method LoginForm::authenticateUserData()"

Fatal error: Cannot redeclare deregister_globals()

2
118.152.0.36 (talkcontribs)

When trying to skin the vector template I keep getting this error. It appears across the whole mw header.

" Fatal error: Cannot redeclare deregister_globals() (previously declared in /home/user/www/phpBB3/includes/startup.php:36) in /home/user/www/phpBB3/includes/startup.php on line 85 "

I'm running MW 1.26 and phpBB 3.1.6, and applied the below modifications. Sorry for my lack of knowledge.

128.72.54.22 (talkcontribs)

Got same problem. Solution is:

In vector template change phpbbUser declaration to

global $wgPhpbbSSO;

$phpbbUser = $wgPhpbbSSO;

Reply to "Fatal error: Cannot redeclare deregister_globals()"

It still works. MW 1.26 and phpBB 3.1.6

5
AJ Quick (talkcontribs)

I am now running the latest versions of MW and phpBB. Everything still works.

There is one bug with phpBB that may cause an error. It requires changing the follow line in /phpbb/path_helper.php (line 230-233)

Change from:

// Prepend ../ to the phpbb_root_path as many times as / exists in path_info
$this->web_root_path = $this->filesystem->clean_path(
'./' . str_repeat('../', $corrections) . $this->phpbb_root_path
);

To this:

// Prepend ../ to the phpbb_root_path as many times as / exists in path_info
$this->web_root_path = $this->filesystem->clean_path(
'./' . str_repeat('../', $corrections > 0 ? $corrections : 0) . $this->phpbb_root_path
);
65.92.160.3 (talkcontribs)

Thanks for your work!

I'd love to test it out but unfortunately the extension page is missing the download link and I couldn't find anything on Google.

98.118.10.171 (talkcontribs)

For some reason, when I put:

$wgPhpbbSSO_Forum_Location = 'home/####/website/althon_bb/';  //Using your  absolute server path to this would be better; trailing slash required - e.g.  /home/user/www/forum/   
require_once("$IP/extensions/phpbSSO/phpbSSO.php");
$wgAuth = new Auth_remoteuser();

function noLoginLogOUt(&$list) {
        unset( $list['Userlogout'] );
        unset( $list['Userlogin'] );
        return true;
}

$wgHooks['SpecialPage_initList'][]='noLoginLogOUt';

into my wiki LocalSettings file, the wiki crashes and gives an error code of 500.

I'm running MW1.26 and phpBB 3.1.6

What am I doing wrong?

98.118.10.171 (talkcontribs)

I scrolled a bit further and am trying the solution posted about 10 months ago.

98.118.10.171 (talkcontribs)

So, the specific problem seems to be this line:

$wgAuth = new Auth_remoteuser();

All the other lines are saved into the LocalSettings.php file without crashing MediaWiki.

Reply to "It still works. MW 1.26 and phpBB 3.1.6"

Phpbb Single Sign-On No Longer Works with MediaWiki 1.24.x?

6
108.47.157.29 (talkcontribs)

Just Installed the latest MediaWiki 1.24.1. The below $wgPhpbbSSO was working in 1.23.x but after moving to 1.24 it requires the fully qualified Path for the wiki to load correctly. However even if the wiki loads I am still unable use the module, It logs me out of phpbb3 instead. Any updates to make this work?

#$wgPhpbbSSO_Forum_Location = './../phpBB3/'; //Using your absolute server path to this would be better; trailing slash required - e.g. /home/user/www/forum/   
$wgPhpbbSSO_Forum_Location = '/var/www/phpBB3/';
require_once("$IP/extensions/phpbSSO/phpbSSO.php");
$wgAuth = new Auth_remoteuser();

function noLoginLogOUt(&$list) {
        unset( $list['Userlogout'] );
        unset( $list['Userlogin'] );
        return true;
}
$wgHooks['SpecialPage_initList'][]='noLoginLogOUt';

Thanks

100.11.93.217 (talkcontribs)

Hello,

I do not know why this code was changed (somebody please inform me if you know why), but you need to go to wiki/includes/User.php and make the following change under public function saveSettings():

Change this

                                'user_password' => $this->mPassword->toString(),
                                'user_newpassword' => $this->mNewpassword->toString(),

to this

                                'user_password' => $this->mPassword,
                                'user_newpassword' => $this->mNewpassword,

Good luck :)

108.13.218.111 (talkcontribs)
64.254.160.199 (talkcontribs)

In MW 1.25.1, PHPBB 3.0.14, the extension doesn't work:

Fatal error: Call to a member function enable_super_globals() on null in /wiki/extensions/phpbSSO/phpbb.php on line 39

89.150.160.25 (talkcontribs)

I get almost the same error in MW1.19.11:

Fatal error: Call to a member function enable_super_globals() on a non-object in /wiki/extensions/phpbSSO/phpbb.php on line 39

71.226.59.128 (talkcontribs)

Anybody have a workaround to the "Call to a member function enable_super_globals() on a non-object" problem?

Reply to "Phpbb Single Sign-On No Longer Works with MediaWiki 1.24.x?"

Parse error: syntax error, unexpected '{', expecting T_FUNCTION session.php on line 1519

2
24.149.59.195 (talkcontribs)

I've been trying to troubleshoot this for a bit but haven't been able to figure out how to fix this on. I fallowed the guide and got it all working except this one error which I'm assuming is because I'm using a later version of MediaWiki.

Parse error: syntax error, unexpected '{', expecting T_FUNCTION .../session.php on line 1519

Any help would be greatly appreciated.

Frug~mediawikiwiki (talkcontribs)

That's a mistake with the code. It says there the file and line number of the mistake and it looks like you made a mistake editing session.php. Nobody can help you with that without seeing the file itself, but you appear to be missing a bracket.

This post was posted by Frug~mediawikiwiki, but signed as Frug.

Reply to "Parse error: syntax error, unexpected '{', expecting T_FUNCTION session.php on line 1519"

Fatal error: Class '__user' not found in /home/mijunkin/public_html/example.com/forum/includes/session.php on line 1501

2
Mijunkin~mediawikiwiki (talkcontribs)

That is all I am getting when going to my wiki. Everything is configured per the instructions. No, I don't have it pointed to example.com, I just changed it for privacy. Help?

This post was posted by Mijunkin~mediawikiwiki, but signed as Mijunkin.

GregariousJB (talkcontribs)

This is the error I'm getting, too, although now it's on a different line:

Fatal error: Class '__user' not found in D:\wamp\www\phpbb\includes\session.php on line 1507

Mediawiki 1.23.5 phpBB 3.0.12

Google is not bringing up anything but this page. Any help out there?

EDIT: Nevermind, found the problem. I copy/pasted the "replace with" box incorrectly and didn't include the changed "class __user extends session" line at the bottom.
Reply to "Fatal error: Class '__user' not found in /home/mijunkin/public_html/example.com/forum/includes/session.php on line 1501"