tinfot / discourse-sso
Laravel Discourse SSO
0.0.3
2018-03-12 03:49 UTC
Requires
- php: >=5.6.4
Requires (Dev)
- ext-curl: *
- mockery/mockery: ~0.9
- phpunit/phpunit: ~4.8
This package is not auto-updated.
Last update: 2024-11-08 07:56:27 UTC
README
Installation
Require this package in your composer.json and update composer.
composer require tinfot/discourse-sso:dev-master
Usage
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Tinfot\Discourse\Payload; use Tinfot\Discourse\User; use Tinfot\Discourse\Sso; class DiscourseController extends Controller { public function sso(Request $request) { $payload = new Payload(config('discourse.secret')); if (!$payload->validate($request->input('sso'), $request->input('sig'))) { abort(404); } $auth = $request->user(); $nonce = $payload->decode($request->input('sso')); $sso = new Sso($nonce, config('discourse.secret')); $sso->setParameters(new User($auth->id, $auth->email, $auth->name)); $data = $sso->build($payload); return redirect(config('discourse.discourse_url') . $data); } }
Support
Support only through Github. Please don't mail us about issues, make a Github issue instead.