LTI Integration Library 5.2.0
PHP class library for building LTI integrations
 
Loading...
Searching...
No Matches
ceLTIc\LTI\AccessToken Class Reference

Class to represent an HTTP message. More...

Public Member Functions

 __construct (Platform $platform, ?array $scopes=[], ?string $token=null, ?int $expires=null)
 Class constructor.
 
Platform getPlatform ()
 Get platform.
 
bool load ()
 Load a nonce value from the database.
 
bool save ()
 Save a nonce value in the database.
 
bool hasScope (string $scope='')
 Check if a valid access token exists for a specific scope (or any scope if none specified).
 
AccessToken get (string $scope='', bool $scopeOnly=false)
 Obtain a valid access token for a scope.
 

Public Attributes

string $token = null
 Access token string.
 
int $expires = null
 Timestamp at which the token string expires.
 
array $scopes = []
 Scope(s) for which the access token is valid.
 
int $created = null
 Timestamp for when the object was created.
 
int $updated = null
 Timestamp for when the object was last updated.
 

Detailed Description

Class to represent an HTTP message.

Author
Stephen P Vickers steph.nosp@m.en@s.nosp@m.pvsof.nosp@m.twar.nosp@m.eprod.nosp@m.ucts.nosp@m..com
Version
3.0.0
Licence: http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3

Constructor & Destructor Documentation

◆ __construct()

ceLTIc\LTI\AccessToken::__construct ( Platform $platform,
?array $scopes = [],
?string $token = null,
?int $expires = null )

Class constructor.

Parameters
Platform$platformPlatform
array | null$scopesScopes for which the access token is valid
string | null$tokenAccess token string
int | null$expiresTime in seconds after which the token string will expire

Member Function Documentation

◆ get()

AccessToken ceLTIc\LTI\AccessToken::get ( string $scope = '',
bool $scopeOnly = false )

Obtain a valid access token for a scope.

Parameters
string$scopeAccess scope
bool$scopeOnlyIf true, a token is requested just for the specified scope
Returns
AccessToken New access token

Referenced by ceLTIc\LTI\DataConnector\DataConnector\savePlatformNonce().

◆ getPlatform()

◆ hasScope()

bool ceLTIc\LTI\AccessToken::hasScope ( string $scope = '')

Check if a valid access token exists for a specific scope (or any scope if none specified).

Parameters
string$scopeAccess scope
Returns
bool True if there is an unexpired access token for specified scope

References ceLTIc\LTI\Tool\$defaultTool.

◆ load()

bool ceLTIc\LTI\AccessToken::load ( )

Load a nonce value from the database.

Returns
bool True if the nonce value was successfully loaded

References ceLTIc\LTI\Tool\$defaultTool.

◆ save()

bool ceLTIc\LTI\AccessToken::save ( )

Save a nonce value in the database.

Returns
bool True if the nonce value was successfully saved

Member Data Documentation

◆ $created

int ceLTIc\LTI\AccessToken::$created = null

Timestamp for when the object was created.

◆ $expires

int ceLTIc\LTI\AccessToken::$expires = null

Timestamp at which the token string expires.

◆ $scopes

array ceLTIc\LTI\AccessToken::$scopes = []

Scope(s) for which the access token is valid.

◆ $token

string ceLTIc\LTI\AccessToken::$token = null

Access token string.

◆ $updated

int ceLTIc\LTI\AccessToken::$updated = null

Timestamp for when the object was last updated.