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 0b143146ca3010ba71e019e14d438e10bac263de
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