krz/vox-populi

A Tumblr web client.

clone: git clone https://gitbay.org/krz/vox-populi.git

main: vendor/eher/oauth/src/Eher/OAuth/PlainText.php · raw

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