Flarum SSO

A SSO extension for flarum.

Compatible with Flarum 0.1.0-beta.13

1 downloads

released on Jun 5, 2020

0
0

Flarum SSO

License Latest Stable Version

A Flarum extension. A SSO extension for flarum.

!!! Attention !!!

It is NOT fully tested. Do NOT install it in production.

Installation

Use Bazaar or install manually with composer:

composer require fly3949/flarum-ext-sso

How To Use

After installation, you should generate a secret key (strong enough) and fill it into the extension setting page.

Then, in your app, redirect your user to the login url:

https://example.com/session/sso_login?
    [email protected] &
    id=1 &
    username=example &
    time=1591359188 &
    signature=3ec02dd23291fbed8faac4cef71b5f284c0ff955cc1d27f5e30efabe4ee40008

Here is the example code (in a Laravel app):

$email = '[email protected]';
$id = 1;
$username = 'example';
$now = Carbon::now()->timestamp;
$secret = env('FLARUM_SSO_KEY'); // for example: VRSW1xDk1e1gsC8zIOaOiJhg6xTKrqm4o6Gt7LAS

$data = [
    'email' => $email,
    'id' => $id,
    'username' => $username,
    'time' => $now,
    'signature' => hash_hmac('sha256', $email . $id . $username . $now, $secret)
];

$query = http_build_query($data);

return redirect('https://example.com/session/sso_login?' . $query);

Updating

composer update fly3949/flarum-ext-sso

Links

Thanks To

© 2020 Hyn by DaniĆ«l "Luceos" Klabbers. All rights reserved. · Extensions and extension information is provided by the respective (copyright holding) authors. · Images on Extiverse pages are from Unsplash.