Commit 9f0c039a9aff05ca64c4c3a884e62b211138ace3
1 parent
38a123bb75
Exists in
master
add note
Showing 1 changed file with 5 additions and 0 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 | 43 | ||
44 | ``` | ||
45 | Logout SSO session : | ||
46 | ---- | ||
44 | ```$php | 47 | ```$php |
48 | use SsoRiau\SsoClientLibrary; | ||
49 | |||
45 | $url_back = {return_url}; | 50 | $url_back = {return_url}; |
46 | $objSso = new SsoClientLibrary(); | 51 | $objSso = new SsoClientLibrary(); |
47 | $objSso->ssoLogout($url_back); | 52 | $objSso->ssoLogout($url_back); |
48 | ``` | 53 | ``` |