ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 81 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 109 of file OAuth.php.

110 {
111 $built = $this->build_signature($request, $consumer, $token);
112
113 // Check for zero length, although unlikely here
114 if (strlen($built) == 0 || strlen($signature) == 0) {
115 return false;
116 }
117
118 if (strlen($built) != strlen($signature)) {
119 return false;
120 }
121
122 // Avoid a timing leak with a (hopefully) time insensitive compare
123 $result = 0;
124 for ($i = 0; $i < strlen($signature); $i++) {
125 $result |= ord($built{$i}) ^ ord($signature{$i});
126 }
127
128 return $result == 0;
129 }
$result
foreach($paths as $path) $request
Definition: asyncclient.php:32
build_signature($request, $consumer, $token)
Build up the signature NOTE: The output of this function MUST NOT be urlencoded.
$i
Definition: disco.tpl.php:19

References $i, $request, $result, PHPMailer\PHPMailer\$token, 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: