2004-11-08 15:08:19 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
//CHANGELOG:
|
|
|
|
//28.10.2004 SHIBBOLETH Authentication functions v.0.1
|
|
|
|
//Distributed under GPL (c)Markus Hagman 2004-
|
|
|
|
|
|
|
|
function auth_user_login ($username, $password) {
|
|
|
|
global $CFG;
|
|
|
|
|
2005-04-17 12:39:02 +00:00
|
|
|
// We can only get here if shibboleth has found the
|
|
|
|
// correct server parameters (see login.php)
|
|
|
|
// Se we can always return true
|
|
|
|
|
|
|
|
return true;
|
2004-11-08 15:08:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function auth_get_userinfo($username) {
|
|
|
|
// reads user information from shibboleth attributes and return it in array()
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$config = (array)$CFG;
|
|
|
|
$attrmap = auth_shib_attributes();
|
|
|
|
|
|
|
|
$result = array();
|
|
|
|
$search_attribs = array();
|
|
|
|
|
|
|
|
foreach ($attrmap as $key=>$value) {
|
2005-04-17 12:08:46 +00:00
|
|
|
$result[$key]=utf8_decode($_SERVER[$value]);
|
2004-11-08 15:08:19 +00:00
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
function auth_shib_attributes (){
|
|
|
|
//returns array containg attribute mappings between Moodle and shibboleth
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$config = (array)$CFG;
|
|
|
|
$fields = array("firstname", "lastname", "email", "phone1", "phone2",
|
|
|
|
"department", "address", "city", "country", "description",
|
|
|
|
"idnumber", "lang", "guid");
|
|
|
|
|
|
|
|
$moodleattributes = array();
|
|
|
|
foreach ($fields as $field) {
|
2005-04-17 12:08:46 +00:00
|
|
|
if ($config["auth_shib_user_$field"]) {
|
|
|
|
$moodleattributes[$field] = $config["auth_shib_user_$field"];
|
2004-11-08 15:08:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$moodleattributes['username']=$config["shib_user_attribute"];
|
|
|
|
return $moodleattributes;
|
|
|
|
}
|
|
|
|
?>
|