Merge pull request #38287 from nextcloud/session-auth-check-username-20

[20] check the username when doing external storage session auth
pull/38644/head
Robin Appelman 1 year ago committed by GitHub
commit b4557262cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -31,6 +31,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;
@ -58,6 +59,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…
Cancel
Save