Merge branch 'MDL-70074-add-authendpoint-310' of https://github.com/cengage/moodle...
[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),
60232d2b 44 'authorization_endpoint' => (new moodle_url('/mod/lti/auth.php'))->out(false),
10e16c69
CV
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'],
60232d2b 51 'https://purl.imsglobal.org/spec/lti-platform-configuration' => [
10e16c69
CV
52 'product_family_code' => 'moodle',
53 'version' => $CFG->release,
54 'messages_supported' => ['LtiResourceLink', 'LtiDeepLinkingRequest'],
55 'placements' => ['AddContentMenu'],
56 'variables' => array_keys(lti_get_capabilities())
57 ]
58];
59
60@header('Content-Type: application/json; charset=utf-8');
61
62echo json_encode($conf, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);