From 2c754ad33b5b0444b1bb7cbcfc5363344ac5f03b Mon Sep 17 00:00:00 2001 From: "Mhd. Salahuddin Al Arif" Date: Mon, 3 Oct 2022 15:02:03 +0700 Subject: [PATCH] add ssoLogout --- README.md | 6 ++++++ src/SsoClientLibrary.php | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/README.md b/README.md index 17adb4b..d35afa9 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,10 @@ if ($access_token != '') { $email = $ssoUserInfo->email; } +``` + +```$php +$url_back = {return_url}; +$objSso = new SsoClientLibrary(); +$objSso->ssoLogout($url_back); ``` \ No newline at end of file diff --git a/src/SsoClientLibrary.php b/src/SsoClientLibrary.php index 315e9d1..8cfa98f 100644 --- a/src/SsoClientLibrary.php +++ b/src/SsoClientLibrary.php @@ -125,4 +125,14 @@ class SsoClientLibrary { die('Something went wrong, please trace back your action!'); } + public function ssoLogout($url_back = '') { + $query = http_build_query([ + 'url_back' => $url_back, + ]); + + $_url = $this->targetUri ."sso/logout?" . $query; + header("Location: " . $_url); + die(); + } + } \ No newline at end of file -- 2.7.4