summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2023-05-15 23:48:37 +0200
committerGitHub <noreply@github.com>2023-05-15 23:48:37 +0200
commitde77a03c246154e02425e6cda17218921a1f50b8 (patch)
tree04b861ac8f15ae926ae2e6bcf3cc62ee540e4559 /apps
parentedfcac73b5174cac7ddb3daa9dd4bd3d3fda3bd5 (diff)
parentcd2ebbff08c5043d5e128987dc8f1fcc92f0b453 (diff)
downloadnextcloud-server-de77a03c246154e02425e6cda17218921a1f50b8.tar.gz
nextcloud-server-de77a03c246154e02425e6cda17218921a1f50b8.zip
Merge pull request #38281 from nextcloud/session-auth-check-username-26
[26] check the username when doing external storage session auth
Diffstat (limited to 'apps')
-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());
}