function oauth_common_menu in OAuth 1.0 6.3
Same name and namespace in other branches
- 7.4 oauth_common.module \oauth_common_menu()
- 7.3 oauth_common.module \oauth_common_menu()
Implementation of hook_menu().
File
- ./
oauth_common.module, line 56
Code
function oauth_common_menu() {
$menu = array();
$admin_base = array(
'access arguments' => array(
'administer oauth',
),
'file' => 'oauth_common.admin.inc',
);
$menu['admin/settings/oauth'] = array(
'title' => 'OAuth',
'description' => 'Settings for OAuth',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'_oauth_common_admin',
),
'type' => MENU_NORMAL_ITEM,
) + $admin_base;
$menu['admin/settings/oauth/settings'] = array(
'title' => 'Settings',
'description' => 'Settings for OAuth',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'_oauth_common_admin',
),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 0,
) + $admin_base;
// OAuth doesn't need different endpoints for the different context as all
// actions are done with a specific consumer, which in itself is associated
// with a context.
$provider_base = array(
'access callback' => 'oauth_commmon_is_provider',
'file' => 'oauth_common.pages.inc',
'type' => MENU_CALLBACK,
);
// The endpoint that consumers use to get a request token.
$menu['oauth/request_token'] = array(
'page callback' => 'oauth_common_callback_request_token',
) + $provider_base;
// The page a user gets sent to to authorize a request token.
$menu['oauth/authorize'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'oauth_common_form_authorize',
),
) + $provider_base;
// The endpoint that consumers use to get a access token.
$menu['oauth/access_token'] = array(
'page callback' => 'oauth_common_callback_access_token',
) + $provider_base;
// This page is used both in consumer and provider mode. For consumers it is
// the callback url and triggers hook_oauth_common_authorized(). For
// providers it is the page where users end up if no callback url exists.
$menu['oauth/authorized'] = array(
'title' => 'Authorization finished',
'page callback' => 'oauth_common_page_authorized',
'access arguments' => array(
'access content',
),
'file' => 'oauth_common.pages.inc',
'type' => MENU_CALLBACK,
);
// TODO: Different structures makes sense depending on whether oauth_common is
// acting as a provider or as a consumer.
$menu['oauth/test/valid-consumer'] = array(
'file' => 'oauth_common.pages.inc',
'page callback' => '_oauth_common_validate_request_callback',
'page arguments' => array(
'consumer',
),
'access callback' => 'oauth_commmon_is_provider',
'type' => MENU_CALLBACK,
);
$menu['oauth/test/valid-access-token'] = array(
'file' => 'oauth_common.pages.inc',
'page callback' => '_oauth_common_validate_request_callback',
'page arguments' => array(
'access token',
),
'access callback' => 'oauth_commmon_is_provider',
'type' => MENU_CALLBACK,
);
return $menu;
}