示例#1
0
 public function __construct()
 {
     $this->_headers = getallheaders();
     $this->_isSigned = $this->requestIsSigned();
     if ($this->_isSigned) {
         $this->_authorization = array();
         $this->processAuthorizationHeaders();
         $auth = new RenegadeAuthorization($this);
         $this->_isAuthorized = $auth->verify();
     }
 }
 public static function authorizationForCommandWithKeyAndSecret(RenegadeCommand $command, $key, $secret, $options = null)
 {
     $auth = new RenegadeAuthorization();
     $auth->key = $key;
     $auth->secret = $secret;
     $auth->command = $command->descriptor();
     $auth->nonce = $options['nonce'] ? $options['nonce'] : $auth->generate_nonce();
     $auth->signature_method = $options['signature_method'] ? $options['signature_method'] : RenegadeAuthorization::kDefaultSignatureMethod;
     $auth->version = $options['version'] ? $options['version'] : RenegadeAuthorization::kDefaultVersion;
     return $auth;
 }
示例#3
0
 /**
  * undocumented function
  *
  * @param RenegadeCommand $command 
  * @return RenegadeResponse
  * @author Adam Venturella
  */
 public function execute(RenegadeCommand $command, $key, $secret)
 {
     $auth = RenegadeAuthorization::authorizationForCommandWithKeyAndSecret($command, $key, $secret);
     $command->setAuthorization($auth);
     //echo $command->request();exit;
     $data = $this->connect($command->request());
     $response = RenegadeResponse::responseWithData($data);
     if ($response->error) {
         throw new Exception('RenegadeCommand(' . $command . ') Failed with error ' . $response->error['error'] . ': ' . $response->error['reason']);
     } else {
         return $response;
     }
 }
示例#4
0
 public function setAuthorization(RenegadeAuthorization $value)
 {
     $this->authorization = $value->__toString();
 }