MDL-67301 mod_lti: dynamic registration
[moodle.git] / mod / lti / openid-configuration.php
CommitLineData
10e16c69
CV
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
28use mod_lti\local\ltiopenid\registration_helper;
29
30define('NO_DEBUG_DISPLAY', true);
31define('NO_MOODLE_COOKIES', true);
32require_once(__DIR__ . '/../../config.php');
33require_once($CFG->dirroot . '/mod/lti/locallib.php');
34require_once($CFG->libdir.'/weblib.php');
35
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 'registration_endpoint' => (new moodle_url('/mod/lti/openid-registration.php'))->out(false),
45 'scopes_supported' => $scopes,
46 'response_types_supported' => ['id_token'],
47 'subject_types_supported' => ['public', 'pairwise'],
48 'id_token_signing_alg_values_supported' => ['RS256'],
49 'claims_supported' => ['sub', 'iss', 'name', 'given_name', 'family_name', 'email'],
50 'https://purl.imsglobal.org/spec/lti-platform-configuration ' => [
51 'product_family_code' => 'moodle',
52 'version' => $CFG->release,
53 'messages_supported' => ['LtiResourceLink', 'LtiDeepLinkingRequest'],
54 'placements' => ['AddContentMenu'],
55 'variables' => array_keys(lti_get_capabilities())
56 ]
57];
58
59@header('Content-Type: application/json; charset=utf-8');
60
61echo json_encode($conf, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);