Permalink
Browse files

*** empty log message ***

  • Loading branch information...
1 parent 2c4e3d9 commit 49465c358a77f90e11053d69414a9d2c95bebc99 exe-cutor committed Oct 31, 2005
Showing with 35 additions and 16 deletions.
  1. +2 −3 auth/shibboleth/README.txt
  2. +11 −2 auth/shibboleth/index.php
  3. +7 −9 auth/shibboleth/lib.php
  4. +15 −2 auth/shibboleth/shib-protected.php
@@ -12,6 +12,7 @@ Changes:
- 05. 2005: Various extensions and fixes by Lukas Haemmerle
- 06. 2005: Adaptions to new field locks and plugin config structures by Marting
Langhoff and Lukas Haemmerle
+- 10. 2005: Added better error messages and moved text to language directories
Moodle Configuration with Dual login
-------------------------------------------------------------------------------
@@ -151,7 +152,6 @@ Example file:
// institution, street, zipcode, city and country
$address = $_SERVER[$pluginconfig->field_map_address];
list($institution, $street, $zip_city) = split('\$', $address);
-
ereg(' (.+)',$zip_city, $regs);
$city = $regs[1];
@@ -168,8 +168,7 @@ Example file:
Bugs
--------------------------------------------------------------------------------
-The current implementation has not yet been extensively tested. So there may be
-bugs. Please send bug reports concerning the Shibboleth part to
+Please send bug reports concerning the Shibboleth part to
Lukas Haemmerle <haemmerle@switch.ch>
--------------------------------------------------------------------------------
View
@@ -12,8 +12,8 @@
// Check whether Shibboleth is configured properly
if (empty($pluginconfig->shib_user_attribute)) {
- error('Shibboleth authentication (\'shib_user_attribute\') is not set up correctly. You probably haven\'t yet configured the Shibboleth authentication. Please consult the README in moodle/auth/shibboleth for further instructions on how to set up Shibboleth authentication.');
- }
+ error(get_string( 'shib_not_set_up_error', 'auth'));
+ }
/// If we can find the Shibboleth attribute, save it in session and return to main login page
if (!empty($_SERVER[$pluginconfig->shib_user_attribute])) { // Shibboleth auto-login
@@ -50,7 +50,16 @@
redirect($urltogo);
}
+ }
+
+ // If we can find any (user independent) Shibboleth attributes but no user
+ // attributes we probably didn't receive any user attributes
+ if ( !empty($_SERVER['HTTP_SHIB_APPLICATION_ID'])
+ && empty($_SERVER[$pluginconfig->shib_user_attribute]))
+ {
+ error(get_string( 'shib_no_attributes_error', 'auth' , '\''.$pluginconfig->shib_user_attribute.'\', \''.$pluginconfig->field_map_firstname.'\', \''.$pluginconfig->field_map_lastname.'\' and \''.$pluginconfig->field_map_email.'\''));
}
+
$SESSION->shibboleth_checked = true; // This will stop us bouncing back here
View
@@ -26,7 +26,6 @@ function auth_get_userinfo($username) {
// reads user information from shibboleth attributes and return it in array()
global $CFG;
- $config = (array)$CFG;
$pluginconfig = get_config('auth/shibboleth');
// Check whether we have got all the essential attributes
@@ -36,7 +35,7 @@ function auth_get_userinfo($username) {
|| empty($_SERVER[$pluginconfig->field_map_lastname])
|| empty($_SERVER[$pluginconfig->field_map_email])
) {
- error("Moodle needs certain Shibboleth attributes which are not present in your case. The attributes are: '".$pluginconfig->shib_user_attribute."' ('".$_SERVER[$pluginconfig->shib_user_attribute]."'), '".$pluginconfig->field_map_firstname."' ('".$_SERVER[$pluginconfig->field_map_firstname]."'), '".$pluginconfig->field_map_lastname."' ('".$_SERVER[$pluginconfig->field_map_lastname]."') and '".$pluginconfig->field_map_email."' ('".$_SERVER[$pluginconfig->field_map_email]."')<br>Please contact your Identity Service Provider.");
+ error(get_string( 'shib_not_all_attributes_error', 'auth' , "'".$pluginconfig->shib_user_attribute."' ('".$_SERVER[$pluginconfig->shib_user_attribute]."'), '".$pluginconfig->field_map_firstname."' ('".$_SERVER[$pluginconfig->field_map_firstname]."'), '".$pluginconfig->field_map_lastname."' ('".$_SERVER[$pluginconfig->field_map_lastname]."') and '".$pluginconfig->field_map_email."' ('".$_SERVER[$pluginconfig->field_map_email]."')"));
}
$attrmap = auth_shib_attributes();
@@ -47,18 +46,18 @@ function auth_get_userinfo($username) {
foreach ($attrmap as $key=>$value) {
$result[$key]=utf8_decode($_SERVER[$value]);
}
-
+
// Provide an API to modify the information to fit the Moodle internal
// data representation
if (
- $config["shib_convert_data"]
- && $config["shib_convert_data"] != ''
- && is_readable($config["shib_convert_data"])
+ $pluginconfig->convert_data
+ && $pluginconfig->convert_data != ''
+ && is_readable($pluginconfig->convert_data)
){
// Include a custom file outside the Moodle dir to
// modify the variable $moodleattributes
- include($config["shib_convert_data"]);
+ include($pluginconfig->convert_data);
}
return $result;
@@ -68,7 +67,6 @@ function auth_shib_attributes(){
//returns array containg attribute mappings between Moodle and shibboleth
global $CFG;
- $config = (array)$CFG;
$pluginconfig = get_config('auth/shibboleth');
$pluginconfig = (array) $pluginconfig;
@@ -82,7 +80,7 @@ function auth_shib_attributes(){
$moodleattributes[$field] = $pluginconfig["field_map_$field"];
}
}
- $moodleattributes['username']=$config["shib_user_attribute"];
+ $moodleattributes['username']=$pluginconfig["shib_user_attribute"];
return $moodleattributes;
}
@@ -1,6 +1,19 @@
<?php
-// This file must be Shibboleth protected
-// Consult the README for further instructions
+/*
+This file must be Shibboleth protected with something like:
+
+--
+<Location ~ "/auth/shibboleth/shib-protected.php">
+ AuthType shibboleth
+ ShibRequireSession On
+ require valid-user
+</Location>
+--
+
+in your web server configuration.
+
+Consult moodle/auth/shibboleth/README.txt for further instructions.
+*/
require_once("../../config.php");
header("Location: ".$CFG->wwwroot."/auth/shibboleth/");

0 comments on commit 49465c3

Please sign in to comment.