Index: services.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/Attic/services.module,v
retrieving revision 1.8.2.9
diff -u -p -r1.8.2.9 services.module
--- services.module	8 May 2008 00:24:53 -0000	1.8.2.9
+++ services.module	18 Jun 2008 03:30:20 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: services.module,v 1.8.2.9 2008/05/08 00:24:53 marcingy Exp $
+// $Id: services.module,v 1.8.2.8 2008/05/08 00:17:12 marcingy Exp $
 
 /**
  * @file
@@ -264,6 +264,20 @@ function services_method_call($method_na
     }
   }
   
+  if (variable_get('services_use_oauth', TRUE)) {
+    $consumer_key = array_shift($args);
+    $oauth_token = array_shift($args);
+    $oauth_signatutre_method = array_shift($args);
+    $oauth_signature = array_shift($args);
+    $oauth_timestamp = array_shift($args);
+    $oauth_nonce = array_shift($args);
+    print_r($consumer_key);
+    // checking oauth parameters as per request to access resources
+    if (!services_validate_oauth($consumer_key, $oauth_token, $oauth_signatutre_method, $oauth_signature, $oauth_signatutre, $oauth_timestamp, $oauth_nonce)) {
+      return services_error(t('Invalid OAuth request please try varifying again.'));
+    }
+  }
+  
   // Add additonal processing for methods requiring authentication
   $session_backup = NULL;
   if ($method['#auth'] && variable_get('services_use_sessid', TRUE)) {
@@ -336,6 +350,43 @@ function services_get_all() {
       '#description' => t('Time stamp used to hash key.'),
     );
     
+    // OAuth call arg
+    $arg_oauth_key = array(
+      '#name' => 'oauth_consumer_key',
+      '#type' => 'string',
+      '#description' => t('OAuth key for consumer.'),
+    );
+    
+    $arg_oauth_token = array(
+      '#name' => 'oauth_token',
+      '#type' => 'string',
+      '#description' => t('OAuth token for consumer.'),
+     );
+    
+    $arg_oauth_signature_method = array(
+      '#name' => 'oauth_signature_method',
+      '#type' => 'string',
+      '#description' => t('OAuth signature method.'),
+    );
+    
+    $arg_oauth_signature = array(
+      '#name' => 'oauth_signature',
+      '#type' => 'string',
+      '#description' => t('OAuth signature.'),
+    );
+    
+    $arg_oauth_timestamp = array(
+      '#name' => 'oauth_timestamp',
+      '#type' => 'string',
+      '#description' => t('OAuth call timestamp'),
+    );
+    
+    $arg_oauth_nonce = array(
+      '#name' => 'oauth_nonce',
+      '#type' => 'string',
+      '#description' => t('OAuth csll nonce'),
+    );
+    
     foreach ($methods as $key => $method) {
       
       // set method defaults
@@ -366,6 +417,21 @@ function services_get_all() {
         }
       }
       
+      
+      if (variable_get('services_use_oauth', TRUE)) {
+        $methods[$key]['#args'] = array_merge(array($arg_oauth_nonce), $methods[$key]['#args']);
+        $methods[$key]['#args'] = array_merge(array($arg_oauth_timestamp), $methods[$key]['#args']);
+        $methods[$key]['#args'] = array_merge(array($arg_oauth_signature), $methods[$key]['#args']);
+        $methods[$key]['#args'] = array_merge(array($arg_oauth_signature_method), $methods[$key]['#args']);
+        $methods[$key]['#args'] = array_merge(array($arg_oauth_token), $methods[$key]['#args']);
+        $methods[$key]['#args'] = array_merge(array($arg_oauth_key), $methods[$key]['#args']);
+        
+        
+        
+        
+        
+      }
+      
       // set defaults for args
       foreach ($methods[$key]['#args'] as $arg_key => $arg) {
         if (is_array($arg)) {
@@ -432,6 +498,18 @@ function services_validate_key($kid,$tim
   }    
 }
 
+function services_validate_oauth($consumer_key, $oauth_token, $oauth_signatutre_method, $oauth_signature, $oauth_signatutre, $oauth_timestamp, $oauth_nonce){
+	$consu_key = db_result(db_query("SELECT consumer_key FROM {oauth_token} WHERE token_key = '%s' AND type = 'access'", $oauth_token ));	
+		
+	if($consu_key == $consumer_key){
+		return true;
+	}
+	else{
+		return false;
+	}
+	
+}
+
 function services_get_key($kid) {
   $keys = services_get_keys();
   foreach ($keys as $key) {
Index: services_admin_browse.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/Attic/services_admin_browse.inc,v
retrieving revision 1.5.2.4
diff -u -p -r1.5.2.4 services_admin_browse.inc
--- services_admin_browse.inc	3 May 2008 01:00:35 -0000	1.5.2.4
+++ services_admin_browse.inc	18 Jun 2008 03:30:20 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: services_admin_browse.inc,v 1.5.2.4 2008/05/03 01:00:35 marcingy Exp $
+// $Id: services_admin_browse.inc,v 1.5.2.3 2008/04/12 02:55:53 snelson Exp $
 
 /**
  * Callback for 'services/browse'.
@@ -227,7 +227,12 @@ function services_admin_settings() {
     '#default_value' => variable_get('services_use_sessid', TRUE),
     '#description' => t('When enabled, all method calls must include a valid sessid. Only disable this setting if the application will user browser-based cookies.')
   );
-  
+  $form['security']['services_use_oauth'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Use OAuth'),
+    '#default_value' => variable_get('services_use_oauth', TRUE),
+    '#description' => t('When enabled, all method calls must include OAuth parameters to proceed.')
+  );
   $form['debug'] = array(
     '#title' => t('Debugging'),
     '#type' => 'fieldset',
