Esempio n. 1
0
 /**
  * @param exodBearerToken $exodBearerToken
  */
 public function storeToken(exodBearerToken $exodBearerToken)
 {
     global $ilUser;
     $this->setAccessToken($exodBearerToken->getAccessToken());
     $this->setRefreshToken($exodBearerToken->getRefreshToken());
     $this->setValidThrough($exodBearerToken->getValidThrough());
     $this->setValidThrough($exodBearerToken->getValidThrough());
     $this->setValidationUserId($ilUser->getId());
     $this->doUpdate();
 }
Esempio n. 2
0
 /**
  * @param exodBearerToken $exodBearerToken
  *
  * @return bool
  */
 public function refreshToken(exodBearerToken &$exodBearerToken)
 {
     //		throw new ilCloudException(-1, 'failed');
     $exodLog = exodLog::getInstance();
     $exodLog->write('refreshing-Token...');
     $this->exod_app->buildURLs();
     $exodCurl = new exodCurl();
     $exodCurl->setUrl($this->exod_app->getTokenUrl());
     $exodCurl->addHeader("Content-Type: application/x-www-form-urlencoded");
     $exodCurl->addPostField('client_secret', $this->getExodApp()->getClientSecret());
     $exodCurl->addPostField('client_id', $this->exod_app->getClientId());
     $exodCurl->addPostField('grant_type', 'refresh_token');
     $exodCurl->addPostField('refresh_token', $exodBearerToken->getRefreshToken());
     $exodCurl->addPostField('resource', $this->exod_app->getRessourceUri());
     $exodCurl->addPostField('redirect_uri', $this->exod_app->getRedirectUri());
     $exodCurl->post();
     $this->response->loadFromResponse($exodCurl->getResponseBody());
     $exodBearerToken->setRefreshToken($this->response->getRefreshToken());
     $exodBearerToken->setAccessToken($this->response->getAccessToken());
     $exodBearerToken->setValidThrough($this->response->getExpiresOn());
     $this->setExodBearerToken($exodBearerToken);
 }