Commit 373f3710cdd5b58dc4174a8ffbb4ae96864abc5d
1 parent
a4729f293a
Exists in
master
add github link
Showing 1 changed file with 4 additions and 1 deletions Inline Diff
README.md
| 1 | ## SSO Riau | 1 | ## SSO Riau |
| 2 | SSO Riau | 2 | SSO Riau |
| 3 | 3 | ||
| 4 | Construct: | 4 | Construct: |
| 5 | ---- | 5 | ---- |
| 6 | 6 | ||
| 7 | ```$php | 7 | ```$php |
| 8 | $this->clientId = ''; // 3rd Party client Id | 8 | $this->clientId = ''; // 3rd Party client Id |
| 9 | $this->clientSecret = ''; // 3rd Party client secret | 9 | $this->clientSecret = ''; // 3rd Party client secret |
| 10 | $this->redirectUri = ''; // 3rd Party url redirect or url to handle callback | 10 | $this->redirectUri = ''; // 3rd Party url redirect or url to handle callback |
| 11 | $this->targetUri = 'https://sso.riau.go.id/'; // SSO Riau portal | 11 | $this->targetUri = 'https://sso.riau.go.id/'; // SSO Riau portal |
| 12 | 12 | ||
| 13 | ``` | 13 | ``` |
| 14 | Check SSO session : | 14 | Check SSO session : |
| 15 | ---- | 15 | ---- |
| 16 | 16 | ||
| 17 | ```$php | 17 | ```$php |
| 18 | use SsoRiau\SsoClientLibrary; | 18 | use SsoRiau\SsoClientLibrary; |
| 19 | $objSso = new SsoClientLibrary(); | 19 | $objSso = new SsoClientLibrary(); |
| 20 | $objSso->ssoRequest(); | 20 | $objSso->ssoRequest(); |
| 21 | 21 | ||
| 22 | ``` | 22 | ``` |
| 23 | Consume SSO session : | 23 | Consume SSO session : |
| 24 | ---- | 24 | ---- |
| 25 | 25 | ||
| 26 | ```$php | 26 | ```$php |
| 27 | use SsoRiau\SsoClientLibrary; | 27 | use SsoRiau\SsoClientLibrary; |
| 28 | $objSso = new SsoClientLibrary(); | 28 | $objSso = new SsoClientLibrary(); |
| 29 | $data_access_token = $objSso->ssoCallback(); | 29 | $data_access_token = $objSso->ssoCallback(); |
| 30 | if (!empty($data_access_token)) { | 30 | if (!empty($data_access_token)) { |
| 31 | $data_access_token = json_decode($data_access_token); | 31 | $data_access_token = json_decode($data_access_token); |
| 32 | $access_token = $data_access_token->access_token; // store access_token within the session if needed? | 32 | $access_token = $data_access_token->access_token; // store access_token within the session if needed? |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | if ($access_token != '') { | 35 | if ($access_token != '') { |
| 36 | //fetch ssoUserInfo | 36 | //fetch ssoUserInfo |
| 37 | $ssoUserInfo = $objSso->ssoUserInfo($access_token); | 37 | $ssoUserInfo = $objSso->ssoUserInfo($access_token); |
| 38 | $ssoUserInfo = json_decode($ssoUserInfo); | 38 | $ssoUserInfo = json_decode($ssoUserInfo); |
| 39 | $email = $ssoUserInfo->email; | 39 | $email = $ssoUserInfo->email; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | ``` | 42 | ``` |
| 43 | Logout SSO session : | 43 | Logout SSO session : |
| 44 | ---- | 44 | ---- |
| 45 | 45 | ||
| 46 | ```$php | 46 | ```$php |
| 47 | use SsoRiau\SsoClientLibrary; | 47 | use SsoRiau\SsoClientLibrary; |
| 48 | 48 | ||
| 49 | $url_back = {return_url}; | 49 | $url_back = {return_url}; |
| 50 | $objSso = new SsoClientLibrary(); | 50 | $objSso = new SsoClientLibrary(); |
| 51 | $objSso->ssoLogout($url_back); | 51 | $objSso->ssoLogout($url_back); |
| 52 | ``` | 52 | ``` |
| 53 | ## Integration in Laravel | ||
| 54 | |||
| 55 | [https://github.com/ojisatriani/ssoriau](https://github.com/ojisatriani/ssoriau) |