mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
Merge branch 'MDL-60435_master' of git://github.com/markn86/moodle
This commit is contained in:
commit
af0671c218
4 changed files with 97 additions and 0 deletions
|
@ -277,6 +277,32 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of identity providers to display on the login page.
|
||||
*
|
||||
* @param string $wantsurl The requested URL.
|
||||
* @return array List of arrays with keys url, iconurl and name.
|
||||
*/
|
||||
public function loginpage_idp_list($wantsurl) {
|
||||
$config = get_config('auth_shibboleth');
|
||||
$result = [];
|
||||
|
||||
// Before displaying the button check that Shibboleth is set-up correctly.
|
||||
if (empty($config->user_attribute)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$url = new moodle_url('/auth/shibboleth/index.php');
|
||||
$iconurl = moodle_url::make_pluginfile_url(context_system::instance()->id,
|
||||
'auth_shibboleth',
|
||||
'logo',
|
||||
null,
|
||||
'/',
|
||||
$config->auth_logo);
|
||||
$result[] = ['url' => $url, 'iconurl' => $iconurl, 'name' => $config->login_name];
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
$string['auth_shib_auth_method'] = 'Authentication method name';
|
||||
$string['auth_shib_auth_method_description'] = 'Provide a name for the Shibboleth authentication method that is familiar to your users. This could be the name of your Shibboleth federation, e.g. <tt>SWITCHaai Login</tt> or <tt>InCommon Login</tt> or similar.';
|
||||
$string['auth_shib_auth_logo'] = 'Authentication method logo';
|
||||
$string['auth_shib_auth_logo_description'] = 'Provide a logo for the Shibboleth authentication method that is familiar to your users. This could be the logo of your Shibboleth federation, e.g. <tt>SWITCHaai Login</tt> or <tt>InCommon Login</tt> or similar.';
|
||||
$string['auth_shib_contact_administrator'] = 'In case you are not associated with the given organizations and you need access to a course on this server, please contact the <a href="mailto:{$a}">Moodle Administrator</a>.';
|
||||
$string['auth_shibbolethdescription'] = 'Using this method users are created and authenticated using <a href="http://shibboleth.internet2.edu/">Shibboleth</a>.<br />Be sure to read the <a href="../auth/shibboleth/README.txt">README</a> for Shibboleth on how to set up your Moodle with Shibboleth';
|
||||
$string['auth_shibboleth_errormsg'] = 'Please select the organization you are member of!';
|
||||
|
|
64
auth/shibboleth/lib.php
Normal file
64
auth/shibboleth/lib.php
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* This file contains the hooks for the Shibboleth authentication module.
|
||||
*
|
||||
* @package auth_shibboleth
|
||||
* @copyright 2018 Fabrice Ménard
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
/**
|
||||
* Serves the logo file settings.
|
||||
*
|
||||
* @param stdClass $course course object
|
||||
* @param stdClass $cm course module object
|
||||
* @param stdClass $context context object
|
||||
* @param string $filearea file area
|
||||
* @param array $args extra arguments
|
||||
* @param bool $forcedownload whether or not force download
|
||||
* @param array $options additional options affecting the file serving
|
||||
* @return bool false if file not found, does not return if found - justsend the file
|
||||
*/
|
||||
function auth_shibboleth_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) {
|
||||
if ($context->contextlevel != CONTEXT_SYSTEM) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filearea !== 'logo' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$itemid = 0;
|
||||
|
||||
$filename = array_pop($args);
|
||||
if (!$args) {
|
||||
$filepath = '/';
|
||||
} else {
|
||||
$filepath = '/'.implode('/', $args).'/';
|
||||
}
|
||||
|
||||
$fs = get_file_storage();
|
||||
$file = $fs->get_file($context->id, 'auth_shibboleth', $filearea, $itemid, $filepath, $filename);
|
||||
if (!$file) {
|
||||
return false;
|
||||
}
|
||||
|
||||
send_stored_file($file, null, 0, $forcedownload, $options);
|
||||
}
|
|
@ -63,6 +63,11 @@ if ($ADMIN->fulltree) {
|
|||
get_string('auth_shib_auth_method', 'auth_shibboleth'),
|
||||
get_string('auth_shib_auth_method_description', 'auth_shibboleth'), 'Shibboleth Login', PARAM_RAW_TRIMMED));
|
||||
|
||||
// Authentication method logo.
|
||||
$settings->add(new admin_setting_configstoredfile('auth_shibboleth/auth_logo',
|
||||
get_string('auth_shib_auth_logo', 'auth_shibboleth'),
|
||||
get_string('auth_shib_auth_logo_description', 'auth_shibboleth'), 'logo', 0, ['accepted_types' => ['image']]));
|
||||
|
||||
// Login directions.
|
||||
$settings->add(new admin_setting_configtextarea('auth_shibboleth/auth_instructions',
|
||||
get_string('auth_shib_instructions_key', 'auth_shibboleth'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue