Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for legacy solid apps (poddit launcher in solid-nextcloud) #140

Merged
merged 18 commits into from
Jan 17, 2024

Conversation

ylebre
Copy link
Member

@ylebre ylebre commented Nov 16, 2023

Adds fixes to get the poddit launcher working. Depends on pdsinterop/php-solid-auth#40

use Pdsinterop\Solid\Auth\Utils\Bearer;
use Pdsinterop\Solid\Auth\Utils\JtiValidator;

trait BearerFactoryTrait
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -304,13 +306,28 @@ public function handleRequest($userId, $path) {

$dpop = $this->getDpop();

$error = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error is set here (and below) but doesn't seem to be used anywhere?

try {
$webId = $dpop->getWebId($request);
} catch(\Pdsinterop\Solid\Auth\Exception\Exception $e) {
$error = $e;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, think this might be more readable/understandable?

		$error = false;

		try {
			$webId = $dpop->getWebId($request);
		} catch(\Pdsinterop\Solid\Auth\Exception\Exception $e) {
			$bearer = $this->getBearer();
			try {
				$webId = $bearer->getWebId($request);
			} catch(\Pdsinterop\Solid\Auth\Exception\Exception $e) {
				$error = $e;
			}
		}

		if ($error instanceof \Pdsinterop\Solid\Auth\Exception\Exception) {
 			$response = $this->resourceServer->getResponse()
				->withStatus(Http::STATUS_CONFLICT, "Invalid token");
		
			return $this->respond($response);
		}

Copy link
Member

@Potherca Potherca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing functionally wrong, I have a stylistic question regarding the changes in the Storage control. The code is good, so feel free to merge as-is if you feel changes are not needed.

Love the BearerFactoryTrait, by the way.

@Potherca Potherca merged commit 407822f into main Jan 17, 2024
20 of 21 checks passed
@Potherca Potherca deleted the fix/poddit-launcher branch January 17, 2024 15:53
@Potherca Potherca added this to the v0.7.3 milestone Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants