Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311]

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * This file returns the OpenId/LTI Configuration for this site.
  19   *
  20   * It is part of the LTI Tool Dynamic Registration, and used by
  21   * tools to get the site configuration and registration end-point.
  22   *
  23   * @package    mod_lti
  24   * @copyright  2020 Claude Vervoort (Cengage), Carlos Costa, Adrian Hutchinson (Macgraw Hill)
  25   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  26   */
  27  
  28  use mod_lti\local\ltiopenid\registration_helper;
  29  
  30  define('NO_DEBUG_DISPLAY', true);
  31  define('NO_MOODLE_COOKIES', true);
  32  require_once(__DIR__ . '/../../config.php');
  33  require_once($CFG->dirroot . '/mod/lti/locallib.php');
  34  require_once($CFG->libdir.'/weblib.php');
  35  
  36  $scopes = registration_helper::get()->lti_get_service_scopes();
  37  $scopes[] = 'openid';
  38  $conf = [
  39      'issuer' => $CFG->wwwroot,
  40      'token_endpoint' => (new moodle_url('/mod/lti/token.php'))->out(false),
  41      'token_endpoint_auth_methods_supported' => ['private_key_jwt'],
  42      'token_endpoint_auth_signing_alg_values_supported' => ['RS256'],
  43      'jwks_uri' => (new moodle_url('/mod/lti/certs.php'))->out(false),
  44      'authorization_endpoint' => (new moodle_url('/mod/lti/auth.php'))->out(false),
  45      'registration_endpoint' => (new moodle_url('/mod/lti/openid-registration.php'))->out(false),
  46      'scopes_supported' => $scopes,
  47      'response_types_supported' => ['id_token'],
  48      'subject_types_supported' => ['public', 'pairwise'],
  49      'id_token_signing_alg_values_supported' => ['RS256'],
  50      'claims_supported' => ['sub', 'iss', 'name', 'given_name', 'family_name', 'email'],
  51      'https://purl.imsglobal.org/spec/lti-platform-configuration' => [
  52          'product_family_code' => 'moodle',
  53          'version' => $CFG->release,
  54          'messages_supported' => [['type' => 'LtiResourceLinkRequest'],
  55              ['type' => 'LtiDeepLinkingRequest', 'placements' => ['ContentArea']]],
  56          'variables' => array_keys(lti_get_capabilities())
  57      ]
  58  ];
  59  
  60  @header('Content-Type: application/json; charset=utf-8');
  61  
  62  echo json_encode($conf, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);