public function getOAuthAccessorTokenKey(TokenKey $tokenKey, ProviderInfo $provInfo) { $provKey = new ProviderKey(); $provKey->setGadgetUri($tokenKey->getGadgetUri()); $provKey->setServiceName($tokenKey->getServiceName()); //AccesorInfo $result = $this->getOAuthAccessorProviderKey($provKey, $provInfo); //TokenInfo $accessToken = $this->getTokenInfo($tokenKey); if ($accessToken != null) { // maybe convert into methods $result->getAccessor()->accessToken = $accessToken->getAccessToken(); $result->getAccessor()->tokenSecret = $accessToken->getTokenSecret(); } return $result; }
/** * Retrieve an OAuthAccessor that is ready to sign OAuthMessages. * * @param tokenKey information about the gadget retrieving the accessor. * * @return an OAuthAccessorInfo containing an OAuthAccessor (whic can be * passed to an OAuthMessage.sign method), as well as httpMethod and * signatureType fields. */ public function getOAuthAccessor(TokenKey $tokenKey, $ignoreCache) { $gadgetUri = $tokenKey->getGadgetUri(); if (empty($gadgetUri)) { throw new OAuthStoreException("found empty gadget URI in TokenKey"); } $getUserId = $tokenKey->getUserId(); if (empty($getUserId)) { throw new OAuthStoreException("found empty userId in TokenKey"); } $gadgetSpec = $this->specFactory->getGadgetSpecUri($gadgetUri, $ignoreCache); $provInfo = $this->getProviderInfo($gadgetSpec, $tokenKey->getServiceName()); return $this->store->getOAuthAccessorTokenKey($tokenKey, $provInfo); }