Class to represent an LTI system. More...
Public Member Functions | |
| int null | getRecordId () |
| Get the system record ID. | |
| setRecordId ($id) | |
| Sets the system record ID. | |
| string | getKey () |
| Get the consumer key. | |
| setKey ($key) | |
| Set the consumer key. | |
| string | getSetting ($name, $default='') |
| Get a setting value. | |
| setSetting ($name, $value=null) | |
| Set a setting value. | |
| array | getSettings () |
| Get an array of all setting values. | |
| setSettings ($settings) | |
| Set an array of all setting values. | |
| bool | saveSettings () |
| Save setting values. | |
| bool | hasJwt () |
| Check whether a JWT exists. | |
| ClientInterface | getJwt () |
| Get the JWT. | |
| array | getRawParameters () |
| Get the raw POST parameters. | |
| array | getMessageClaims ($fullyQualified=false) |
| Get the message claims. | |
| array string | signParameters ($url, $type, $version, $params) |
| Add the signature to an LTI message. | |
| array string | signMessage (&$url, $type, $version, $params, $loginHint=null, $ltiMessageHint=null) |
| Add the signature to an LTI message. | |
| string | sendMessage ($url, $type, $messageParams, $target='', $userId=null, $hint=null) |
| Generate a web page containing an auto-submitted form of LTI message parameters. | |
| string | signServiceRequest ($url, $method, $type, $data=null) |
| Generates the headers for an LTI service request. | |
| HttpMessage | doServiceRequest ($service, $method, $format, $data) |
| Perform a service request. | |
| bool | useOAuth1 () |
| Determine whether this consumer is using the OAuth 1 security model. | |
| mixed | 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. | |
| bool | checkMessage () |
| Verify the required properties of an LTI message. | |
| bool | verifySignature () |
| Verify the signature of a message. | |
Static Public Member Functions | |
| static array | parseRoles ($roles, $ltiVersion=Util::LTI_VERSION1, $addPrincipalRole=false) |
| Parse a set of roles to comply with a specified version of LTI. | |
Public Attributes | |
| bool | $ok = true |
| True if the last request was successful. | |
| string null | $secret = null |
| Shared secret. | |
| string | $signatureMethod = 'HMAC-SHA1' |
| Method used for signing messages. | |
| string | $encryptionMethod = '' |
| Algorithm used for encrypting messages. | |
| DataConnector null | $dataConnector = null |
| Data connector object. | |
| string null | $rsaKey = null |
| RSA key in PEM or JSON format. | |
| array | $requiredScopes = array() |
| Scopes to request when obtaining an access token. | |
| string null | $kid = null |
| Key ID. | |
| string null | $jku = null |
| Endpoint for public key. | |
| string null | $reason = null |
| Error message for last request processed. | |
| array | $details = array() |
| Details for error message relating to last request processed. | |
| bool | $debugMode = false |
| Whether debug level messages are to be reported. | |
| bool | $enabled = false |
| Whether the system instance is enabled to accept connection requests. | |
| int null | $enableFrom = null |
| Timestamp from which the the system instance is enabled to accept connection requests. | |
| int null | $enableUntil = null |
| Timestamp until which the system instance is enabled to accept connection requests. | |
| int null | $lastAccess = null |
| Timestamp for date of last connection to this system. | |
| int null | $created = null |
| Timestamp for when the object was created. | |
| int null | $updated = null |
| Timestamp for when the object was last updated. | |
Protected Attributes | |
| JWS null | $jwt = null |
| JWT object, if any. | |
| array | $rawParameters = null |
| Raw message parameters. | |
| array null | $messageParameters = null |
| LTI message parameters. | |
Class to represent an LTI system.
| mixed 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 |
| mixed | $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 |
| bool checkMessage | ( | ) |
Verify the required properties of an LTI message.
| HttpMessage doServiceRequest | ( | $service, | |
| $method, | |||
| $format, | |||
| $data | |||
| ) |
Perform a service request.
| object | $service | Service object to be executed |
| string | $method | HTTP action |
| string | $format | Media type |
| mixed | $data | Array of parameters or body string |
| ClientInterface getJwt | ( | ) |
Get the JWT.
| string getKey | ( | ) |
Get the consumer key.
| array getMessageClaims | ( | $fullyQualified = false | ) |
Get the message claims.
| bool | $fullyQualified | True if claims should be fully qualified rather than grouped (default is false) |
| array getRawParameters | ( | ) |
Get the raw POST parameters.
| int null getRecordId | ( | ) |
Get the system record ID.
| string getSetting | ( | $name, | |
$default = '' |
|||
| ) |
Get a setting value.
| string | $name | Name of setting |
| string | $default | Value to return if the setting does not exist (optional, default is an empty string) |
Referenced by Platform\getTools().
| array getSettings | ( | ) |
Get an array of all setting values.
| bool hasJwt | ( | ) |
Check whether a JWT exists.
|
static |
Parse a set of roles to comply with a specified version of LTI.
| mixed | $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) |
| bool saveSettings | ( | ) |
Save setting values.
| string 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 | $userId | ID of user (optional) |
| string | $hint | LTI message hint (optional, use null for none) |
| setKey | ( | $key | ) |
Set the consumer key.
| string | $key | Consumer key value |
Referenced by ToolConsumer\__construct().
| setRecordId | ( | $id | ) |
Sets the system record ID.
| int | $id | System record ID value |
Referenced by ToolConsumer\__construct().
| setSetting | ( | $name, | |
$value = null |
|||
| ) |
Set a setting value.
| string | $name | Name of setting |
| string | $value | Value to set, use an empty value to delete a setting (optional, default is null) |
| setSettings | ( | $settings | ) |
Set an array of all setting values.
| array | $settings | Associative array of setting values |
| array string 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 | $loginHint | ID of user (optional) |
| string | $ltiMessageHint | LTI message hint (optional, use null for none) |
| array string 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 |
| string 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 |
| string | $data | Data being passed in request body (optional) |
| bool useOAuth1 | ( | ) |
Determine whether this consumer is using the OAuth 1 security model.
| bool verifySignature | ( | ) |
Verify the signature of a message.
| int null $created = null |
Timestamp for when the object was created.
$created
| DataConnector null $dataConnector = null |
Data connector object.
$dataConnector
Referenced by ToolProvider\__construct(), Platform\__construct(), ToolConsumer\__construct(), Platform\fromPlatformId(), and Tool\initialize().
| bool $debugMode = false |
Whether debug level messages are to be reported.
$debugMode
| array $details = array() |
Details for error message relating to last request processed.
$details
| bool $enabled = false |
Whether the system instance is enabled to accept connection requests.
$enabled
Referenced by Tool\fromConsumerKey().
| int null $enableFrom = null |
Timestamp from which the the system instance is enabled to accept connection requests.
$enableFrom
| int null $enableUntil = null |
Timestamp until which the system instance is enabled to accept connection requests.
$enableUntil
| string $encryptionMethod = '' |
Algorithm used for encrypting messages.
$encryptionMethod
| string null $jku = null |
Endpoint for public key.
$jku
|
protected |
JWT object, if any.
$jwt
| string null $kid = null |
Key ID.
$kid
| int null $lastAccess = null |
Timestamp for date of last connection to this system.
$lastAccess
|
protected |
LTI message parameters.
$messageParameters
| bool $ok = true |
True if the last request was successful.
$ok
Referenced by Platform\fromPlatformId(), and Platform\getTools().
|
protected |
Raw message parameters.
$rawParameters
| string null $reason = null |
Error message for last request processed.
$reason
| array $requiredScopes = array() |
Scopes to request when obtaining an access token.
$requiredScopes
| 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.
$rsaKey
| string null $secret = null |
Shared secret.
$secret
| string $signatureMethod = 'HMAC-SHA1' |
Method used for signing messages.
$signatureMethod
| int null $updated = null |
Timestamp for when the object was last updated.
$updated