ILIAS  release_8 Revision v8.24
ILIAS\LTI\ToolProvider\OAuthDataStore Class Reference

Class to represent an OAuth datastore. More...

+ Inheritance diagram for ILIAS\LTI\ToolProvider\OAuthDataStore:
+ Collaboration diagram for ILIAS\LTI\ToolProvider\OAuthDataStore:

Public Member Functions

 __construct ($system)
 Class constructor. More...
 
 lookup_consumer (string $consumerKey)
 Create an OAuthConsumer object for the system. More...
 
 lookup_token (OAuthConsumer $consumer, string $tokenType, string $token)
 Create an OAuthToken object for the system. More...
 
 lookup_nonce (OAuthConsumer $consumer, ?OAuthToken $token, string $value, int $timestamp)
 Lookup nonce value for the system. More...
 
 new_request_token (OAuthConsumer $consumer, $callback=null)
 Get new request token. More...
 
 new_access_token (OAuthToken $token, OAuthConsumer $consumer, $verifier=null)
 Get new access token. More...
 

Private Attributes

 $system = null
 System object. More...
 

Detailed Description

Class to represent an OAuth datastore.

Author
Stephen P Vickers steph.nosp@m.en@s.nosp@m.pvsof.nosp@m.twar.nosp@m.eprod.nosp@m.ucts.nosp@m..com

Definition at line 33 of file OAuthDataStore.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\LTI\ToolProvider\OAuthDataStore::__construct (   $system)

Class constructor.

Parameters
Tool | Platform$systemSystem object

Definition at line 47 of file OAuthDataStore.php.

48 {
49 $this->system = $system;
50 }

References ILIAS\LTI\ToolProvider\OAuthDataStore\$system.

Member Function Documentation

◆ lookup_consumer()

ILIAS\LTI\ToolProvider\OAuthDataStore::lookup_consumer ( string  $consumerKey)

Create an OAuthConsumer object for the system.

Parameters
string$consumerKeyConsumer key value
Returns
OAuthConsumer OAuthConsumer object

Definition at line 57 of file OAuthDataStore.php.

57 : OAuthConsumer
58 {
59 $key = $this->system->getKey();
60 $secret = '';
61 if (!empty($key)) {
62 $secret = $this->system->secret;
63 } elseif (($this->system instanceof Tool) && !empty($this->system->platform)) {
64 $key = $this->system->platform->getKey();
65 $secret = $this->system->platform->secret;
66 } elseif (($this->system instanceof Platform) && !empty(Tool::$defaultTool)) {
67 $key = Tool::$defaultTool->getKey();
69 }
70 if ($key !== $consumerKey) {
71 throw new OAuthException('Consumer key not found');
72 }
73
74 return new OAuthConsumer($key, $secret);
75 }
static Tool $defaultTool
Default tool for use with service requests.
Definition: Tool.php:299
string $key
Consumer key/client ID value.
Definition: System.php:193
string $secret
Shared secret.
Definition: System.php:43

References ILIAS\LTI\ToolProvider\Tool\$defaultTool, ILIAS\LTI\ToolProvider\$key, and ILIAS\LTI\ToolProvider\$secret.

◆ lookup_nonce()

ILIAS\LTI\ToolProvider\OAuthDataStore::lookup_nonce ( OAuthConsumer  $consumer,
?OAuthToken  $token,
string  $value,
int  $timestamp 
)

Lookup nonce value for the system.

Parameters
OAuthConsumer$consumerOAuthConsumer object
OAuthToken | null$tokenToken value //UK: removed string
string$valueNonce value
int$timestampDate/time of request //UK: removed string
Returns
bool True if the nonce value already exists

Definition at line 97 of file OAuthDataStore.php.

97 : bool
98 {
99 if ($this->system instanceof Platform) {
100 $platform = $this->system;
101 } else {
102 $platform = $this->system->platform;
103 }
104 $nonce = new PlatformNonce($platform, $value);
105 $ok = !$nonce->load();
106 if ($ok) {
107 $ok = $nonce->save();
108 }
109 if (!$ok) {
110 $this->system->reason = 'Invalid nonce.';
111 }
112
113 return !$ok;
114 }

References ILIAS\LTI\ToolProvider\OAuthDataStore\$system.

◆ lookup_token()

ILIAS\LTI\ToolProvider\OAuthDataStore::lookup_token ( OAuthConsumer  $consumer,
string  $tokenType,
string  $token 
)

Create an OAuthToken object for the system.

Parameters
OAuthConsumer$consumerOAuthConsumer object //UK: removed string
string$tokenTypeToken type
string$tokenToken value
Returns
OAuthToken OAuthToken object

Definition at line 84 of file OAuthDataStore.php.

84 : OAuthToken
85 {
86 return new OAuthToken($consumer, '');
87 }

◆ new_access_token()

ILIAS\LTI\ToolProvider\OAuthDataStore::new_access_token ( OAuthToken  $token,
OAuthConsumer  $consumer,
  $verifier = null 
)

Get new access token.

Parameters
OAuthToken$tokenToken value //UK: removed string CHECK
OAuthConsumer$consumerOAuthConsumer object
string$verifierVerification code
Returns
string Null value

Definition at line 134 of file OAuthDataStore.php.

134 : ?string
135 {
136 return null;
137 }

◆ new_request_token()

ILIAS\LTI\ToolProvider\OAuthDataStore::new_request_token ( OAuthConsumer  $consumer,
  $callback = null 
)

Get new request token.

Parameters
OAuthConsumer$consumerOAuthConsumer object
mixed$callbackCallback URL //UK: removed string CHECK
Returns
string Null value

Definition at line 122 of file OAuthDataStore.php.

122 : ?string
123 {
124 return null;
125 }

Field Documentation

◆ $system

Tool Platform null ILIAS\LTI\ToolProvider\OAuthDataStore::$system = null
private

The documentation for this class was generated from the following file: