Merge pull request #18235 from nextcloud/enh/noid/federated-on-circles

confirm auth on share generated by Circles
This commit is contained in:
Roeland Jago Douma 2019-12-19 12:02:14 +01:00 committed by GitHub
commit eaf89d1c69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View File

@ -59,6 +59,7 @@ class Application extends App {
$server->query(AddressHandler::class),
$server->getLogger(),
$server->getUserManager(),
$server->getShareManager(),
$server->getCloudIdManager(),
$server->getActivityManager(),
$server->getNotificationManager(),

View File

@ -98,7 +98,7 @@ class FederatedShareProvider implements IShareProvider {
private $cloudFederationProviderManager;
/** @var array list of supported share types */
private $supportedShareType = [\OCP\Share::SHARE_TYPE_REMOTE_GROUP, \OCP\Share::SHARE_TYPE_REMOTE];
private $supportedShareType = [IShare::TYPE_REMOTE_GROUP, IShare::TYPE_REMOTE, IShare::TYPE_CIRCLE];
/**
* DefaultShareProvider constructor.

View File

@ -50,6 +50,7 @@ use OCP\IUserManager;
use OCP\Notification\IManager as INotificationManager;
use OCP\Share;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager;
use OCP\Share\IShare;
use OCP\Util;
@ -70,6 +71,9 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
/** @var IUserManager */
private $userManager;
/** @var IManager */
private $shareManager;
/** @var ICloudIdManager */
private $cloudIdManager;
@ -102,6 +106,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
* @param AddressHandler $addressHandler
* @param ILogger $logger
* @param IUserManager $userManager
* @param IManager $shareManager
* @param ICloudIdManager $cloudIdManager
* @param IActivityManager $activityManager
* @param INotificationManager $notificationManager
@ -116,6 +121,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
AddressHandler $addressHandler,
ILogger $logger,
IUserManager $userManager,
IManager $shareManager,
ICloudIdManager $cloudIdManager,
IActivityManager $activityManager,
INotificationManager $notificationManager,
@ -130,6 +136,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
$this->addressHandler = $addressHandler;
$this->logger = $logger;
$this->userManager = $userManager;
$this->shareManager = $shareManager;
$this->cloudIdManager = $cloudIdManager;
$this->activityManager = $activityManager;
$this->notificationManager = $notificationManager;
@ -805,6 +812,16 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
return true;
}
if ($share->getShareType() === IShare::TYPE_CIRCLE) {
try {
$knownShare = $this->shareManager->getShareByToken($token);
if ($knownShare->getId() === $share->getId()) {
return true;
}
} catch (ShareNotFound $e) {
}
}
throw new AuthenticationFailedException();
}