diff options
author | Christian Cleberg <hello@cleberg.net> | 2023-05-22 15:37:34 -0500 |
---|---|---|
committer | Christian Cleberg <hello@cleberg.net> | 2023-05-22 15:37:34 -0500 |
commit | 17ff8aec3a0d2e0a520849c42c40a154a0831495 (patch) | |
tree | 8860d29e9d0f9acd1535c7827045864fc31f8d01 /vendor/eher/oauth/src/Eher/OAuth/PlainText.php | |
download | michelangelo-17ff8aec3a0d2e0a520849c42c40a154a0831495.tar.gz michelangelo-17ff8aec3a0d2e0a520849c42c40a154a0831495.tar.bz2 michelangelo-17ff8aec3a0d2e0a520849c42c40a154a0831495.zip |
initial commit
Diffstat (limited to 'vendor/eher/oauth/src/Eher/OAuth/PlainText.php')
-rw-r--r-- | vendor/eher/oauth/src/Eher/OAuth/PlainText.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/eher/oauth/src/Eher/OAuth/PlainText.php b/vendor/eher/oauth/src/Eher/OAuth/PlainText.php new file mode 100644 index 0000000..895aeed --- /dev/null +++ b/vendor/eher/oauth/src/Eher/OAuth/PlainText.php @@ -0,0 +1,36 @@ +<?php + +namespace Eher\OAuth; + +/** + * The PLAINTEXT method does not provide any security protection and SHOULD only be used + * over a secure channel such as HTTPS. It does not use the Signature Base String. + * - Chapter 9.4 ("PLAINTEXT") + */ +class PlainText extends SignatureMethod { + public function get_name() { + return "PLAINTEXT"; + } + + /** + * oauth_signature is set to the concatenated encoded values of the Consumer Secret and + * Token Secret, separated by a '&' character (ASCII code 38), even if either secret is + * empty. The result MUST be encoded again. + * - Chapter 9.4.1 ("Generating Signatures") + * + * Please note that the second encoding MUST NOT happen in the SignatureMethod, as + * Request handles this! + */ + public function build_signature($request, $consumer, $token) { + $key_parts = array( + $consumer->secret, + ($token) ? $token->secret : "" + ); + + $key_parts = Util::urlencode_rfc3986($key_parts); + $key = implode('&', $key_parts); + $request->base_string = $key; + + return $key; + } +} |