ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\LTI\ToolProvider\PlatformNonce Class Reference

Class to represent a platform nonce. More...

+ Collaboration diagram for ILIAS\LTI\ToolProvider\PlatformNonce:

Public Member Functions

 __construct (Platform $platform, string $value=null)
 Class constructor. More...
 
 load ()
 Load a nonce value from the database. More...
 
 save ()
 Save a nonce value in the database. More...
 
 delete ()
 Delete a nonce value in the database. More...
 
 getPlatform ()
 Get platform. More...
 
 getValue ()
 Get outcome value. More...
 

Data Fields

const MAX_NONCE_AGE = 30
 Maximum age nonce values will be retained for (in minutes). More...
 
int $expires = null
 Timestamp for when the nonce value expires. More...
 

Static Public Attributes

static int $maximumLength = 50
 Maximum length which can be stored. More...
 

Private Attributes

Platform $platform = null
 Platform to which this nonce applies. More...
 
string $value = null
 Nonce value. More...
 

Detailed Description

Class to represent a platform nonce.

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 28 of file PlatformNonce.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\LTI\ToolProvider\PlatformNonce::__construct ( Platform  $platform,
string  $value = null 
)

Class constructor.

Parameters
Platform$platformPlatform object
string | null$valueNonce value (optional, default is null)

Definition at line 70 of file PlatformNonce.php.

References ILIAS\LTI\ToolProvider\PlatformNonce\$platform.

71  {
72  $this->platform = $platform;
73  $this->value = substr($value, -self::$maximumLength);
74  $this->expires = time() + (self::MAX_NONCE_AGE * 60);
75  }
Platform $platform
Platform to which this nonce applies.

Member Function Documentation

◆ delete()

ILIAS\LTI\ToolProvider\PlatformNonce::delete ( )

Delete a nonce value in the database.

Returns
bool True if the nonce value was successfully deleted

Definition at line 102 of file PlatformNonce.php.

102  : bool
103  {
104  return $this->platform->getDataConnector()->deletePlatformNonce($this);
105  }

◆ getPlatform()

ILIAS\LTI\ToolProvider\PlatformNonce::getPlatform ( )

Get platform.

Returns
Platform Platform for this nonce

Definition at line 112 of file PlatformNonce.php.

References ILIAS\LTI\ToolProvider\PlatformNonce\$platform.

112  : ?Platform
113  {
114  return $this->platform;
115  }
Platform $platform
Platform to which this nonce applies.

◆ getValue()

ILIAS\LTI\ToolProvider\PlatformNonce::getValue ( )

Get outcome value.

Returns
string Outcome value

Definition at line 122 of file PlatformNonce.php.

References ILIAS\LTI\ToolProvider\PlatformNonce\$value.

122  : ?string
123  {
124  return $this->value;
125  }

◆ load()

ILIAS\LTI\ToolProvider\PlatformNonce::load ( )

Load a nonce value from the database.

Returns
bool True if the nonce value was successfully loaded

Definition at line 82 of file PlatformNonce.php.

Referenced by ILIAS\LTI\ToolProvider\verifySignature().

82  : bool
83  {
84  return $this->platform->getDataConnector()->loadPlatformNonce($this);
85  }
+ Here is the caller graph for this function:

◆ save()

ILIAS\LTI\ToolProvider\PlatformNonce::save ( )

Save a nonce value in the database.

Returns
bool True if the nonce value was successfully saved

Definition at line 92 of file PlatformNonce.php.

Referenced by ILIAS\LTI\ToolProvider\verifySignature().

92  : bool
93  {
94  return $this->platform->getDataConnector()->savePlatformNonce($this);
95  }
+ Here is the caller graph for this function:

Field Documentation

◆ $expires

int null ILIAS\LTI\ToolProvider\PlatformNonce::$expires = null

Timestamp for when the nonce value expires.

Definition at line 49 of file PlatformNonce.php.

◆ $maximumLength

int ILIAS\LTI\ToolProvider\PlatformNonce::$maximumLength = 50
static

Maximum length which can be stored.

Characters are removed from the beginning of the value when too long.

Definition at line 42 of file PlatformNonce.php.

◆ $platform

Platform null ILIAS\LTI\ToolProvider\PlatformNonce::$platform = null
private

◆ $value

string null ILIAS\LTI\ToolProvider\PlatformNonce::$value = null
private

Nonce value.

Definition at line 63 of file PlatformNonce.php.

Referenced by ILIAS\LTI\ToolProvider\PlatformNonce\getValue().

◆ MAX_NONCE_AGE

const ILIAS\LTI\ToolProvider\PlatformNonce::MAX_NONCE_AGE = 30

Maximum age nonce values will be retained for (in minutes).

Definition at line 33 of file PlatformNonce.php.


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