/** * Sign and execute the request * * @return Response */ public function execute() { // Timestamp for avoiding identical signatures $this->query('ts', (string) time()); if ($this->hapi_profile_settings === NULL) { $this->load_config(); } // Add signature to the request $signature = HAPI_Security::calculate_hmac($this, $this->hapi_profile_settings['private_key']); $this->headers('X-Auth', $this->hapi_profile_settings['public_key']); $this->headers('X-Auth-Hash', $signature); // Add Authorization header if not present if (!array_key_exists('Authorization', $this->headers()) && Auth::instance()->logged_in()) { $this->headers('Authorization', $this->authorize(Auth::instance()->get_user())); } return parent::execute(); }