LTI Integration Library 4.10.3
PHP class library for building LTI integrations
 
Loading...
Searching...
No Matches
OAuthDataStore.php
1<?php
2
3namespace ceLTIc\LTI;
4
7use ceLTIc\LTI\OAuth;
11
20{
21
27 private $system = null;
28
34 public function __construct($system)
35 {
36 $this->system = $system;
37 }
38
46 function lookup_consumer($consumerKey)
47 {
48 $key = $this->system->getKey();
49 $secret = '';
50 if (!empty($key)) {
51 $secret = $this->system->secret;
52 } elseif (($this->system instanceof Tool) && !empty($this->system->platform)) {
53 $key = $this->system->platform->getKey();
54 $secret = $this->system->platform->secret;
55 } elseif (($this->system instanceof Platform) && !empty(Tool::$defaultTool)) {
56 $key = Tool::$defaultTool->getKey();
57 $secret = Tool::$defaultTool->secret;
58 }
59 if ($key !== $consumerKey) {
60 throw new OAuthException('Consumer key not found');
61 }
62
63 return new OAuthConsumer($key, $secret);
64 }
65
75 function lookup_token($consumer, $tokenType, $token)
76 {
77 return new OAuthToken($consumer, '');
78 }
79
90 function lookup_nonce($consumer, $token, $value, $timestamp)
91 {
92 if ($this->system instanceof Platform) {
93 $platform = $this->system;
94 } else {
95 $platform = $this->system->platform;
96 }
97 $nonce = new PlatformNonce($platform, $value);
98 $ok = !$nonce->load();
99 if ($ok) {
100 $ok = $nonce->save();
101 }
102 if (!$ok) {
103 $this->system->reason = 'Invalid nonce.';
104 }
105
106 return !$ok;
107 }
108
117 function new_request_token($consumer, $callback = null)
118 {
119 return null;
120 }
121
131 function new_access_token($token, $consumer, $verifier = null)
132 {
133 return null;
134 }
135
136}
lookup_consumer($consumerKey)
Create an OAuthConsumer object for the system.
new_access_token($token, $consumer, $verifier=null)
Get new access token.
__construct($system)
Class constructor.
new_request_token($consumer, $callback=null)
Get new request token.
lookup_token($consumer, $tokenType, $token)
Create an OAuthToken object for the system.
lookup_nonce($consumer, $token, $value, $timestamp)
Lookup nonce value for the system.
Class to represent an OAuth Consumer.
Class to represent an OAuth Data Store.
Class to represent an OAuth Exception.
Class to represent an OAuth token.
Class to represent a platform nonce.
Class to represent a platform.
Definition Platform.php:18
Class to represent an LTI Tool.
Definition Tool.php:24
static $defaultTool
Default tool for use with service requests.
Definition Tool.php:294