diff --git a/README.md b/README.md index 302d22c..a41fbc9 100644 --- a/README.md +++ b/README.md @@ -33,4 +33,42 @@ Migrate database dan seeder ``` php artisan migrate --seed #username dan password akan muncul setelah migrate -``` \ No newline at end of file +``` + +Check SSO session : app\Http\Controllers\Sso.php + +``` +public function check() +{ + $objSso = new SsoClientLibrary(); + $objSso->ssoRequest(); +} + +``` + +Consume SSO session : app\Http\Controllers\Sso.php + +``` +public function callback(Request $request) +{ + if (isset($request->code) && $request->code != '') { + $objSso = new SsoClientLibrary(); + $data_access_token = $objSso->ssoCallback(); + if (!empty($data_access_token)) { + $data_access_token = json_decode($data_access_token); + $access_token = $data_access_token->access_token; // store access_token within the session if needed? + } + + if ($access_token != '') { + //fetch ssoUserInfo + $ssoUserInfo = $objSso->ssoUserInfo($access_token); + $ssoUserInfo = json_decode($ssoUserInfo); + + // check if sso_email already mapped or not + $user = User::where('sso_email', $ssoUserInfo->email)->first(); + // mapping to local database + } + } +} + +```