|
@@ -5,24 +5,24 @@
|
|
|
This is the "server" of my institution/university authentification "code"
|
|
|
|
|
|
1. Active all the SSO option in your Chamilo installation: main/admin/settings.php?category=Security
|
|
|
- 2. Make sure this script is located in the index page of the server you fill in the "Domain of the Single Sign On server" Chamilo setting
|
|
|
+ 2. Make sure this script is located in the index page of the server you fill in the "Domain of the Single Sign On server" Chamilo setting
|
|
|
For example this script must be located in example.com/index.php if you set the "Domain of the Single Sign On server" = example.com
|
|
|
3. Create a user in chamilo and in your external system with login = "joe" and password = "doe"
|
|
|
4. Remember this is just a sample! Check the chamilo drupal extension for more information:
|
|
|
http://drupal.org/node/817682
|
|
|
- 5. See the main/auth/sso.class.php library for more details
|
|
|
+ 5. When activating the settings in step 1, the principal Chamilo file main/inc/local.inc.php will load the class main/auth/sso.class.php library
|
|
|
+ * that will redirect to this field with some parameters.
|
|
|
+ *
|
|
|
*/
|
|
|
|
|
|
+exit; //Uncomment this in order to execute the page
|
|
|
|
|
|
-//This page will be loaded when entering to the Chamilo site if the SSO option was set in step 1.
|
|
|
+//After you located this file in you new domain and you set the settings in step 2,
|
|
|
+//this page will be loaded when entering to the Chamilo site if the SSO option was set in step 1.
|
|
|
|
|
|
//Getting the chamilo server
|
|
|
$my_chamilo_server = filter_xss($_SERVER['HTTP_HOST']);
|
|
|
|
|
|
-//Correct user values - we asume that this user exists in both systems
|
|
|
-$correct_user = 'john';
|
|
|
-$correct_pass = 'doe';
|
|
|
-
|
|
|
$account = array();
|
|
|
|
|
|
if (isset($_SESSION['my_server_user_session'])) {
|
|
@@ -32,9 +32,16 @@ if (isset($_SESSION['my_server_user_session'])) {
|
|
|
//Login process
|
|
|
|
|
|
if (isset($_POST['user']) && isset($_POST['password'])) {
|
|
|
- if ($_POST['user'] == $correct_user && $_POST['password'] == $correct_pass) {
|
|
|
+ $validate = validate_user($_POST['user'], $_POST['password']);
|
|
|
+ //var_dump($validate);
|
|
|
+ if ($validate) {
|
|
|
|
|
|
- // You have to add here your server validations
|
|
|
+ /*
|
|
|
+ *
|
|
|
+ * You have to add here your server validations
|
|
|
+ *
|
|
|
+ *
|
|
|
+ */
|
|
|
|
|
|
$account['name'] = 'john';
|
|
|
$account['pass'] = 'doe';
|
|
@@ -70,6 +77,9 @@ if (isset($_POST['logout'])) {
|
|
|
//echo do something to logout
|
|
|
}
|
|
|
|
|
|
+function validate_user($user, $pass) {
|
|
|
+ return true;
|
|
|
+}
|
|
|
function filter_xss($val) {
|
|
|
//do some cleaning
|
|
|
return $val;
|
|
@@ -82,8 +92,8 @@ function chamilo_sso_protocol() {
|
|
|
?>
|
|
|
<html>
|
|
|
<form method="post">
|
|
|
- User <input name="user" value="<?php echo $correct_user; ?>">
|
|
|
- Pass <input name="password" value="<?php echo $correct_pass; ?>">
|
|
|
+ User <input name="user"/>
|
|
|
+ Pass <input name="password" />
|
|
|
<input type="submit" value="Login">
|
|
|
</form>
|
|
|
</html>
|