remove old readme
[atutor.git] / mods / _standard / basiclti / launch / TrivialStore.php
1 <?php
2 /**
3  * A Trivial memory-based store - no support for tokens
4  */
5 class TrivialOAuthDataStore extends OAuthDataStore {
6     private $consumers = array();
7
8     function add_consumer($consumer_key, $consumer_secret) {
9         $this->consumers[$consumer_key] = $consumer_secret;
10     }
11
12     function lookup_consumer($consumer_key) {
13         if ( strpos($consumer_key, "http://" ) === 0 ) {
14             $consumer = new OAuthConsumer($consumer_key,"secret", NULL);
15             return $consumer;
16         }
17         if ( $this->consumers[$consumer_key] ) {
18             $consumer = new OAuthConsumer($consumer_key,$this->consumers[$consumer_key], NULL);
19             return $consumer;
20         }
21         return NULL;
22     }
23
24     function lookup_token($consumer, $token_type, $token) {
25         return new OAuthToken($consumer, "");
26     }
27
28     // Return NULL if the nonce has not been used
29     // Return $nonce if the nonce was previously used
30     function lookup_nonce($consumer, $token, $nonce, $timestamp) {
31         // Should add some clever logic to keep nonces from
32         // being reused - for no we are really trusting
33         // that the timestamp will save us
34         return NULL;
35     }
36
37     function new_request_token($consumer) {
38         return NULL;
39     }
40
41     function new_access_token($token, $consumer) {
42         return NULL;
43     }
44 }
45 ?>