Skip to content
Merged
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
check the username when doing external storage session auth
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed May 15, 2023
commit 9163d21e541e82fd8485f7890f2ab9364e2e09a9
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use OCP\Authentication\Exceptions\CredentialsUnavailableException;
use OCP\Authentication\LoginCredentials\IStore as CredentialsStore;
use OCP\Files\Storage;
use OCP\Files\StorageAuthException;
use OCP\IL10N;
use OCP\IUser;

Expand Down Expand Up @@ -58,6 +59,10 @@ public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = n
throw new InsufficientDataForMeaningfulAnswerException('No session credentials saved');
}

if ($credentials->getUID() !== $user->getUID()) {
throw new StorageAuthException('Session credentials for storage owner not available');
}

$storage->setBackendOption('user', $credentials->getLoginName());
$storage->setBackendOption('password', $credentials->getPassword());
}
Expand Down