siapble/sso_wso2

Single sign on of WSO2 by Sahapat.

dev-master 2018-08-28 09:38 UTC

This package is auto-updated.

Last update: 2024-05-18 17:30:44 UTC


README

  • Begin by installing this package through Composer. Just run following command to terminal.
composer require "siapble/sso_wso2:dev-master"
  • Add the service provider. Open config/app.php, and add a new item to the providers array.
'providers' => [
	...
	siapble\sso_wso2\SingleSignOnServiceProvider::class,
	...
]
  • Add the alias.
'aliases' => [
	...
	'SSO_WSO2' => siapble\sso_wso2\Facades\SSO_WSO2Facade::class,
	...
]
  • Publish config file, Following command to terminal.
php artisan vendor:publish

Code Example

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;
use SSO_WSO2;

class TestController extends Controller
{    
	public function callback(){
		try {

			$request = \Request::all(); 
			if (!array_key_exists('code', $request)) {
				//redirect to index
				return redirect('/');
			}

			$processCode = $request['code'];

			$response = SSO_WSO2::callback($processCode);

			return $response;
	   } catch (Exception $e) {
		   return response()->json(
				array(                      
						'Exception : '=>$e->getMessage()
					)
			);
	   }          
	}

	public function makeurl(){
		try {
			$response = SSO_WSO2::make_authorization_url(url('/sso/callback'));
			return $response['result'];
		} catch (Exception $e) {
			return response()->json(
				array(                      
					'Exception : '=>$e->getMessage()
				)
			);
		}
	}    
}