diff options
Diffstat (limited to 'apps/federation/lib/Controller/OCSAuthAPIController.php')
-rw-r--r-- | apps/federation/lib/Controller/OCSAuthAPIController.php | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/apps/federation/lib/Controller/OCSAuthAPIController.php b/apps/federation/lib/Controller/OCSAuthAPIController.php index 594299a2d02..b0594877b23 100644 --- a/apps/federation/lib/Controller/OCSAuthAPIController.php +++ b/apps/federation/lib/Controller/OCSAuthAPIController.php @@ -32,6 +32,7 @@ use OCA\Federation\TrustedServers; use OCP\AppFramework\Http; use OCP\AppFramework\OCS\OCSForbiddenException; use OCP\AppFramework\OCSController; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; use OCP\ILogger; use OCP\IRequest; @@ -61,6 +62,9 @@ class OCSAuthAPIController extends OCSController{ /** @var ILogger */ private $logger; + /** @var ITimeFactory */ + private $timeFactory; + /** * OCSAuthAPI constructor. * @@ -71,6 +75,7 @@ class OCSAuthAPIController extends OCSController{ * @param TrustedServers $trustedServers * @param DbHandler $dbHandler * @param ILogger $logger + * @param ITimeFactory $timeFactory */ public function __construct( $appName, @@ -79,7 +84,8 @@ class OCSAuthAPIController extends OCSController{ IJobList $jobList, TrustedServers $trustedServers, DbHandler $dbHandler, - ILogger $logger + ILogger $logger, + ITimeFactory $timeFactory ) { parent::__construct($appName, $request); @@ -88,6 +94,7 @@ class OCSAuthAPIController extends OCSController{ $this->trustedServers = $trustedServers; $this->dbHandler = $dbHandler; $this->logger = $logger; + $this->timeFactory = $timeFactory; } /** @@ -149,20 +156,12 @@ class OCSAuthAPIController extends OCSController{ throw new OCSForbiddenException(); } - // we ask for the shared secret so we no longer have to ask the other server - // to request the shared secret - $this->jobList->remove('OCA\Federation\BackgroundJob\RequestSharedSecret', - [ - 'url' => $url, - 'token' => $localToken - ] - ); - $this->jobList->add( 'OCA\Federation\BackgroundJob\GetSharedSecret', [ 'url' => $url, 'token' => $token, + 'created' => $this->timeFactory->getTime() ] ); @@ -210,5 +209,4 @@ class OCSAuthAPIController extends OCSController{ $storedToken = $this->dbHandler->getToken($url); return hash_equals($storedToken, $token); } - } |