Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401]

A Helper for LTI Dynamic Registration.

Copyright: 2020 Claude Vervoort (Cengage), Carlos Costa, Adrian Hutchinson (Macgraw Hill)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 449 lines (19 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: registration_helper  - X-Ref

This class exposes functions for LTI Dynamic Registration.

get()   X-Ref
Get an instance of this helper

return: object

get_parameter(array $payload, string $key, bool $required)   X-Ref
Function used to validate parameters.

This function is needed because the payload contains nested
objects, and optional_param() does not support arrays of arrays.

param: array $payload that may contain the parameter key
param: string $key the key of the value to be looked for in the payload
param: bool $required if required, not finding a value will raise a registration_exception
return: mixed

registration_to_config(array $registrationpayload, string $clientid)   X-Ref
Transforms an LTI 1.3 Registration to a Moodle LTI Config.

param: array $registrationpayload the registration data received from the tool.
param: string $clientid the clientid to be issued for that tool.
return: object the Moodle LTI config.

add_previous_key_claim(array &$lticonfig, string $key, string $secret)   X-Ref
Adds to the config the LTI 1.1 key and sign it with the 1.1 secret.

param: array $lticonfig reference to lticonfig to which to add the 1.1 OAuth info.
param: string $key - LTI 1.1 OAuth Key
param: string $secret - LTI 1.1 OAuth Secret

config_to_registration(object $config, int $typeid, object $type = null)   X-Ref
Transforms a moodle LTI 1.3 Config to an OAuth/LTI Client Registration.

param: object $config Moodle LTI Config.
param: int $typeid which is the LTI deployment id.
param: object $type tool instance in case the tool already exists.
return: array the Client Registration as an associative array.

validate_registration_token(string $registrationtokenjwt)   X-Ref
Validates the registration token is properly signed and not used yet.
Return the client id to use for this registration.

param: string $registrationtokenjwt registration token
return: array with 2 keys: clientid for the registration, type but only if it's an update

lti_get_service_scopes()   X-Ref
Initializes an array with the scopes for services supported by the LTI module

return: array List of scopes

new_clientid()   X-Ref
Generates a new client id string.

return: string generated client id

sign(string $key, string $salt, string $secret)   X-Ref
Base64 encoded signature for LTI 1.1 migration.

param: string $key LTI 1.1 key
param: string $salt Salt value
param: string $secret LTI 1.1 secret
return: string base64encoded hash

get_tool_proxy(int $proxyid)   X-Ref
Returns a tool proxy

param: int $proxyid
return: mixed Tool Proxy details