Skip to content

Commit

Permalink
confirm auth on share generated by Circles
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ArtificialOwl committed Dec 5, 2019
1 parent 3eb3c3f commit 1065f58
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/federatedfilesharing/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function() use ($container) {
$server->query(AddressHandler::class),
$server->getLogger(),
$server->getUserManager(),
$server->getShareManager(),
$server->getCloudIdManager(),
$server->getActivityManager(),
$server->getNotificationManager(),
Expand Down
2 changes: 1 addition & 1 deletion apps/federatedfilesharing/lib/FederatedShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,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.
Expand Down
17 changes: 17 additions & 0 deletions apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
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;

Expand All @@ -67,6 +68,9 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
/** @var IUserManager */
private $userManager;

/** @var IManager */
private $shareManager;

/** @var ICloudIdManager */
private $cloudIdManager;

Expand Down Expand Up @@ -99,6 +103,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
Expand All @@ -113,6 +118,7 @@ public function __construct(IAppManager $appManager,
AddressHandler $addressHandler,
ILogger $logger,
IUserManager $userManager,
IManager $shareManager,
ICloudIdManager $cloudIdManager,
IActivityManager $activityManager,
INotificationManager $notificationManager,
Expand All @@ -127,6 +133,7 @@ public function __construct(IAppManager $appManager,
$this->addressHandler = $addressHandler;
$this->logger = $logger;
$this->userManager = $userManager;
$this->shareManager = $shareManager;
$this->cloudIdManager = $cloudIdManager;
$this->activityManager = $activityManager;
$this->notificationManager = $notificationManager;
Expand Down Expand Up @@ -802,6 +809,16 @@ protected function verifyShare(IShare $share, $token) {
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();
}

Expand Down

0 comments on commit 1065f58

Please sign in to comment.