Class to represent an LTI system. More...
Public Member Functions | |
getRecordId () | |
Get the system record ID. | |
setRecordId ($id) | |
Sets the system record ID. | |
getKey () | |
Get the consumer key. | |
setKey ($key) | |
Set the consumer key. | |
getSetting ($name, $default='') | |
Get a setting value. | |
setSetting ($name, $value=null) | |
Set a setting value. | |
getSettings () | |
Get an array of all setting values. | |
setSettings ($settings) | |
Set an array of all setting values. | |
saveSettings () | |
Save setting values. | |
hasJwt () | |
Check whether a JWT exists. | |
getJwt () | |
Get the JWT. | |
getRawParameters () | |
Get the raw POST parameters. | |
getMessageClaims ($fullyQualified=false) | |
Get the message claims. | |
signParameters ($url, $type, $version, $params) | |
Add the signature to an LTI message. | |
signMessage (&$url, $type, $version, $params, $loginHint=null, $ltiMessageHint=null) | |
Add the signature to an LTI message. | |
sendMessage ($url, $type, $messageParams, $target='', $userId=null, $hint=null) | |
Generate a web page containing an auto-submitted form of LTI message parameters. | |
signServiceRequest ($url, $method, $type, $data=null) | |
Generates the headers for an LTI service request. | |
doServiceRequest ($service, $method, $format, $data) | |
Perform a service request. | |
useOAuth1 () | |
Determine whether this consumer is using the OAuth 1 security model. | |
addSignature ($endpoint, $data, $method='POST', $type=null, $nonce='', $hash=null, $timestamp=null) | |
Add the signature to an array of message parameters or to a header string. | |
checkMessage () | |
Verify the required properties of an LTI message. | |
verifySignature () | |
Verify the signature of a message. | |
Static Public Member Functions | |
static | parseRoles ($roles, $ltiVersion=Util::LTI_VERSION1, $addPrincipalRole=false) |
Parse a set of roles to comply with a specified version of LTI. | |
Data Fields | |
$ok = true | |
True if the last request was successful. | |
$ltiVersion = null | |
LTI version. | |
$name = null | |
Local name of platform/tool. | |
$secret = null | |
Shared secret. | |
$signatureMethod = 'HMAC-SHA1' | |
Method used for signing messages. | |
$encryptionMethod = '' | |
Algorithm used for encrypting messages. | |
$dataConnector = null | |
Data connector object. | |
$rsaKey = null | |
RSA key in PEM or JSON format. | |
$requiredScopes = array() | |
Scopes to request when obtaining an access token. | |
$kid = null | |
Key ID. | |
$jku = null | |
Endpoint for public key. | |
$reason = null | |
Error message for last request processed. | |
$details = array() | |
Details for error message relating to last request processed. | |
$warnings = array() | |
Warnings relating to last request processed. | |
$debugMode = false | |
Whether debug level messages are to be reported. | |
$enabled = false | |
Whether the system instance is enabled to accept connection requests. | |
$enableFrom = null | |
Timestamp from which the the system instance is enabled to accept connection requests. | |
$enableUntil = null | |
Timestamp until which the system instance is enabled to accept connection requests. | |
$lastAccess = null | |
Timestamp for date of last connection to this system. | |
$created = null | |
Timestamp for when the object was created. | |
$updated = null | |
Timestamp for when the object was last updated. | |
Protected Attributes | |
$jwt = null | |
JWT ClientInterface object. | |
$rawParameters = null | |
Raw message parameters. | |
$messageParameters = null | |
LTI message parameters. | |
Class to represent an LTI system.
Definition at line 21 of file System.php.
addSignature | ( | $endpoint, | |
$data, | |||
$method = 'POST' , |
|||
$type = null , |
|||
$nonce = '' , |
|||
$hash = null , |
|||
$timestamp = null |
|||
) |
Add the signature to an array of message parameters or to a header string.
string | $endpoint | URL to which message is being sent |
array | string | null | $data | Data to be passed |
string | $method | HTTP method |
string | null | $type | Content type of data being passed |
string | null | $nonce | Nonce value for JWT |
string | null | $hash | OAuth body hash value |
int | null | $timestamp | Timestamp |
Definition at line 1024 of file System.php.
checkMessage | ( | ) |
Verify the required properties of an LTI message.
Definition at line 1038 of file System.php.
References Util\$LTI_VERSIONS.
doServiceRequest | ( | $service, | |
$method, | |||
$format, | |||
$data | |||
) |
Perform a service request.
object | $service | Service object to be executed |
string | $method | HTTP action |
string | $format | Media type |
array | string | $data | Array of parameters or body string |
Definition at line 986 of file System.php.
References Util\jsonDecode().
getJwt | ( | ) |
Get the JWT.
Definition at line 352 of file System.php.
References System\$jwt.
getKey | ( | ) |
Get the consumer key.
Definition at line 248 of file System.php.
getMessageClaims | ( | $fullyQualified = false | ) |
Get the message claims.
bool | $fullyQualified | True if claims should be fully qualified rather than grouped (default is false) |
Definition at line 378 of file System.php.
References System\$messageParameters, System\$ok, Util\jsonDecode(), Util\JWT_CLAIM_MAPPING, Util\JWT_CLAIM_PREFIX, and Util\MESSAGE_TYPE_MAPPING.
getRawParameters | ( | ) |
Get the raw POST parameters.
Definition at line 362 of file System.php.
References OAuthRequest\$POST_INPUT, and System\$rawParameters.
getRecordId | ( | ) |
Get the system record ID.
Definition at line 228 of file System.php.
getSetting | ( | $name, | |
$default = '' |
|||
) |
Get a setting value.
string | $name | Name of setting |
string | null | $default | Value to return if the setting does not exist (optional, default is an empty string) |
Definition at line 271 of file System.php.
References System\$name.
Referenced by Platform\getToolSettings(), Platform\hasAccessTokenService(), Platform\hasToolSettingsService(), System\setSetting(), and Platform\setToolSettings().
getSettings | ( | ) |
Get an array of all setting values.
Definition at line 306 of file System.php.
hasJwt | ( | ) |
Check whether a JWT exists.
Definition at line 342 of file System.php.
|
static |
Parse a set of roles to comply with a specified version of LTI.
array | string | $roles | Comma-separated list of roles or array of roles |
string | $ltiVersion | LTI version for roles being returned (optional, default is LTI-1p0) |
bool | $addPrincipalRole | Add principal role when true (optional, default is false) |
Definition at line 568 of file System.php.
References Util\LTI_VERSION1, Util\LTI_VERSION1P3, and Util\LTI_VERSION2.
Referenced by ResourceLink\getMemberships().
saveSettings | ( | ) |
Save setting values.
Definition at line 326 of file System.php.
References System\$ok.
sendMessage | ( | $url, | |
$type, | |||
$messageParams, | |||
$target = '' , |
|||
$userId = null , |
|||
$hint = null |
|||
) |
Generate a web page containing an auto-submitted form of LTI message parameters.
string | $url | URL to which the form should be submitted |
string | $type | LTI message type |
array | $messageParams | Array of form parameters |
string | $target | Name of target (optional) |
string | null | $userId | ID of user (optional) |
string | null | $hint | LTI message hint (optional, use null for none) |
Definition at line 948 of file System.php.
References Util\sendForm().
setKey | ( | $key | ) |
Set the consumer key.
string | null | $key | Consumer key value |
Definition at line 258 of file System.php.
Referenced by ToolConsumer\__construct().
setRecordId | ( | $id | ) |
Sets the system record ID.
int | string | null | $id | System record ID value |
Definition at line 238 of file System.php.
Referenced by ToolConsumer\__construct().
setSetting | ( | $name, | |
$value = null |
|||
) |
Set a setting value.
string | $name | Name of setting |
string | array | null | $value | Value to set, use an empty value to delete a setting (optional, default is null) |
Definition at line 288 of file System.php.
References System\$name, and System\getSetting().
setSettings | ( | $settings | ) |
Set an array of all setting values.
array | $settings | Associative array of setting values |
Definition at line 316 of file System.php.
signMessage | ( | & | $url, |
$type, | |||
$version, | |||
$params, | |||
$loginHint = null , |
|||
$ltiMessageHint = null |
|||
) |
Add the signature to an LTI message.
If the message is being sent from a platform using LTI 1.3, then the parameters and URL will be saved and replaced with an initiate login request.
string | $url | URL for message request |
string | $type | LTI message type |
string | $version | LTI version |
array | $params | Message parameters |
string | null | $loginHint | ID of user (optional) |
string | null | $ltiMessageHint | LTI message hint (optional, use null for none) |
Definition at line 889 of file System.php.
References Tool\$defaultTool, and Util\LTI_VERSION1P3.
signParameters | ( | $url, | |
$type, | |||
$version, | |||
$params | |||
) |
Add the signature to an LTI message.
string | $url | URL for message request |
string | $type | LTI message type |
string | $version | LTI version |
array | $params | Message parameters |
Definition at line 861 of file System.php.
signServiceRequest | ( | $url, | |
$method, | |||
$type, | |||
$data = null |
|||
) |
Generates the headers for an LTI service request.
string | $url | URL for message request |
string | $method | HTTP method |
string | $type | Media type |
array | string | null | $data | Data being passed in request body (optional) |
Definition at line 966 of file System.php.
useOAuth1 | ( | ) |
Determine whether this consumer is using the OAuth 1 security model.
Definition at line 1006 of file System.php.
verifySignature | ( | ) |
Verify the signature of a message.
Definition at line 1095 of file System.php.
References Tool\$defaultTool.
int null $created = null |
Timestamp for when the object was created.
Definition at line 165 of file System.php.
DataConnector null $dataConnector = null |
Data connector object.
Definition at line 71 of file System.php.
Referenced by ToolProvider\__construct(), Platform\__construct(), Tool\__construct(), ToolConsumer\__construct(), Platform\fromConsumerKey(), Tool\fromConsumerKey(), Tool\fromInitiateLoginUrl(), Platform\fromPlatformId(), Platform\fromRecordId(), Tool\fromRecordId(), and Platform\getDataConnector().
bool $debugMode = false |
Whether debug level messages are to be reported.
Definition at line 130 of file System.php.
array $details = array() |
Details for error message relating to last request processed.
Definition at line 116 of file System.php.
bool $enabled = false |
Whether the system instance is enabled to accept connection requests.
Definition at line 137 of file System.php.
Referenced by Platform\getIsAvailable(), and Tool\getRegistrationResponsePage().
int null $enableFrom = null |
Timestamp from which the the system instance is enabled to accept connection requests.
Definition at line 144 of file System.php.
int null $enableUntil = null |
Timestamp until which the system instance is enabled to accept connection requests.
Definition at line 151 of file System.php.
string $encryptionMethod = '' |
Algorithm used for encrypting messages.
Definition at line 64 of file System.php.
string null $jku = null |
Endpoint for public key.
Definition at line 102 of file System.php.
Referenced by Tool\getConfiguration().
|
protected |
JWT ClientInterface object.
Definition at line 179 of file System.php.
Referenced by System\getJwt().
string null $kid = null |
Key ID.
Definition at line 95 of file System.php.
int null $lastAccess = null |
Timestamp for date of last connection to this system.
Definition at line 158 of file System.php.
string null $ltiVersion = null |
LTI version.
Definition at line 36 of file System.php.
|
protected |
LTI message parameters.
Definition at line 193 of file System.php.
Referenced by System\getMessageClaims(), Tool\getMessageParameters(), and Platform\getMessageParameters().
string null $name = null |
Local name of platform/tool.
Definition at line 43 of file System.php.
Referenced by Tool\getConfiguration(), System\getSetting(), Tool\setParameterConstraint(), and System\setSetting().
bool $ok = true |
True if the last request was successful.
Definition at line 29 of file System.php.
Referenced by Tool\doToolProxyService(), Platform\fromConsumerKey(), Tool\fromConsumerKey(), Platform\getIsAvailable(), System\getMessageClaims(), Platform\getToolSettings(), System\saveSettings(), and Platform\setToolSettings().
|
protected |
Raw message parameters.
Definition at line 186 of file System.php.
Referenced by System\getRawParameters().
string null $reason = null |
Error message for last request processed.
Definition at line 109 of file System.php.
array $requiredScopes = array() |
Scopes to request when obtaining an access token.
Definition at line 88 of file System.php.
string null $rsaKey = null |
RSA key in PEM or JSON format.
Set to the private key for signing outgoing messages and service requests, and to the public key for verifying incoming messages and service requests.
Definition at line 81 of file System.php.
string null $secret = null |
string $signatureMethod = 'HMAC-SHA1' |
Method used for signing messages.
Definition at line 57 of file System.php.
int null $updated = null |
Timestamp for when the object was last updated.
Definition at line 172 of file System.php.
array $warnings = array() |
Warnings relating to last request processed.
Definition at line 123 of file System.php.