confirm auth on share generated by Circles

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
returns true

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
DI

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
DI

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
Maxence Lange 2019-12-05 15:39:31 -01:00
parent faf58e4cac
commit 3513833ccd
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();
}