Created
May 3, 2012 06:06
-
-
Save christianchristensen/2583645 to your computer and use it in GitHub Desktop.
OAuth Drupal 6.x (with config)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Drupal version | |
; -------------- | |
core = 6.x | |
; Drush Make API version | |
; ---------------------- | |
api = 2 | |
projects[] = drupal | |
projects[] = autoload | |
projects[] = ctools | |
projects[] = libraries | |
projects[] = features | |
projects[oauth][type] = module | |
projects[oauth][subdir] = contrib | |
projects[oauth][version] = 3.0-beta4 | |
projects[oauth][patch][] = http://drupal.org/files/980340-d6.patch | |
projects[oauth][patch][] = http://drupal.org/files/issues/oauth-destination.patch | |
projects[oauth][patch][] = http://drupal.org/files/oauth-authorization_edit-1338102-3-D6.patch | |
projects[oauth][patch][] = http://drupal.org/files/oauth-q_query_string_ignore-1264390-15-D6.patch | |
projects[oauth][patch][] = http://drupal.org/files/oauth-oauth_verify-requirement-1538352-1-D6.patch | |
projects[oauth][patch][] = http://drupal.org/files/oauth-oauth_common_get_user_provider_tokens-1431882-4-D6.patch | |
projects[services][type] = module | |
projects[services] = 3.1 | |
projects[services][subdir] = contrib | |
projects[services][patch][] = "http://drupal.org/files/spyc-decoupling-1325572-52-D6.patch" | |
projects[services][patch][] = "http://drupal.org/files/services_oauth-allow_oauth_auth_pass_through-1526308-3-D6.patch" | |
libraries[spyc][version] = "0.5" | |
libraries[spyc][download][type] = "file" | |
libraries[spyc][download][url] = "http://spyc.googlecode.com/files/spyc-0.5.zip" | |
libraries[spyc][download][destination] = libraries | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implementation of hook_ctools_plugin_api(). | |
*/ | |
function oauth_test_ctools_plugin_api() { | |
list($module, $api) = func_get_args(); | |
if ($module == "oauth_common" && $api == "oauth") { | |
return array("version" => 1); | |
} | |
elseif ($module == "services" && $api == "services") { | |
return array("version" => 3); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implementation of hook_user_default_permissions(). | |
*/ | |
function oauth_test_user_default_permissions() { | |
$permissions = array(); | |
// Exported permission: administer consumers | |
$permissions['administer consumers'] = array( | |
'name' => 'administer consumers', | |
'roles' => array(), | |
); | |
// Exported permission: administer oauth | |
$permissions['administer oauth'] = array( | |
'name' => 'administer oauth', | |
'roles' => array(), | |
); | |
// Exported permission: administer services | |
$permissions['administer services'] = array( | |
'name' => 'administer services', | |
'roles' => array(), | |
); | |
// Exported permission: get a system variable | |
$permissions['get a system variable'] = array( | |
'name' => 'get a system variable', | |
'roles' => array(), | |
); | |
// Exported permission: get any binary files | |
$permissions['get any binary files'] = array( | |
'name' => 'get any binary files', | |
'roles' => array(), | |
); | |
// Exported permission: get own binary files | |
$permissions['get own binary files'] = array( | |
'name' => 'get own binary files', | |
'roles' => array(), | |
); | |
// Exported permission: get taxonomy tree | |
$permissions['get taxonomy tree'] = array( | |
'name' => 'get taxonomy tree', | |
'roles' => array(), | |
); | |
// Exported permission: oauth authorize any consumers | |
$permissions['oauth authorize any consumers'] = array( | |
'name' => 'oauth authorize any consumers', | |
'roles' => array(), | |
); | |
// Exported permission: oauth authorize consumers in default | |
$permissions['oauth authorize consumers in default'] = array( | |
'name' => 'oauth authorize consumers in default', | |
'roles' => array( | |
'0' => 'authenticated user', | |
), | |
); | |
// Exported permission: oauth register any consumers | |
$permissions['oauth register any consumers'] = array( | |
'name' => 'oauth register any consumers', | |
'roles' => array(), | |
); | |
// Exported permission: oauth register consumers in default | |
$permissions['oauth register consumers in default'] = array( | |
'name' => 'oauth register consumers in default', | |
'roles' => array( | |
'0' => 'authenticated user', | |
), | |
); | |
// Exported permission: perform unlimited index queries | |
$permissions['perform unlimited index queries'] = array( | |
'name' => 'perform unlimited index queries', | |
'roles' => array(), | |
); | |
// Exported permission: save file information | |
$permissions['save file information'] = array( | |
'name' => 'save file information', | |
'roles' => array(), | |
); | |
// Exported permission: set a system variable | |
$permissions['set a system variable'] = array( | |
'name' => 'set a system variable', | |
'roles' => array(), | |
); | |
return $permissions; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name = "oauth_test" | |
description = "OAuth test" | |
core = "6.x" | |
package = "Features" | |
dependencies[] = "features" | |
dependencies[] = "oauth_common" | |
dependencies[] = "oauth_common_providerui" | |
dependencies[] = "rest_server" | |
dependencies[] = "services" | |
dependencies[] = "services_oauth" | |
features[ctools][] = "oauth_common:oauth:1" | |
features[ctools][] = "services:services:3" | |
features[oauth_common_context][] = "default" | |
features[services_endpoint][] = "oauth_test" | |
features[user_permission][] = "administer consumers" | |
features[user_permission][] = "administer oauth" | |
features[user_permission][] = "administer services" | |
features[user_permission][] = "get a system variable" | |
features[user_permission][] = "get any binary files" | |
features[user_permission][] = "get own binary files" | |
features[user_permission][] = "get taxonomy tree" | |
features[user_permission][] = "oauth authorize any consumers" | |
features[user_permission][] = "oauth authorize consumers in default" | |
features[user_permission][] = "oauth register any consumers" | |
features[user_permission][] = "oauth register consumers in default" | |
features[user_permission][] = "perform unlimited index queries" | |
features[user_permission][] = "save file information" | |
features[user_permission][] = "set a system variable" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once('oauth_test.features.inc'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_default_oauth_common_context | |
*/ | |
function oauth_test_default_oauth_common_context() { | |
$contexts = array(); | |
$context = new stdClass; | |
$context->disabled = FALSE; /* Edit this to true to make a default context disabled initially */ | |
$context->api_version = 1; | |
$context->name = 'default'; | |
$context->title = 'Default'; | |
$context->authorization_options = array( | |
'access_token_lifetime' => 0, | |
'page_title' => 'Default', | |
'signature_methods' => array( | |
0 => 'HMAC-SHA1', | |
1 => 'HMAC-SHA256', | |
2 => 'HMAC-SHA384', | |
3 => 'HMAC-SHA512', | |
), | |
'default_authorization_levels' => array(), | |
); | |
$context->authorization_levels = array( | |
'*' => array( | |
'name' => '*', | |
'title' => 'Default', | |
'description' => '', | |
'default' => 0, | |
'delete' => 0, | |
), | |
); | |
$contexts[$context->name] = $context; | |
return $contexts; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implementation of hook_default_services_endpoint(). | |
*/ | |
function oauth_test_default_services_endpoint() { | |
$export = array(); | |
$endpoint = new stdClass; | |
$endpoint->disabled = FALSE; /* Edit this to true to make a default endpoint disabled initially */ | |
$endpoint->api_version = 3; | |
$endpoint->name = 'oauth_test'; | |
$endpoint->server = 'rest_server'; | |
$endpoint->path = 'rest'; | |
$endpoint->authentication = array( | |
'services_oauth' => array( | |
'oauth_context' => 'default', | |
), | |
); | |
$endpoint->server_settings = array(); | |
$endpoint->resources = array( | |
'node' => array( | |
'operations' => array( | |
'retrieve' => array( | |
'enabled' => 1, | |
), | |
'create' => array( | |
'enabled' => 1, | |
), | |
'update' => array( | |
'enabled' => 1, | |
), | |
'delete' => array( | |
'enabled' => 1, | |
), | |
'index' => array( | |
'enabled' => 1, | |
), | |
), | |
), | |
'user' => array( | |
'operations' => array( | |
'retrieve' => array( | |
'enabled' => 1, | |
), | |
'index' => array( | |
'enabled' => 1, | |
), | |
), | |
'actions' => array( | |
'register' => array( | |
'enabled' => 1, | |
), | |
), | |
), | |
); | |
$endpoint->debug = 0; | |
$export['oauth_test'] = $endpoint; | |
return $export; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: additional notes here: https://gist.github.com/1595718