|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace JKD\SSO\Client\Provider; |
|
4
|
|
|
|
|
5
|
|
|
use League\OAuth2\Client\Provider\ResourceOwnerInterface; |
|
6
|
|
|
|
|
7
|
|
|
class KeycloakResourceOwner implements ResourceOwnerInterface |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* Raw response |
|
11
|
|
|
* |
|
12
|
|
|
* @var array |
|
13
|
|
|
*/ |
|
14
|
|
|
protected $response; |
|
15
|
|
|
|
|
16
|
|
|
public function __construct(array $response = array()) |
|
17
|
|
|
{ |
|
18
|
|
|
$this->response = $response; |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
public function getId() |
|
22
|
|
|
{ |
|
23
|
|
|
return $this->response['sub'] ?: null; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function getEmail() |
|
27
|
|
|
{ |
|
28
|
|
|
return $this->response['username']."@bps.go.id" ?: null; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function getName() |
|
32
|
|
|
{ |
|
33
|
|
|
return $this->response['name'] ?: null; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function getNip() |
|
37
|
|
|
{ |
|
38
|
|
|
return $this->response['nip-lama'] ?: null; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function getUsername() |
|
42
|
|
|
{ |
|
43
|
|
|
return $this->response['username'] ?: null; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function getnamaDepan() |
|
47
|
|
|
{ |
|
48
|
|
|
return $this->response['given_name'] ?: null; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function getNamaBelakang() |
|
52
|
|
|
{ |
|
53
|
|
|
return $this->response['family_name'] ?: null; |
|
54
|
|
|
} |
|
55
|
|
|
public function getProvinsi() |
|
56
|
|
|
{ |
|
57
|
|
|
return $this->response['provinsi'] ?: null; |
|
58
|
|
|
} |
|
59
|
|
|
public function getKodeOrganisasi() |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->response['organisasi'] ?: null; |
|
62
|
|
|
} |
|
63
|
|
|
public function getKodeProvinsi() |
|
64
|
|
|
{ |
|
65
|
|
|
return substr($this->response['organisasi'],0,2) ?: null; |
|
66
|
|
|
} |
|
67
|
|
|
public function getKodeKabupaten() |
|
68
|
|
|
{ |
|
69
|
|
|
return substr($this->response['organisasi'],2,2) ?: null; |
|
70
|
|
|
} |
|
71
|
|
|
public function getAlamatKantor() |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->response['alamat-kantor'] ?: null; |
|
74
|
|
|
} |
|
75
|
|
|
public function getJabatan() |
|
76
|
|
|
{ |
|
77
|
|
|
return $this->response['jabatan'] ?: null; |
|
78
|
|
|
} |
|
79
|
|
|
public function getGolongan() |
|
80
|
|
|
{ |
|
81
|
|
|
return $this->response['golongan'] ?: null; |
|
82
|
|
|
} |
|
83
|
|
|
public function getKabupaten() |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->response['kabupaten'] ?: null; |
|
86
|
|
|
} |
|
87
|
|
|
public function getNipBaru() |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->response['nip'] ?: null; |
|
90
|
|
|
} |
|
91
|
|
|
public function getEselon() |
|
92
|
|
|
{ |
|
93
|
|
|
return $this->response['eselon'] ?: null; |
|
94
|
|
|
} |
|
95
|
|
|
public function getUrlFoto() |
|
96
|
|
|
{ |
|
97
|
|
|
return $this->response['foto'] ?: null; |
|
98
|
|
|
} |
|
99
|
|
|
public function toArray() |
|
100
|
|
|
{ |
|
101
|
|
|
return $this->response; |
|
102
|
|
|
} |
|
103
|
|
|
} |
|
104
|
|
|
|