c29ebf3c2c2bd834b0fe8f71addeb37f3434ecbf
[WP-Plugins/glm-member-db-registrations.git] /
1 <?php
2 namespace PayPal\Auth\Oauth;
3 /**
4  * The PLAINTEXT method does not provide any security protection and SHOULD only be used
5  * over a secure channel such as HTTPS. It does not use the Signature Base String.
6  *   - Chapter 9.4 ("PLAINTEXT")
7  */
8 class OAuthSignatureMethodPLAINTEXT extends OAuthSignatureMethod {
9         public function get_name() {
10                 return "PLAINTEXT";
11         }
12
13         /**
14          * oauth_signature is set to the concatenated encoded values of the Consumer Secret and
15          * Token Secret, separated by a '&' character (ASCII code 38), even if either secret is
16          * empty. The result MUST be encoded again.
17          *   - Chapter 9.4.1 ("Generating Signatures")
18          *
19          * Please note that the second encoding MUST NOT happen in the SignatureMethod, as
20          * OAuthRequest handles this!
21          */
22         public function build_signature($request, $consumer, $token) {
23                 $key_parts = array(
24                 $consumer->secret,
25                 ($token) ? $token->secret : ""
26                 );
27
28                 $key_parts = OAuthUtil::urlencode_rfc3986($key_parts);
29                 $key = implode('&', $key_parts);
30                 $request->base_string = $key;
31
32                 return $key;
33         }
34 }