Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"pdsinterop/solid-auth": "v0.13.0",
"pdsinterop/solid-auth": "v0.14.1",
"pdsinterop/solid-crud": "v0.8.3",
"phpmailer/phpmailer": "^6.10",
"sweetrdf/easyrdf": "~1.15.0",
Expand Down
12 changes: 8 additions & 4 deletions lib/ClientRegistration.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@

class ClientRegistration {
public static function getRegistration($clientId) {
if (preg_match("/^http(s)?:/", $clientId)) {
return self::getRemoteRegistration($clientId);
}

Db::connect();
$query = Db::$pdo->prepare(
'SELECT clientData FROM clients WHERE clientId=:clientId'
Expand All @@ -20,6 +16,14 @@ public static function getRegistration($clientId) {
if (sizeof($result) === 1) {
return json_decode($result[0]['clientData'], true);
}
if (preg_match("/^http(s)?:/", $clientId)) {
$clientData = self::getRemoteRegistration($clientId);
if (!isset($clientData['origin']) && isset($clientData['client_uri'])) {
$clientData['origin'] = preg_replace("/\/$/", "", $clientData['client_uri']);
Comment thread
ylebre marked this conversation as resolved.
Outdated
}
self::saveClientRegistration($clientData);
return $clientData;
}
return false;
}

Expand Down
18 changes: 10 additions & 8 deletions lib/Routes/SolidIdp.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,17 @@ public static function respondToAuthorize() {

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

$tokenGenerator = Server::getTokenGenerator();
if (in_array("id_token", $requestedResponseTypes)) {
$tokenGenerator = Server::getTokenGenerator();

$response = $tokenGenerator->addIdTokenToResponse(
$response,
$clientId,
$webId,
$_SESSION['nonce'] ?? '',
Server::getKeys()["privateKey"]
);
$response = $tokenGenerator->addIdTokenToResponse(
$response,
$clientId,
$webId,
$_SESSION['nonce'] ?? '',
Server::getKeys()["privateKey"]
);
}

Server::respond($response);
}
Expand Down
9 changes: 8 additions & 1 deletion lib/Routes/SolidStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ public static function respondToStorage() {
$resourceServer->setBaseUrl($baseUrl);
$wac->setBaseUrl($baseUrl);

$webId = StorageServer::getWebId($rawRequest);
try {
$webId = StorageServer::getWebId($rawRequest);
} catch(\Exception $e) {
$response = $resourceServer->getResponse()
-> withStatus(400, "Bad request");
StorageServer::respond($response);
exit();
}

if (!isset($webId)) {
$response = $resourceServer->getResponse()
Expand Down
Loading