Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

confirm auth on share generated by Circles #18235

Merged
merged 1 commit into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/federatedfilesharing/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,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 @@ -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.
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 @@ -50,6 +50,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 @@ -70,6 +71,9 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
/** @var IUserManager */
private $userManager;

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

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

Expand Down Expand Up @@ -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
Expand All @@ -116,6 +121,7 @@ public function __construct(IAppManager $appManager,
AddressHandler $addressHandler,
ILogger $logger,
IUserManager $userManager,
IManager $shareManager,
ICloudIdManager $cloudIdManager,
IActivityManager $activityManager,
INotificationManager $notificationManager,
Expand All @@ -130,6 +136,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 @@ -805,6 +812,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