Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
namespace IMSGlobal\LTI\OAuth;
4
 
5
/**
6
 * Class to represent an %OAuth Token
7
 *
8
 * @copyright  Andy Smith
9
 * @version 2008-08-04
10
 * @license https://opensource.org/licenses/MIT The MIT License
11
 */
12
#[\AllowDynamicProperties]
13
class OAuthToken {
14
 
15
    // access tokens and request tokens
16
    public $key;
17
    public $secret;
18
 
19
    /**
20
     * key = the token
21
     * secret = the token secret
22
     */
23
    function __construct($key, $secret) {
24
        $this->key = $key;
25
        $this->secret = $secret;
26
    }
27
 
28
    /**
29
     * generates the basic string serialization of a token that a server
30
     * would respond to request_token and access_token calls with
31
     */
32
    function to_string() {
33
        return 'oauth_token=' .
34
               OAuthUtil::urlencode_rfc3986($this->key) .
35
               '&oauth_token_secret=' .
36
               OAuthUtil::urlencode_rfc3986($this->secret);
37
    }
38
 
39
    function __toString() {
40
        return $this->to_string();
41
    }
42
 
43
}