Bridge

Since version 1.3, MushRaider support single sign on also named Bridge.

To download the bridge plugin for your CMS/forum head to the download page.

 

Enable single sign on

In your website

  1. Install and configure the plugin for your system (phpBB, Drupal…)
  2. Save the url and the secret key for later use

In MushRaider

  1. Go to the admin panel
  2. Settings => Bridge
  3. Insert the url gave by your website’s plugin
  4. Insert the secret key gave par your website’s plugin
  5. Check the enable checkbox and save

You can now sign in with your website’s credentials in MushRaider

/!\ If the system don’t work (and so you can’t connect in MushRaider anymore) adn you want to disable it you have the delete in your database table “settings” the row “bridge” /!\

 

Create your own single sign on plugin for MushRaider

First, I already love you =)

The MushRaider’s bridge API is very simple. HTTP request is sent to the plugin with the login and crypted password, et you only have to return json with the auth credentials, easy right ?

A small exemple :

/*
Bridge exemple for MushRaider
More infos on http://mushraider.com/bridge
*/
header('Content-Type: application/json');
// Secret key added in MushRaider's admin
$salt = 'YOUR_SECRET_KEY';
// Test if we get the login & password infos
if(empty($_POST['login']) || empty($_POST['pwd'])) {
    echo json_encode(array('authenticated' => false));
    exit;
}
// Decrypt password
// No reason to change this
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$pwd = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $salt, stripslashes($_POST['pwd']), MCRYPT_MODE_ECB, $iv);
/*
* Test here if the user exist and have the good permissions etc...
* Code goes here...
*/
// Return json to mushraider
$userInfos = array();
$userInfos['authenticated'] = true; // Or false if don't
$userInfos['email'] = '[email protected]'; // Replace it with the user's email, offcourse
$userInfos['role'] = 'member'; // Optional parameter, force & set the role for this user. Can be 'member' (default), 'officer' or 'admin'
echo json_encode($userInfos);
exit;

This is the simplest exemple for MushRaider single sign on plugin, you can adapat this code to your own system. If you have any problem or question feel free to head to the forum.

Si vous aimez (ou pas), partagez...Share on FacebookTweet about this on TwitterShare on Google+Share on Reddit