Modules

OAuth_Signature_PLAINTEXT
extends Kohana_OAuth_Signature_PLAINTEXT
extends OAuth_Signature
extends Kohana_OAuth_Signature

The PLAINTEXT signature does not provide any security protection and should only be used over a secure channel such as HTTPS.

package
Kohana/OAuth
category
Signature
author
Kohana Team
copyright
© 2010 Kohana Team
license
http://kohanaframework.org/license
since
3.0.7

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

Constants

  • None

Properties

Properties

protected $name

Methods

public sign( OAuth_Request $request , OAuth_Consumer $consumer [, OAuth_Token $token = NULL ] ) (defined in Kohana_OAuth_Signature_PLAINTEXT)

Generate a plaintext signature for the request without the base string.

$sig = $signature->sign($request, $consumer, $token);

This method implements OAuth 1.0 Spec 9.4.1.

Parameters

  • OAuth_Request $request required - Request
  • OAuth_Consumer $consumer required - Consumer
  • OAuth_Token $token = NULL - Token

Return Values

  • $this

Source Code

public function sign(OAuth_Request $request, OAuth_Consumer $consumer, OAuth_Token $token = NULL)
{
	// Use the signing key as the signature
	return $this->key($consumer, $token);
}

public verify( string $signature , OAuth_Request $request , OAuth_Consumer $consumer [, OAuth_Token $token = NULL ] ) (defined in Kohana_OAuth_Signature_PLAINTEXT)

Verify a plaintext signature.

if ( ! $signature->verify($signature, $request, $consumer, $token))
{
    throw new Kohana_OAuth_Exception('Failed to verify signature');
}

This method implements OAuth 1.0 Spec 9.4.2.

Parameters

  • string $signature required - Signature to verify
  • OAuth_Request $request required - Request
  • OAuth_Consumer $consumer required - Consumer
  • OAuth_Token $token = NULL - Token

Tags

Return Values

  • boolean

Source Code

public function verify($signature, OAuth_Request $request, OAuth_Consumer $consumer, OAuth_Token $token = NULL)
{
	return $signature === $this->key($consumer, $token);
}

public __get( string $key ) (defined in Kohana_OAuth_Signature)

Return the value of any protected class variables.

$name = $signature->name;

Parameters

  • string $key required - Variable name

Return Values

  • mixed

Source Code

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

public static factory( string $name [, array $options = NULL ] ) (defined in Kohana_OAuth_Signature)

Create a new signature object by name.

$signature = OAuth_Signature::factory('HMAC-SHA1');

Parameters

  • string $name required - Signature name: HMAC-SHA1, PLAINTEXT, etc
  • array $options = NULL - Signature options

Return Values

  • OAuth_Signature

Source Code

public static function factory($name, array $options = NULL)
{
	// Create the class name as a base of this class
	$class = 'OAuth_Signature_'.str_replace('-', '_', $name);

	return new $class($options);
}

public key( OAuth_Consumer $consumer [, OAuth_Token $token = NULL ] ) (defined in Kohana_OAuth_Signature)

Get a signing key from a consumer and token.

$key = $signature->key($consumer, $token);

This method implements the signing key of OAuth 1.0 Spec 9.

Parameters

  • OAuth_Consumer $consumer required - Consumer
  • OAuth_Token $token = NULL - Token

Tags

Return Values

  • string

Source Code

public function key(OAuth_Consumer $consumer, OAuth_Token $token = NULL)
{
	$key = OAuth::urlencode($consumer->secret).'&';

	if ($token)
	{
		$key .= OAuth::urlencode($token->secret);
	}

	return $key;
}