Commit a4729f293a80e8c03741d2ab857893eec63026cf

Authored by Mhd Salahuddin Al Arif
1 parent 9f0c039a9a
Exists in master

add note

Showing 1 changed file with 1 additions and 2 deletions Inline Diff

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
44 ```
45 Logout SSO session : 43 Logout SSO session :
46 ---- 44 ----
45
47 ```$php 46 ```$php
48 use SsoRiau\SsoClientLibrary; 47 use SsoRiau\SsoClientLibrary;
49 48
50 $url_back = {return_url}; 49 $url_back = {return_url};
51 $objSso = new SsoClientLibrary(); 50 $objSso = new SsoClientLibrary();
52 $objSso->ssoLogout($url_back); 51 $objSso->ssoLogout($url_back);