Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions src/Entity/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class Client implements ClientEntityInterface
* @param bool $isConfidential
*/
public function __construct(
string $identifier = null,
string $name = null,
array $redirectUri = null,
?string $identifier = null,
?string $name = null,
?array $redirectUri = null,
bool $isConfidential = false
) {
$this->isConfidential = $isConfidential;
Expand Down
6 changes: 3 additions & 3 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ final public function respondToDynamicClientRegistrationRequest(Request $request

final public function respondToAuthorizationRequest(
Request $request,
User $user = null,
bool $authorizationApproved = null,
callable $callback = null
?User $user = null,
?bool $authorizationApproved = null,
?callable $callback = null
) : Response {
$serverConfig = $this->config->getServer();
$authorizationServer = $this->authorizationServer;
Expand Down
1 change: 0 additions & 1 deletion src/TokenGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ public function addIdTokenToResponse($response, $clientId, $subject, $nonce, $pr
if (isset($body['error'])) {
return $response;
}

$accessToken = $this->generateAccessToken($clientId, $subject);
$accessToken = $this->bindDpop($dpop, $accessToken);
$accessToken = $this->signToken($accessToken);
Expand Down
23 changes: 11 additions & 12 deletions src/WAC.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public function isAllowed($request, $webId, $origin=false, $allowedOrigins=[]) {
$uri = $request->getUri();
$parentUri = $this->getParentUri($uri);

// @FIXME: $origin can be anything at this point, null, string, array, bool
// This causes trouble downstream where an unchecked `parse_url($origin)['host'];` occurs
// @FIXME: $origin can be anything at this point, null, string, array, bool
// This causes trouble downstream where an unchecked `parse_url($origin)['host'];` occurs

foreach ($requestedGrants as $requestedGrant) {
foreach ($requestedGrants as $requestedGrant) {
switch ($requestedGrant['type']) {
case "resource":
if ($this->isPublicGranted($requestedGrant['grants'], $uri)) {
Expand Down Expand Up @@ -141,9 +141,9 @@ private function isOriginGranted($requestedGrants, $uri, $origin, $allowedOrigin
) {
return true;
}
//error_log("REQUESTED GRANT: " . join(" or ", $requestedGrants) . " on $uri");
// error_log("REQUESTED GRANT: " . join(" or ", $requestedGrants) . " on $uri");
$grants = $this->getOriginGrants($uri, $origin);
//error_log("GRANTED GRANTS for origin $origin: " . json_encode($grants));
// error_log("GRANTED GRANTS for origin $origin: " . json_encode($grants));
return $this->checkGrants($requestedGrants, $uri, $grants);
}

Expand Down Expand Up @@ -307,14 +307,13 @@ private function getAclPath($path) {

foreach ($aclOptions as $aclPath) {
if (
$this->filesystem->has($aclPath)
&& $this->filesystem->read($aclPath) !== false
$this->filesystem->has($aclPath) && $this->filesystem->read($aclPath) !== false
) {
return $aclPath;
}
}

//error_log("Seeking .acl from $path");
// error_log("Seeking .acl from $path");
// see: https://github.com/solid/web-access-control-spec#acl-inheritance-algorithm
// check for acl:default predicate, if not found, continue searching up the directory tree
return $this->getParentAcl($path);
Expand All @@ -323,10 +322,10 @@ private function normalizePath($path) {
return preg_replace("|//|", "/", $path);
}
private function getParentAcl($path) {
//error_log("GET PARENT ACL $path");
if ($this->filesystem->has($path.'/.acl')) {
//error_log("CHECKING ACL FILE ON $path/.acl");
return $path . "/.acl";
// error_log("GET PARENT ACL $path");
if ($this->filesystem->has($this->normalizePath($path.'/.acl'))) {
// error_log("CHECKING ACL FILE ON $path/.acl");
return $this->normalizePath($path . "/.acl");
}
$parent = dirname($path);
if ($parent == $path) {
Expand Down
Loading