abstract OAuth_Provider
Kohana_OAuth_Provider

Class Contents

Class declared in MODPATH/oauth/classes/oauth/provider.php on line 3.

Properties

public $name

Methods

public __construct( )
Kohana_OAuth_Provider

Source Code
public function __construct(array $options = NULL)
{
	if (isset($options['signature']))
	{
		// Set the signature method name or object
		$this->signature = $options['signature'];
	}

	if ( ! is_object($this->signature))
	{
		// Convert the signature name into an object
		$this->signature = OAuth_Signature::factory($this->signature);
	}

	if ( ! $this->name)
	{
		// Attempt to guess the name from the class name
		$this->name = strtolower(substr(get_class($this), strlen('OAuth_Provider_')));
	}
}

public __get( )
Kohana_OAuth_Provider

Source Code
public function __get($key)
{
	return $this->$key;
}

public access_token( )
Kohana_OAuth_Provider

Source Code
public function access_token(OAuth_Consumer $consumer, OAuth_Token_Request $token, array $params = NULL)
{
	// Create a new GET request for a request token with the required parameters
	$request = OAuth_Request::factory('access', 'GET', $this->url_access_token(), array(
		'oauth_consumer_key' => $consumer->key,
		'oauth_token'        => $token->token,
		'oauth_verifier'     => $token->verifier,
	));

	if ($params)
	{
		// Load user parameters
		$request->params($params);
	}

	// Sign the request using only the consumer, no token is available yet
	$request->sign($this->signature, $consumer, $token);

	// Create a response from the request
	$response = $request->execute();

	// Store this token somewhere useful
	return OAuth_Token::factory('access', array(
		'token'  => $response->param('oauth_token'),
		'secret' => $response->param('oauth_token_secret'),
	));
}

public authorize_url( )
Kohana_OAuth_Provider

Source Code
public function authorize_url(OAuth_Token_Request $token, array $params = NULL)
{
	// Create a new GET request for a request token with the required parameters
	$request = OAuth_Request::factory('authorize', 'GET', $this->url_authorize(), array(
		'oauth_token' => $token->token,
	));

	if ($params)
	{
		// Load user parameters
		$request->params($params);
	}

	return $request->as_url();
}

public static factory( )
Kohana_OAuth_Provider

Source Code
public static function factory($name, array $options = NULL)
{
	$class = 'OAuth_Provider_'.$name;

	return new $class($options);
}

public request_token( )
Kohana_OAuth_Provider

Source Code
public function request_token(OAuth_Consumer $consumer, array $params = NULL)
{
	// Create a new GET request for a request token with the required parameters
	$request = OAuth_Request::factory('token', 'GET', $this->url_request_token(), array(
		'oauth_consumer_key' => $consumer->key,
		'oauth_callback'     => $consumer->callback,
	));

	if ($params)
	{
		// Load user parameters
		$request->params($params);
	}

	// Sign the request using only the consumer, no token is available yet
	$request->sign($this->signature, $consumer);

	// Create a response from the request
	$response = $request->execute();

	// Store this token somewhere useful
	return OAuth_Token::factory('request', array(
		'token'  => $response->param('oauth_token'),
		'secret' => $response->param('oauth_token_secret'),
	));
}

abstract public url_access_token( )
Kohana_OAuth_Provider

Source Code
abstract public function url_access_token();

abstract public url_authorize( )
Kohana_OAuth_Provider

Source Code
abstract public function url_authorize();

abstract public url_request_token( )
Kohana_OAuth_Provider

Source Code
abstract public function url_request_token();