Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
feat: get service account user
Browse files Browse the repository at this point in the history
  • Loading branch information
Satya Kresna committed Jul 26, 2022
1 parent 3c7b6c2 commit a0248c6
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,37 @@ public function getUsersInRole($client_id, $role_name, $params = array())

return $result;
}

public function getServiceAccountUser($client_id)
{
$curl = curl_init();

$query = '';
if (isset($params)) {
$query = http_build_query($params);
}

curl_setopt_array($curl, array(
CURLOPT_URL => "{$this->getAdminRealmUrl()}/clients/{$client_id}/service-account-user",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer '.$this->getToken()
),
));

$response = curl_exec($curl);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);

return array(
'data' => json_decode($response, true),
'code' => (int) $httpcode
);
}
}

0 comments on commit a0248c6

Please sign in to comment.