Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

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: 354 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

registration_helper:: (5 methods):
  get_parameter()
  registration_to_config()
  config_to_registration()
  validate_registration_token()
  lti_get_service_scopes()


Class: registration_helper  - X-Ref

This class exposes functions for LTI Dynamic Registration.

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.

config_to_registration(object $config, int $typeid)   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.
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: string client id for the registration

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

return: array List of scopes