Jump to content

Topic on Extension talk:Phpbb Single Sign-On/Flow

Alternate SSO solution

3
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"