summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2023-05-15 23:48:34 +0200
committerGitHub <noreply@github.com>2023-05-15 23:48:34 +0200
commitf1a1361e0d294d664c5472217a1bf98a92b0856a (patch)
treec2c946f4490dd2495e46b91ec95487b7dc5e8a8a /apps/files_external
parent864aa1b61a8a67508720a568db3bb83f6b9dd300 (diff)
parent2466724b018f07753cb694e313149b09a2afa643 (diff)
downloadnextcloud-server-f1a1361e0d294d664c5472217a1bf98a92b0856a.tar.gz
nextcloud-server-f1a1361e0d294d664c5472217a1bf98a92b0856a.zip
Merge pull request #38265 from nextcloud/session-auth-check-username
check the username when doing external storage session auth
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php b/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php
index dbe5a2fdc20..228366db204 100644
--- a/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php
+++ b/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php
@@ -30,6 +30,7 @@ use OCA\Files_External\Lib\StorageConfig;
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;
@@ -57,6 +58,10 @@ class SessionCredentials extends AuthMechanism {
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());
}