Skip to content
Snippets Groups Projects
Commit 014e8f24 authored by Jaime Perez's avatar Jaime Perez
Browse files

Removing discojuice from 1.13 branch.

parent 29c6d55f
No related branches found
No related tags found
No related merge requests found
<?php
/**
* This is the configuration file for the DiscoJuice.
*/
$config = array(
// A human readable name describing the Service Provider
'name' => 'Service',
/* A set of prepared metadata feeds from discojuice.org
* You may visit
* https://static.discojuice.org/feeds/
*
* to review the available feed identifiers.
* You may choose to not use any of the provider feed, by setting this to an
* empty array: array()
*/
'feeds' => array('edugain'),
/*
* You may provide additional feeds
*/
'additionalFeeds' => array(
),
/*
* If you set this value to true, the module will contact discojuice.org to read and write cookies.
* If you enable this, you will also need to get your host accepted in the access control list of
* discojuice.org
*
* The response URL of your service, similar to:
*
* https://sp.example.org/simplesaml/module.php/discojuice/response.html
*
* will need to be registered at discojuice.org. If your response URL is already registered in the metadata
* of one of the federation feeds at discojuice.org, you should already have access.
*/
'enableCentralStorage' => false,
);
\ No newline at end of file
<?php
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Select Your Login Provider</title>
<!-- JQuery hosted by Google -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<!-- DiscoJuice hosted by UNINETT at discojuice.org -->
<script type="text/javascript" src="https://engine.discojuice.org/discojuice-stable.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://static.discojuice.org/css/discojuice.css" />
<style type="text/css">
body {
text-align: center;
}
div.discojuice {
text-align: left;
position: relative;
width: 600px;
margin-right: auto;
margin-left: auto;
}
</style>
<script type="text/javascript">
<?php
echo '
$("document").ready(function() {
var djc = DiscoJuice.Hosted.getConfig(' .
json_encode($this->data['hostedConfig'][0]) . "," .
json_encode($this->data['hostedConfig'][1]) . "," .
json_encode($this->data['hostedConfig'][2]) . "," .
json_encode($this->data['hostedConfig'][3]) . "," .
json_encode($this->data['hostedConfig'][4]) .
');';
// echo " djc.country = false;\n";
// echo " djc.showLocationInfo = false;\n";
if (!$this->data['enableCentralStorage']) {
echo " delete djc.disco;\n";
}
if (!empty($this->data['additionalFeeds'])) {
foreach($this->data['additionalFeeds'] AS $feed) {
echo " djc.metadata.push(" . json_encode($feed) . ");\n";
}
}
echo " djc.always = true;\n";
echo '
$("a.signin").DiscoJuice(djc);
});
';
?>
</script>
</head>
<body style="background: #ccc">
<p style="display: none; text-align: right"><a class="signin" href="/">signin</a></p>
</body>
</html>
<?php
if (empty($_REQUEST['entityID'])) throw new Exception('Missing parameter [entityID]');
if (empty($_REQUEST['return'])) throw new Exception('Missing parameter [return]');
$djconfig = SimpleSAML_Configuration::getOptionalConfig('discojuice.php');
$config = SimpleSAML_Configuration::getInstance();
// EntityID
$entityid = $_REQUEST['entityID'];
// Return to...
$returnidparam = !empty($_REQUEST['returnIDParam']) ? $_REQUEST['returnIDParam'] : 'entityID';
$href = SimpleSAML_Utilities::addURLparameter(
$_REQUEST['return'],
array($returnidparam => '')
);
$hostedConfig = array(
// Name of service
$djconfig->getString('name', 'Service'),
$entityid,
// Url to response
SimpleSAML_Module::getModuleURL('discojuice/response.html'),
// Set of feeds to subscribe to.
$djconfig->getArray('feeds', array('edugain')),
$href
);
/*
"a.signin", "Teest Demooo",
"https://example.org/saml2/entityid",
"' . SimpleSAML_Module::getModuleURL('discojuice/discojuice/discojuiceDiscoveryResponse.html') . '", ["kalmar"], "http://example.org/login?idp="
*/
$t = new SimpleSAML_XHTML_Template($config, 'discojuice:central.tpl.php');
$t->data['hostedConfig'] = $hostedConfig;
$t->data['enableCentralStorage'] = $djconfig->getBoolean('enableCentralStorage', true);
$t->data['additionalFeeds'] = $djconfig->getArray('additionalFeeds', null);
$t->show();
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<title>IdP Discovery Response Receiver</title>
<script type="text/javascript">
function parseURL(url) {
var a = document.createElement('a');
a.href = url;
return a.hostname;
}
function receive() {
var urlParams = {},
cid = null;
(function () {
var e,
a = /\+/g, // Regex for replacing addition symbol with a space
r = /([^&;=]+)=?([^&;]*)/g,
d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
q = window.location.search.substring(1);
while (e = r.exec(q))
urlParams[d(e[1])] = d(e[2]);
})();
if (urlParams.cid) cid = urlParams.cid;
var sender = parseURL(document.referrer);
// Received a specific entity ID from the storage.
if (urlParams.entityID) {
window.parent.DiscoJuice.Utils.log('ResponseLocation: Response from discovery service [' + sender + ']: ' + urlParams.entityID + ' subID: ' + urlParams.subID);
window.parent.DiscoJuice.Control.discoResponse(sender, urlParams.entityID, urlParams.subID, cid);
// Received a textual error from the storage, to show in the debug log.
} else if (urlParams['error']) {
window.parent.DiscoJuice.Control.discoResponseError(cid,
"Error from IdP Discovery Service [" + sender + "]: " + urlParams.error);
// Did not receive a response parameter. This probably means that the Disco storage did not have a stored preference
// for the user. Consequently: no error.
} else {
window.parent.DiscoJuice.Utils.log('No valid response parameters. cid[' + cid + ']');
window.parent.DiscoJuice.Control.discoResponseError(cid);
}
}
</script>
</head>
<body onload="receive();">
</body>
</html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment