Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
page_rest_resource_oauth_two_legged.inc
1 <?php
18 require_once SQ_PACKAGES_PATH.'/web_services/rest/page_templates/page_rest_resource/page_rest_resource.inc';
19 
20 
32 {
33  private $_errors = Array();
34 
41  function __construct($assetid=0)
42  {
43  parent::__construct($assetid);
44 
45  }//end constructor
46 
47 
54  public function printBody()
55  {
56  // let the user decide if they want Matrix to do keyword replacements on the response. See bug
57  // #5701 Minor Enhancement : Allow REST resources assets to stop replacing keywords in response
58  $GLOBALS['SQ_SYSTEM']->setGlobalDefine('SQ_REPLACE_MYSOURCE_LEVEL_KEYWORDS', $this->attr('allow_global_replace'));
59 
60  }//end printBody()
61 
62 
69  protected function _process()
70  {
71 
72  }//end _process()
73 
83  public function getUserDataRequestAuthHeaders($urls=Array(), $args=Array())
84  {
85  $auth_headers = Array();
86  if (empty($urls) || !isset($args['method'])) return Array();
87 
88  // two legged oauth needs the calling asset to tell it some config values such as method and request body
89  $oauth = $this->getAttribute('oauth');
90  foreach ($args as $config_name => $config_value) {
91  $oauth->setConfig($config_name, $config_value);
92  }
93 
94  // 2 legged oauth doesn't require neither access token nor access secret, so, just pass the url
95  foreach ($urls as $url) {
96  $auth_headers[$url] = $oauth->getUserDataAuthHeader($url);
97  }
98 
99  return $auth_headers;
100 
101  }// end getUserDataRequestAuthHeaders()
102 
103 
104 }
105 ?>