Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
OAuthSignatureMethod_PLAINTEXT | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
get_name | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
build_signature | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | // vim: foldmethod=marker |
3 | /** |
4 | * The MIT License |
5 | * |
6 | * Copyright (c) 2007 Andy Smith |
7 | * |
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
9 | * of this software and associated documentation files ( the "Software" ), to deal |
10 | * in the Software without restriction, including without limitation the rights |
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
12 | * copies of the Software, and to permit persons to whom the Software is |
13 | * furnished to do so, subject to the following conditions: |
14 | * |
15 | * The above copyright notice and this permission notice shall be included in |
16 | * all copies or substantial portions of the Software. |
17 | * |
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
24 | * THE SOFTWARE. |
25 | */ |
26 | |
27 | namespace MediaWiki\Extension\OAuth\Lib; |
28 | |
29 | /** |
30 | * The PLAINTEXT method does not provide any security protection and SHOULD only be used |
31 | * over a secure channel such as HTTPS. It does not use the Signature Base String. |
32 | * - Chapter 9.4 ( "PLAINTEXT" ) |
33 | */ |
34 | class OAuthSignatureMethod_PLAINTEXT extends OAuthSignatureMethod { |
35 | public function get_name() { |
36 | return "PLAINTEXT"; |
37 | } |
38 | |
39 | /** |
40 | * oauth_signature is set to the concatenated encoded values of the Consumer Secret and |
41 | * Token Secret, separated by a '&' character ( ASCII code 38 ), even if either secret is |
42 | * empty. The result MUST be encoded again. |
43 | * - Chapter 9.4.1 ( "Generating Signatures" ) |
44 | * |
45 | * Please note that the second encoding MUST NOT happen in the SignatureMethod, as |
46 | * OAuthRequest handles this! |
47 | */ |
48 | public function build_signature( $request, $consumer, $token ) { |
49 | $key_parts = array( |
50 | $consumer->secret, |
51 | ( $token ) ? $token->secret : "" |
52 | ); |
53 | |
54 | $key_parts = OAuthUtil::urlencode_rfc3986( $key_parts ); |
55 | $key = implode( '&', $key_parts ); |
56 | $request->base_string = $key; |
57 | |
58 | return $key; |
59 | } |
60 | } |