Skip to content

Commit d5745cf

Browse files
committed
also store the 'origin' as a client registration instead of only a hash.
provide functions to list and remove client registrations
1 parent d5c2dba commit d5745cf

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

solid/lib/ServerConfig.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ public function getClientConfigById($clientId) {
6868
return null;
6969
}
7070

71+
/**
72+
* @return array|null
73+
*/
74+
public function getClients() {
75+
$clients = (array)$this->config->getAppKeys('solid');
76+
return $clients;
77+
}
78+
7179
/**
7280
* @param array $clientConfig
7381
* @return string
@@ -151,9 +159,15 @@ public function saveClientRegistration($origin, $clientData) {
151159
$clientData['client_name'] = $origin;
152160
$clientData['client_secret'] = md5(random_bytes(32));
153161
$this->config->setAppValue('solid', "client-" . $originHash, json_encode($clientData));
162+
163+
$this->config->setAppValue('solid', "client-" . $origin, json_encode($clientData));
154164
return $originHash;
155165
}
156166

167+
public function removeClientRegistration($clientId) {
168+
$this->config->deleteAppValue('solid', "client-" . $clientId);
169+
}
170+
157171
public function getClientRegistration($clientId) {
158172
$data = $this->config->getAppValue('solid', "client-" . $clientId, "{}");
159173
return json_decode($data, true);

0 commit comments

Comments
 (0)