Exemplo n.º 1
0
 /**
  * Creates WrapAccesTokenResult object from parsed XML response.
  *
  * @param array $response The get WRAP access token response.
  * 
  * @return WindowsAzure\ServiceBus\Models\WrapAccessTokenResult.
  */
 public static function create($response)
 {
     $wrapAccessTokenResult = new WrapAccessTokenResult();
     parse_str($response, $parsedResponse);
     $wrapAccessTokenResult->setAccessToken(Utilities::tryGetValue($parsedResponse, Resources::WRAP_ACCESS_TOKEN));
     $wrapAccessTokenResult->setExpiresIn(Utilities::tryGetValue($parsedResponse, Resources::WRAP_ACCESS_TOKEN_EXPIRES_IN));
     return $wrapAccessTokenResult;
 }
Exemplo n.º 2
0
 /**
  * Gets a WRAP access token with specified parameters.
  * 
  * @param string $uri      The URI of the WRAP service.
  * @param string $name     The user name of the WRAP service. 
  * @param string $password The password of the WRAP service. 
  * @param string $scope    The scope of the WRAP service. 
  * 
  * @return WindowsAzure\ServiceBus\Models\WrapAccessTokenResult
  */
 public function wrapAccessToken($uri, $name, $password, $scope)
 {
     $method = Resources::HTTP_POST;
     $headers = array();
     $queryParams = array();
     $postParameters = array();
     $statusCode = Resources::STATUS_OK;
     $postParameters = $this->addPostParameter($postParameters, Resources::WRAP_NAME, $name);
     $postParameters = $this->addPostParameter($postParameters, Resources::WRAP_PASSWORD, $password);
     $postParameters = $this->addPostParameter($postParameters, Resources::WRAP_SCOPE, $scope);
     $this->setUri($uri);
     $response = $this->send($method, $headers, $queryParams, $postParameters, Resources::EMPTY_STRING, $statusCode);
     return WrapAccessTokenResult::create($response->getBody());
 }