Skip to content

Commit b455726

Browse files
authored
Merge pull request #38287 from nextcloud/session-auth-check-username-20
[20] check the username when doing external storage session auth
2 parents d49e40b + 9b5c964 commit b455726

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
use OCP\Authentication\Exceptions\CredentialsUnavailableException;
3232
use OCP\Authentication\LoginCredentials\IStore as CredentialsStore;
3333
use OCP\Files\Storage;
34+
use OCP\Files\StorageAuthException;
3435
use OCP\IL10N;
3536
use OCP\IUser;
3637

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

62+
if ($credentials->getUID() !== $user->getUID()) {
63+
throw new StorageAuthException('Session credentials for storage owner not available');
64+
}
65+
6166
$storage->setBackendOption('user', $credentials->getLoginName());
6267
$storage->setBackendOption('password', $credentials->getPassword());
6368
}

0 commit comments

Comments
 (0)