mirror of
https://github.com/nextcloud/server.git
synced 2026-05-25 18:52:53 -04:00
Merge pull request #38285 from nextcloud/session-auth-check-username-22
[22] check the username when doing external storage session auth
This commit is contained in:
commit
86e4f32c29
1 changed files with 5 additions and 0 deletions
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue