Iniadalah package yang di gunakan untuk sso client pemprov banten, dan package ini masih versi beta, found some bugs, text me at 085711511295 or drop email to ahmadnorin@gmail.com
Note:
- Package ini masih dalam tahap pengembangan.
- package ini di gunakan untuk sso app provinsi banten.
- Package ini untuk laravel 5.2 keatas.
composer require ahmadlab/cas 0.1.*-dev
tambahan class ini pada file config/app.php
Ahmadlab\Cas\CasServiceProvider::class,
SSO_URL=http://sso.dev
SSO_APPID=212
SSO_SECRET=secret
SSO_CALLBACK=http://cas.dev/callback
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Ahmadlab\Cas\Cas;
use Redirect;
class DevelController extends Controller
{
public function Login()
{
$email = "ahmadnorin@gmail.com";
$password = "karawang";
$post = [
'email' => $email,
'password' => $password,
'appid' => env('SSO_APPID'),
'secret' => env('SSO_SECRET'),
'callback' => env('SSO_CALLBACK')
];
$data = new Cas();
$data->Attempt($post);
if($data->Fails())
{
dd($data->message());
}
else
{
//return token
//dd($data->Token());
//dapetin data profile
$profile = $data->profile($data->token());
dd($profile);
// dapetin data role
dd($profile->role());
//dapetin data id
dd($profile->id());
//dapetin data message
dd($profile->messages);
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\SsoClient\Sso;
use Ahmadlab\Karawang\Karawang;
use Ahmadlab\Cas\Cas;
use Redirect;
class DevelController extends Controller
{
public function cas(Request $request)
{
$data = new Cas;
$app = [
'appid' => env('SSO_APPID'),
'secret' => env('SSO_SECRET'),
'callback' => env('SSO_CALLBACK')
];
return $data->cas($app);
}
public function callback(Request $request)
{
$data = new Cas();
//dd($data->Token());
$profile = $data->profile($request->get('token'));
$profile = $data->profile($data->token());
dd($profile);
// dapetin data role
dd($profile->role());
//dapetin data id
dd($profile->id());
//dapetin data message
dd($profile->messages);
}
}