MDL-70424 auth: Avoid random changes to $CFG->auth
[moodle.git] / mod / lti / openid-configuration.php
blob7d616c39eec7312ecaadc00556b2de7bc5c15c83
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.
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/>.
17 /**
18 * This file returns the OpenId/LTI Configuration for this site.
20 * It is part of the LTI Tool Dynamic Registration, and used by
21 * tools to get the site configuration and registration end-point.
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
28 use mod_lti\local\ltiopenid\registration_helper;
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');
36 $scopes = registration_helper::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' => ['LtiResourceLinkRequest', 'LtiDeepLinkingRequest'],
55 'placements' => ['AddContentMenu'],
56 'variables' => array_keys(lti_get_capabilities())
60 @header('Content-Type: application/json; charset=utf-8');
62 echo json_encode($conf, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);