From 624dc86a4da373d2b2e38b2554329cbf05d91ccc Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 8 Nov 2004 15:08:19 +0000 Subject: [PATCH] Very early version of Shibboleth plugin, looking for feedback --- auth/shibboleth/README.txt | 1 + auth/shibboleth/config.html | 134 ++++++++++++++++++++++++++++++++++++ auth/shibboleth/lib.php | 60 ++++++++++++++++ 3 files changed, 195 insertions(+) create mode 100644 auth/shibboleth/README.txt create mode 100755 auth/shibboleth/config.html create mode 100755 auth/shibboleth/lib.php diff --git a/auth/shibboleth/README.txt b/auth/shibboleth/README.txt new file mode 100644 index 0000000000..91d2ed7ca6 --- /dev/null +++ b/auth/shibboleth/README.txt @@ -0,0 +1 @@ +Under development diff --git a/auth/shibboleth/config.html b/auth/shibboleth/config.html new file mode 100755 index 0000000000..7292a57e09 --- /dev/null +++ b/auth/shibboleth/config.html @@ -0,0 +1,134 @@ + + +

Shibboleth WAYF url: + + + + + + + + +

Shibboleth logout url: + + + + + + +

: + + + + + + + + +

: + + + + + + + +

: + + + + + + +

: + + + + + + +

1: + + + + + + +

2: + + + + + + +

: + + + + + + +

: + + + + + + +

: + + + + + + +

: + + + + + + +

: + + + + + + +

: + + + + + + +

: + + + + + + +

: + + + + + + + +

: + + + + + + + + + + + + diff --git a/auth/shibboleth/lib.php b/auth/shibboleth/lib.php new file mode 100755 index 0000000000..4024a0d59f --- /dev/null +++ b/auth/shibboleth/lib.php @@ -0,0 +1,60 @@ +shib_user_attribute] == $username) { + return true; + } + // Returns false if the username doesn't exist yet + // Returns true if the username and password work + if ($user = get_user_info_from_db("username", $username)) { + if($user->auth == "shibboleth") { + return false; + exit; + } else { + return ($user->password == md5($password)); + exit; + } + } + + return false; +} + +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) { + $result[$key]=$_SERVER[$value]; + } + 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) { + if ($config["auth_user_$field"]) { + $moodleattributes[$field] = $config["auth_user_$field"]; + } + } + $moodleattributes['username']=$config["shib_user_attribute"]; + return $moodleattributes; +} +?> -- 2.39.5