ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
OAuthSignatureMethod Class Reference

A class for implementing a Signature Method See section 9 ("Signing Requests") in the spec. More...

+ Inheritance diagram for OAuthSignatureMethod:
+ Collaboration diagram for OAuthSignatureMethod:

Public Member Functions

 get_name ()
 Needs to return the name of the Signature Method (ie HMAC-SHA1) More...
 
 build_signature ($request, $consumer, $token)
 Build up the signature NOTE: The output of this function MUST NOT be urlencoded. More...
 
 check_signature ($request, $consumer, $token, $signature)
 Verifies that a given signature is correct. More...
 

Detailed Description

A class for implementing a Signature Method See section 9 ("Signing Requests") in the spec.

Definition at line 72 of file OAuth.php.

Member Function Documentation

◆ build_signature()

OAuthSignatureMethod::build_signature (   $request,
  $consumer,
  $token 
)
abstract

Build up the signature NOTE: The output of this function MUST NOT be urlencoded.

the encoding is handled in OAuthRequest when the final request is serialized

Parameters
OAuthRequest$request
OAuthConsumer$consumer
OAuthToken$token
Returns
string

◆ check_signature()

OAuthSignatureMethod::check_signature (   $request,
  $consumer,
  $token,
  $signature 
)

Verifies that a given signature is correct.

Parameters
OAuthRequest$request
OAuthConsumer$consumer
OAuthToken$token
string$signature
Returns
bool

Definition at line 99 of file OAuth.php.

References $consumer, $i, and $result.

99  {
100  $built = $this->build_signature($request, $consumer, $token);
101 
102  // Check for zero length, although unlikely here
103  if (strlen($built) == 0 || strlen($signature) == 0) {
104  return false;
105  }
106 
107  if (strlen($built) != strlen($signature)) {
108  return false;
109  }
110 
111  // Avoid a timing leak with a (hopefully) time insensitive compare
112  $result = 0;
113  for ($i = 0; $i < strlen($signature); $i++) {
114  $result |= ord($built{$i}) ^ ord($signature{$i});
115  }
116 
117  return $result == 0;
118  }
$result
build_signature($request, $consumer, $token)
Build up the signature NOTE: The output of this function MUST NOT be urlencoded.
$consumer
Definition: demo.php:30
$i
Definition: disco.tpl.php:19

◆ get_name()

OAuthSignatureMethod::get_name ( )
abstract

Needs to return the name of the Signature Method (ie HMAC-SHA1)

Returns
string

The documentation for this class was generated from the following file: