Skip to content

Commit

Permalink
update 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Irsad Arief committed Apr 27, 2020
1 parent 8162a19 commit 80903e8
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 6 deletions.
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

## Instalasi

Untuk menginstall, gunakan composer:
Untuk menginstall, anda dapat menggunakan composer:

```
composer require irsadarief/jkd-sso
Expand Down Expand Up @@ -62,8 +62,20 @@ if (!isset($_GET['code'])) {
try {

$user = $provider->getResourceOwner($token);

printf('Hello %s!', $user->getName());
echo "Nama : " $user->getName();
echo "E-Mail : " $user->getEmail();
echo "Username : " $user->getUsername();
echo "NIP : " $user->getNip();
echo "NIP Baru : " $user->getNipBaru();
echo "Kode Organisasi : " $user->getKodeOrganisasi();
echo "Kode Provinsi : " $user->getKodeProvinsi();
echo "Kode Kabupaten : " $user->getKodeKabupaten();
echo "Alamat Kantor : " $user->getAlamatKantor();
echo "Provinsi : " $user->getProvinsi();
echo "Kabupaten : " $user->getKabupaten();
echo "Golongan : " $user->getGolongan();
echo "Jabatan : " $user->getJabatan();
echo "Eselon : " $user->getEselon();

} catch (Exception $e) {
exit('Gagal Mendapatkan Data Pengguna: '.$e->getMessage());
Expand All @@ -73,6 +85,13 @@ if (!isset($_GET['code'])) {
echo $token->getToken();
}
```
Penggunaan API untuk mengakses data pegawai dapat melihat pada [api-pegawai](https://git.bps.go.id/jkd-repo/api-pegawai).

## Mendapatkan link Logout
```php
$url_logout = $provider->getLogoutUrl()
```


## Memperbarui Token

Expand Down
46 changes: 43 additions & 3 deletions src/Provider/KeycloakResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function getId()

public function getEmail()
{
return $this->response['preferred_username']."@bps.go.id" ?: null;
return $this->response['username']."@bps.go.id" ?: null;
}

public function getName()
Expand All @@ -35,12 +35,12 @@ public function getName()

public function getNip()
{
return $this->response['nip'] ?: null;
return $this->response['nip-lama'] ?: null;
}

public function getUsername()
{
return $this->response['preferred_username'] ?: null;
return $this->response['username'] ?: null;
}

public function getnamaDepan()
Expand All @@ -52,6 +52,46 @@ public function getNamaBelakang()
{
return $this->response['family_name'] ?: null;
}
public function getProvinsi()
{
return $this->response['provinsi'] ?: null;
}
public function getKodeOrganisasi()
{
return $this->response['organisasi'] ?: null;
}
public function getKodeProvinsi()
{
return substr($this->response['organisasi'],0,2) ?: null;
}
public function getKodeKabupaten()
{
return substr($this->response['organisasi'],2,2) ?: null;
}
public function getAlamatKantor()
{
return $this->response['alamat-kantor'] ?: null;
}
public function getJabatan()
{
return $this->response['jabatan'] ?: null;
}
public function getGolongan()
{
return $this->response['golongan'] ?: null;
}
public function getKabupaten()
{
return $this->response['kabupaten'] ?: null;
}
public function getNipBaru()
{
return $this->response['nip'] ?: null;
}
public function getEselon()
{
return $this->response['eselon'] ?: null;
}
public function toArray()
{
return $this->response;
Expand Down

0 comments on commit 80903e8

Please sign in to comment.