From 1bfcf07131807c6a25e6beed7f8e6dea610edfc5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Thu, 27 Aug 2009 12:39:01 +0000
Subject: [PATCH] add hobbit configuration

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1718 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/ldapstatus/www/hobbit.php | 78 +++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 modules/ldapstatus/www/hobbit.php

diff --git a/modules/ldapstatus/www/hobbit.php b/modules/ldapstatus/www/hobbit.php
new file mode 100644
index 000000000..c4f058b51
--- /dev/null
+++ b/modules/ldapstatus/www/hobbit.php
@@ -0,0 +1,78 @@
+<?php
+
+
+$config = SimpleSAML_Configuration::getInstance();
+$session = SimpleSAML_Session::getInstance();
+
+$authTokenContactsSP = sha1('feide:contacts-sp|' . $config->getValue('secret'));
+
+
+if (isset($_REQUEST['getToken'])) {
+	SimpleSAML_Utilities::requireAdmin();
+	echo $authTokenContactsSP; exit;
+}
+
+
+
+
+if (!array_key_exists('token', $_REQUEST)) {
+	throw new SimpleSAML_Error_BadRequest('Missing authToken.');
+}
+
+$token = $_REQUEST['token'];
+
+if ($token !== $authTokenContactsSP) {
+	throw new SimpleSAML_Error_Exception('Invalid AuthToken');
+}
+
+
+
+
+$ldapconfig = SimpleSAML_Configuration::getConfig('config-login-feide.php');
+$ldapStatusConfig = SimpleSAML_Configuration::getConfig('module_ldapstatus.php');
+
+$debug = $ldapconfig->getValue('ldapDebug', FALSE);
+$orgs = $ldapconfig->getValue('organizations');
+$locationTemplate = $ldapconfig->getValue('locationTemplate');
+
+
+$isAdmin = FALSE;
+$secretURL = NULL;
+
+$ignore = '';
+if (array_key_exists('ignore', $_REQUEST)) $ignore = '&ignore=' . $_REQUEST['ignore'];
+
+
+$secretKey = sha1('ldapstatus|' . $config->getValue('secret') . '|hobbit');
+$secretURL = SimpleSAML_Utilities::addURLparameter(
+	SimpleSAML_Utilities::selfURLNoQuery(), array(
+		'key' => $secretKey,
+	)
+);
+
+function generateSecret($salt, $orgtest) {
+	$secretKey = sha1('ldapstatus|' . $salt . '|' . $orgtest);
+	return $secretKey;
+}
+
+
+
+echo('<pre>');
+
+
+
+foreach($orgs AS $orgkey => $org) {
+	
+	$url = SimpleSAML_Utilities::addURLparameter(
+		SimpleSAML_Utilities::selfURLhost() . SimpleSAML_Utilities::getFirstPathElement() . '/module.php/ldapstatus/', array(
+			'orgtest' => $orgkey,
+			'output' => 'text',
+			'key' => generateSecret($config->getValue('secret'), $orgkey)
+		)
+	);
+	
+	echo("0.0.0.0 " . $orgkey . " # noconn  cont=sl;" . $url . $ignore . ";OOOKKK\n");
+	
+}
+
+
-- 
GitLab