Should verify if the token exists and return it
Always returns an token with an empty secret for now

@access public
@author Joel Bout, <joel@taotesting.com>
@param  consumer
@param  token_type
@param  token
@return mixed
356390
public function lookup_token($consumer, $token_type, $token)
	{
  		\common_Logger::d(__CLASS__.'::'.__FUNCTION__.' called for token '.$token.' of type '.$token_type);
		return new OAuthToken($consumer, "");
	}
449973
public function lookup_consumer($consumer_key)
	{
		$returnValue = null;

		$consumer = $this->findOauthConsumerResource($consumer_key);
		$secret			= (string)$consumer->getUniquePropertyValue($this->getProperty(self::PROPERTY_OAUTH_SECRET));
		$callbackUrl	= null;
		
		$returnValue = new OAuthConsumer($consumer_key, $secret, $callbackUrl);

		return $returnValue;
	}
966468
public function getConsumer ( $consumer_key, $user_id, $user_is_admin = false )
    {
        $consumer = $this->query_row_assoc('
                        SELECT    *
                        FROM oauth_server_registry
                        WHERE osr_consumer_key = \'%s\'
                        ', $consumer_key);

        if (!is_array($consumer))
        {
            throw new OAuthException2('No consumer with consumer_key "'.$consumer_key.'"');
        }

        $c = array();
        foreach ($consumer as $key => $value)
        {
            $c[substr($key, 4)] = $value;
        }
        $c['user_id'] = $c['usa_id_ref'];

        if (!$user_is_admin && !empty($c['user_id']) && $c['user_id'] != $user_id)
        {
            throw new OAuthException2('No access to the consumer information for consumer_key "'.$consumer_key.'"');
        }
        return $c;
    }
1025686
def authorize(self, consumer_key, consumer_secret, callback_url=None,
                  access_token=None, access_token_secret=None):
        
        self.consumer_key = consumer_key
        self.consumer_secret = consumer_secret

        if not access_token and not access_token_secret:
            if not callback_url:
                return (False, "Callback URL required")
            oauth = OAuth1(
                consumer_key,
                client_secret=consumer_secret,
                callback_uri=callback_url)
            r = requests.post(self.url('REQUEST_TOKEN'), auth=oauth)
            if r.status_code == 200:
                creds = parse_qs(r.content)

                self.access_token = creds.get('oauth_token')[0]
                self.access_token_secret = creds.get('oauth_token_secret')[0]
            else:
                return (False, r.content)
        else:
            self.finalize_oauth(access_token, access_token_secret)

        return (True, None)
575016
public function lookupConsumer($consumer_key)
    {
        return new Consumer(
            $this->tool_provider->consumer->getKey(),
            $this->tool_provider->consumer->secret
        );
    }
647675
function getAccessToken($oauth_verifier = FALSE)
    {
        $parameters = [];
        if (!empty($oauth_verifier)) {
            $parameters['oauth_verifier'] = $oauth_verifier;
        }
        $request = $this->oAuthRequest($this->accessTokenURL(), 'GET', $parameters);
        $token = OAuthUtil::parse_parameters($request);
        $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
        return $token;
    }
131708
public function getServer ( $consumer_key, $user_id, $user_is_admin = false )
	{
		$r = $this->query_row_assoc('
				SELECT	ocr_id					as id,
						ocr_usa_id_ref			as user_id,
						ocr_consumer_key 		as consumer_key,
						ocr_consumer_secret 	as consumer_secret,
						ocr_signature_methods	as signature_methods,
						ocr_server_uri			as server_uri,
						ocr_request_token_uri	as request_token_uri,
						ocr_authorize_uri		as authorize_uri,
						ocr_access_token_uri	as access_token_uri
				FROM oauth_consumer_registry
				WHERE ocr_consumer_key = \'%s\'
				  AND (ocr_usa_id_ref = %d OR ocr_usa_id_ref IS NULL)
				',	$consumer_key, $user_id);
		
		if (empty($r))
		{
			throw new OAuthException2('No server with consumer_key "'.$consumer_key.'" has been registered (for this user)');
		}
			
		if (isset($r['signature_methods']) && !empty($r['signature_methods']))
		{
			$r['signature_methods'] = explode(',',$r['signature_methods']);
		}
		else
		{
			$r['signature_methods'] = array();
		}
		return $r;
	}
611444
public function receiveTokenAndUsername($consumer_key, $request_token)
    {
        $pocketData = $this->convertRequestToken($consumer_key, $request_token);

        $returnData['access_token'] = $pocketData->access_token;
        $returnData['username'] = $pocketData->username;
        
        return $returnData;
    }
1249640
public function setConsumerAccessTokenTtl ( $token, $token_ttl )
	{
		if ($token_ttl <= 0)
		{
			// Immediate delete when the token is past its ttl
			$this->deleteConsumerAccessToken($token, 0, true);
		}
		else
		{
			// Set maximum time to live for this token
			 
			
			$sql = "BEGIN SP_SET_CONSUMER_ACC_TOKEN_TTL(:P_TOKEN, :P_TOKEN_TTL, :P_RESULT); END;";

			// parse sql
			$stmt = oci_parse($this->conn, $sql) or die ('Can not parse query');

			// Bind In and Out Variables
			oci_bind_by_name($stmt, ':P_TOKEN', $token, 255);
			oci_bind_by_name($stmt, ':P_TOKEN_TTL', $token_ttl, 20);
			oci_bind_by_name($stmt, ':P_RESULT', $result, 20);


			//Execute the statement
			oci_execute($stmt);
		}
	}
957310
public function getConsumer ( $consumer_key, $user_id, $user_is_admin = false ) {
           
            $sql = "BEGIN SP_GET_CONSUMER(:P_CONSUMER_KEY, :P_ROWS, :P_RESULT); END;";

            // parse sql
            $stmt = oci_parse($this->conn, $sql) or die ('Can not parse query');

            // Bind In and Out Variables
            oci_bind_by_name($stmt, ':P_CONSUMER_KEY', $consumer_key, 255);
            oci_bind_by_name($stmt, ':P_RESULT', $result, 20);

            //Bind the ref cursor
            $p_row = oci_new_cursor($this->conn);
            oci_bind_by_name($stmt, ':P_ROWS', $p_row, -1, OCI_B_CURSOR);

            //Execute the statement
            oci_execute($stmt);

            // treat the ref cursor as a statement resource
            oci_execute($p_row, OCI_DEFAULT);
            oci_fetch_all($p_row, $getConsumerList, null, null, OCI_FETCHSTATEMENT_BY_ROW);

            $consumer = $getConsumerList;
           
		    if (!is_array($consumer)) {
                throw new OAuthException2('No consumer with consumer_key "'.$consumer_key.'"');
            }

            $c = array();
            foreach ($consumer as $key => $value) {
                $c[substr($key, 4)] = $value;
            }
            $c['user_id'] = $c['usa_id_ref'];

            if (!$user_is_admin && !empty($c['user_id']) && $c['user_id'] != $user_id) {
                throw new OAuthException2('No access to the consumer information for consumer_key "'.$consumer_key.'"');
            }
            return $c;
        }
125662
public static Map<String, Object> verify(String token, final RSAPublicKey pk) throws InvalidTokenException {
        // RS256签名验证器
        Verifier verifier = new Verifier() {
            @Override
            public boolean verifySignature(String content, String payload, String signature) {
                return JWT.verifySignature(content,signature,pk);
            }
        };
        return verify(token, verifier);
    }
1273696
private function check_signature($request, $consumer, $token)
    {
        // this should probably be in a different method
        $timestamp = $request instanceof Twitter_OAuthRequest
            ? $request->get_parameter('oauth_timestamp')
            : null;
        $nonce = $request instanceof Twitter_OAuthRequest
            ? $request->get_parameter('oauth_nonce')
            : null;

        $this->check_timestamp($timestamp);
        $this->check_nonce($consumer, $token, $nonce, $timestamp);

        $signature_method = $this->get_signature_method($request);

        $signature = $request->get_parameter('oauth_signature');
        $valid_sig = $signature_method->check_signature(
            $request,
            $consumer,
            $token,
            $signature
        );

        if (!$valid_sig) {
            throw new Twitter_OAuthException('Invalid signature');
        }
    }
678105
public function findOauthConsumerResource($consumer_key)
	{
		$returnValue = null;

		$class = $this->getClass(self::CLASS_URI_OAUTH_CONSUMER);
		$instances = $class->searchInstances(array(self::PROPERTY_OAUTH_KEY => $consumer_key), array('like' => false, 'recursive' => true));
		if (count($instances) == 0) {
			throw new \tao_models_classes_oauth_Exception('No Credentials for consumer key '.$consumer_key);
		}
		if (count($instances) > 1) {
			throw new \tao_models_classes_oauth_Exception('Multiple Credentials for consumer key '.$consumer_key);
		}
		$returnValue	= current($instances);

		return $returnValue;
	}
679753
protected function get_url_with_auth( $consumer_key, $consumer_secret ) {

		$auth = new WC_API_Client_Authentication( $this->request->url, $consumer_key, $consumer_secret );

		if ( $auth->is_ssl() ) {

			// query string authentication over SSL works with all servers, whereas HTTP basic auth fails in certain cases
			// see https://github.com/kloon/WooCommerce-REST-API-Client-Library/issues/29
			$this->request->params = array_merge( $this->request->params, array(
				'consumer_key'    => $auth->get_consumer_key(),
				'consumer_secret' => $auth->get_consumer_secret(),
			) );

		} else {

			$this->request->params = array_merge( $this->request->params, $auth->get_oauth_params( $this->request->params, $this->request->method ) );
		}

		// build url
		return $this->request->url . ( ! empty( $this->request->params ) ? '?' . http_build_query( $this->request->params ) : '' );
	}
597518
def verify_request_common(consumers, url, method, headers, params):
    
    log.debug("consumers %s", consumers)
    log.debug("url %s", url)
    log.debug("method %s", method)
    log.debug("headers %s", headers)
    log.debug("params %s", params)

    oauth_server = LTIOAuthServer(consumers)
    oauth_server.add_signature_method(
        SignatureMethod_PLAINTEXT_Unicode())
    oauth_server.add_signature_method(
        SignatureMethod_HMAC_SHA1_Unicode())

    # Check header for SSL before selecting the url
    if headers.get('X-Forwarded-Proto', 'http') == 'https':
        url = url.replace('http:', 'https:', 1)

    oauth_request = Request_Fix_Duplicate.from_request(
        method,
        url,
        headers=dict(headers),
        parameters=params
    )
    if not oauth_request:
        log.info('Received non oauth request on oauth protected page')
        raise LTIException('This page requires a valid oauth session '
                           'or request')
    try:
        # pylint: disable=protected-access
        oauth_consumer_key = oauth_request.get_parameter('oauth_consumer_key')
        consumer = oauth_server.lookup_consumer(oauth_consumer_key)
        if not consumer:
            raise oauth2.Error('Invalid consumer.')
        oauth_server.verify_request(oauth_request, consumer, None)
    except oauth2.Error:
        # Rethrow our own for nice error handling (don't print
        # error message as it will contain the key
        raise LTIException("OAuth error: Please check your key and secret")

    return True
413630
public function acceptToken($type, &$token = null)
    {
        $token = $this->peek();
        if (! isset($token[0]) or $token[0] != $type) {
            return false;
        }
        $this->pop();
        return true;
    }
583086
public function verifyToken(Token $token)
    {
        $alg = $token->getHeader('alg');

        if (empty($this->supportedAlgs[$alg])) {
            throw new InvalidParamException('Algorithm not supported');
        }

        $signer = Yii::createObject($this->supportedAlgs[$alg]);
        return $token->verify($signer, $this->key);
    }