Skip to content

Commit a3174fb

Browse files
committed
Merge branch 'main' into fixes/auke
2 parents e7fb606 + 17a56b2 commit a3174fb

4 files changed

Lines changed: 28 additions & 15 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
}
1616
],
1717
"require": {
18-
"pdsinterop/solid-auth": "v0.13.0",
19-
"pdsinterop/solid-crud": "v0.8.3",
18+
"pdsinterop/solid-auth": "v0.14.1",
19+
"pdsinterop/solid-crud": "v0.8.4",
2020
"phpmailer/phpmailer": "^6.10",
2121
"sweetrdf/easyrdf": "~1.15.0",
2222
"phpseclib/bcmath_compat": "^2.0",

lib/ClientRegistration.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55

66
class ClientRegistration {
77
public static function getRegistration($clientId) {
8-
if (preg_match("/^http(s)?:/", $clientId)) {
9-
return self::getRemoteRegistration($clientId);
10-
}
11-
128
Db::connect();
139
$query = Db::$pdo->prepare(
1410
'SELECT clientData FROM clients WHERE clientId=:clientId'
@@ -20,6 +16,14 @@ public static function getRegistration($clientId) {
2016
if (sizeof($result) === 1) {
2117
return json_decode($result[0]['clientData'], true);
2218
}
19+
if (preg_match("/^http(s)?:/", $clientId)) {
20+
$clientData = self::getRemoteRegistration($clientId);
21+
if (!isset($clientData['origin']) && isset($clientData['client_uri'])) {
22+
$clientData['origin'] = rtrim($clientData['client_uri'], '/');
23+
}
24+
self::saveClientRegistration($clientData);
25+
return $clientData;
26+
}
2327
return false;
2428
}
2529

lib/Routes/SolidIdp.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,17 @@ public static function respondToAuthorize() {
9090

9191
$response = $authServer->respondToAuthorizationRequest($request, $user, $approval);
9292

93-
$tokenGenerator = Server::getTokenGenerator();
93+
if (in_array("id_token", $requestedResponseTypes)) {
94+
$tokenGenerator = Server::getTokenGenerator();
9495

95-
$response = $tokenGenerator->addIdTokenToResponse(
96-
$response,
97-
$clientId,
98-
$webId,
99-
$_SESSION['nonce'] ?? '',
100-
Server::getKeys()["privateKey"]
101-
);
96+
$response = $tokenGenerator->addIdTokenToResponse(
97+
$response,
98+
$clientId,
99+
$webId,
100+
$_SESSION['nonce'] ?? '',
101+
Server::getKeys()["privateKey"]
102+
);
103+
}
102104

103105
Server::respond($response);
104106
}

lib/Routes/SolidStorage.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ public static function respondToStorage() {
3636
$resourceServer->setBaseUrl($baseUrl);
3737
$wac->setBaseUrl($baseUrl);
3838

39-
$webId = StorageServer::getWebId($rawRequest);
39+
try {
40+
$webId = StorageServer::getWebId($rawRequest);
41+
} catch(\Exception $e) {
42+
$response = $resourceServer->getResponse()
43+
-> withStatus(400, "Bad request");
44+
StorageServer::respond($response);
45+
exit();
46+
}
4047

4148
if (!isset($webId)) {
4249
$response = $resourceServer->getResponse()

0 commit comments

Comments
 (0)