1: <?php
2: /**
3: * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
4: *
5: * @author Chuck Hagenbuch <chuck@horde.org>
6: * @license http://www.horde.org/licenses/bsd BSD
7: * @category Horde
8: * @package Oauth
9: */
10:
11: /**
12: * OAuth plaintext signature method
13: *
14: * @author Chuck Hagenbuch <chuck@horde.org>
15: * @license http://www.horde.org/licenses/bsd BSD
16: * @category Horde
17: * @package Oauth
18: */
19: class Horde_Oauth_SignatureMethod_Plaintext extends Horde_Oauth_SignatureMethod
20: {
21: public function getName()
22: {
23: return 'PLAINTEXT';
24: }
25:
26: public function sign($request, $consumer, $token)
27: {
28: $signature = array(
29: Horde_Oauth_Utils::urlencodeRfc3986($consumer->secret),
30: );
31:
32: if ($token) {
33: array_push($signature, Horde_Oauth_Utils::urlencodeRfc3986($token->secret));
34: } else {
35: array_push($signature, '');
36: }
37:
38: return Horde_Oauth_Utils::urlencodeRfc3986(implode('&', $signature));
39: }
40: }
41: