diff options
author | Robin Appelman <robin@icewind.nl> | 2023-05-15 23:48:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-15 23:48:37 +0200 |
commit | de77a03c246154e02425e6cda17218921a1f50b8 (patch) | |
tree | 04b861ac8f15ae926ae2e6bcf3cc62ee540e4559 /apps | |
parent | edfcac73b5174cac7ddb3daa9dd4bd3d3fda3bd5 (diff) | |
parent | cd2ebbff08c5043d5e128987dc8f1fcc92f0b453 (diff) | |
download | nextcloud-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.php | 5 |
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()); } |