You are here

class DrupalOAuthServer in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 7.4 includes/DrupalOAuthServer.inc \DrupalOAuthServer
  2. 7.3 includes/DrupalOAuthServer.inc \DrupalOAuthServer

Hierarchy

Expanded class hierarchy of DrupalOAuthServer

File

includes/DrupalOAuthServer.inc, line 3

View source
class DrupalOAuthServer extends OAuthServer {
  public function __construct($context) {
    parent::__construct(new DrupalOAuthDataStore($context));
    if (isset($context->authorization_options['signature_methods'])) {
      $sig_methods = $context->authorization_options['signature_methods'];
    }
    else {
      $sig_methods = array(
        'HMAC-SHA1',
        'HMAC-SHA256',
        'HMAC-SHA384',
        'HMAC-SHA512',
      );
    }
    foreach ($sig_methods as $signature_method) {
      if ($signature_method == 'PLAINTEXT') {
        $this
          ->add_signature_method(new OAuthSignatureMethod_PLAINTEXT());
      }
      else {

        // Check if the system supports the hashing algorithm
        $algo = explode('-', $signature_method, 2);
        if ($algo[0] == 'HMAC' && in_array(strtolower($algo[1]), hash_algos())) {
          $this
            ->add_signature_method(new OAuthSignatureMethod_HMAC($algo[1]));
        }
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DrupalOAuthServer::__construct public function Overrides OAuthServer::__construct
OAuthServer::$data_store protected property
OAuthServer::$signature_methods protected property
OAuthServer::$timestamp_threshold protected property
OAuthServer::$version protected property
OAuthServer::add_signature_method public function
OAuthServer::check_nonce private function check that the nonce is not repeated
OAuthServer::check_signature private function all-in-one function to check the signature on a request should guess the signature method appropriately
OAuthServer::check_timestamp private function check that the timestamp is new enough
OAuthServer::fetch_access_token public function process an access_token request returns the access token on success
OAuthServer::fetch_request_token public function process a request_token request returns the request token on success
OAuthServer::get_consumer private function try to find the consumer for the provided request's consumer key
OAuthServer::get_signature_method private function figure out the signature with some defaults
OAuthServer::get_token private function try to find the token for the provided request's token key
OAuthServer::get_version private function version 1
OAuthServer::verify_request public function verify an api call, checks all the parameters