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

Reimplemented in OAuthSignatureMethod_HMAC_SHA1, OAuthSignatureMethod_PLAINTEXT, and OAuthSignatureMethod_RSA_SHA1.

Referenced by check_signature().

+ Here is the caller graph for this function:

◆ 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

Reimplemented in OAuthSignatureMethod_RSA_SHA1.

Definition at line 99 of file OAuth.php.

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

References $consumer, $i, $result, and build_signature().

+ Here is the call graph for this function:

◆ get_name()

OAuthSignatureMethod::get_name ( )
abstract

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

Returns
string

Reimplemented in OAuthSignatureMethod_HMAC_SHA1, OAuthSignatureMethod_PLAINTEXT, and OAuthSignatureMethod_RSA_SHA1.


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