Commit 38a123bb75ea02d1be73d1471237e34dac25c94f

Authored by Mhd Salahuddin Al Arif
Exists in master

Merge branch 'master' of https://gitlab.riau.go.id/oji/ssoriau

Showing 1 changed file 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 $objSso = new SsoClientLibrary(); 28 $objSso = new SsoClientLibrary();
28 $data_access_token = $objSso->ssoCallback(); 29 $data_access_token = $objSso->ssoCallback();
29 if (!empty($data_access_token)) { 30 if (!empty($data_access_token)) {
30 $data_access_token = json_decode($data_access_token); 31 $data_access_token = json_decode($data_access_token);
31 $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?
32 } 33 }
33 34
34 if ($access_token != '') { 35 if ($access_token != '') {
35 //fetch ssoUserInfo 36 //fetch ssoUserInfo
36 $ssoUserInfo = $objSso->ssoUserInfo($access_token); 37 $ssoUserInfo = $objSso->ssoUserInfo($access_token);
37 $ssoUserInfo = json_decode($ssoUserInfo); 38 $ssoUserInfo = json_decode($ssoUserInfo);
38 $email = $ssoUserInfo->email; 39 $email = $ssoUserInfo->email;
39 } 40 }
40 41
41 ``` 42 ```
42 43
43 ```$php 44 ```$php
44 $url_back = {return_url}; 45 $url_back = {return_url};
45 $objSso = new SsoClientLibrary(); 46 $objSso = new SsoClientLibrary();
46 $objSso->ssoLogout($url_back); 47 $objSso->ssoLogout($url_back);
47 ``` 48 ```