disco: update simple-disco-store

This commit is contained in:
Thomas NOËL 2012-07-11 23:41:19 +02:00
parent 6f399c6407
commit f3c6826d05
5 changed files with 29 additions and 15 deletions

View File

@ -5,6 +5,7 @@
var C_RETURNIDPARAM = "returnIDParam";
var C_IS_PASSIVE = "isPassive";
var C_IDP_ENTITY_ID = "IdPentityID";
var C_STORE = "store";
var COOKIE_TIMEOUT_DAYS = 730;
$.disco_query = function (entity_id, url, response_url, callback) {
@ -17,14 +18,14 @@
}
var param = {};
param[C_ENTITY_ID] = entity_id;
param[C_RETURN] = response_url;
param[C_RETURN] = response_url + '?' + C_STORE + '=' + escape(url);
param[C_IS_PASSIVE] = 'true';
query_url = query_url + $.param(param);
debug_alert('query_url '+query_url);
iframe.attr('src', query_url);
if (callback) {
var disco_callback = function (entity_id, auth) {
callback(entity_id, auth);
var disco_callback = function (entity_id, store, auth) {
callback(entity_id, store, auth);
$(iframe).remove();
};
window.disco_callback = disco_callback;
@ -43,14 +44,14 @@
}
var param = {};
param[C_ENTITY_ID] = entity_id;
param[C_RETURN] = response_url;
param[C_RETURN] = response_url + '?' + C_STORE + '=' + escape(url);
param[C_IDP_ENTITY_ID] = idp_entity_id;
query_url = query_url + $.param(param);
debug_alert('query_url '+query_url);
iframe.attr('src', query_url);
if (callback) {
var disco_callback = function (entity_id, auth) {
callback(entity_id, auth);
var disco_callback = function (entity_id, store, auth) {
callback(entity_id, store, auth);
$(iframe).remove();
};
window.disco_callback = disco_callback;

0
virtualenv/pffedportal/media/simple-disco-store/jquery-1.7.2.min.js vendored Normal file → Executable file
View File

View File

@ -11,13 +11,15 @@
<script>
var C_ENTITY_ID = "entityID";
var C_AUTH = "auth";
var C_STORE = "store";
var qs = $.parseQuerystring();
var store = qs[C_STORE];
var auth = qs[C_AUTH];
var entity_id = qs[C_ENTITY_ID];
debug_alert(window.location.search + ' received ' + entity_id + ' + auth ' + auth);
if (entity_id && parent.disco_callback) {
parent.disco_callback(entity_id, auth);
parent.disco_callback(entity_id, store, auth);
}
</script>
</body>

View File

@ -9,12 +9,18 @@
<body>
<script>
function query() {
$.disco_query("coucou", "./store.html", "./response.html", function (entity_id, auth) {
alert("idp is " + entity_id); });
$.disco_query("coucou", "./store.html", "./response.html",
function (entity_id, store, auth) {
alert("idp is " + entity_id + " said " + store);
}
);
}
function set() {
$.disco_set("coucou", $('#idp').val(), "./store.html", "./response.html", function (entity_id, auth) {
alert("idp has been set to " + entity_id); });
$.disco_set("coucou", $('#idp').val(), "./store.html", "./response.html",
function (entity_id, store, auth) {
alert("idp has been set to " + entity_id + " on " + store);
}
);
}
</script>
<div>

View File

@ -57,9 +57,14 @@ Choisissez votre établissement&nbsp;:<br /><br />
"https://{{https_hostname}}/authsaml2/metadata",
"https://{{https_hostname}}{{ MEDIA_URL }}simple-disco-store/store.html",
"https://{{https_hostname}}{{ MEDIA_URL }}simple-disco-store/response.html",
function (entity_id, auth) {
function (entity_id, store, auth) {
$('a#default-idp').text("entity_id : " + entity_id);
alert("query " + entity_id);
$('a#default-idp').attr({
href: "/sso?entity_id=" + entity_id,
title: "Entity ID = " + entity_id,
style: "",
});
alert("query: receive " + entity_id + " from " + store);
});
}
@ -69,8 +74,8 @@ Choisissez votre établissement&nbsp;:<br /><br />
idp_entity_id,
"https://{{https_hostname}}{{ MEDIA_URL }}simple-disco-store/store.html",
"https://{{https_hostname}}{{ MEDIA_URL }}simple-disco-store/response.html",
function (entity_id, auth) {
// alert("set " + entity_id);
function (entity_id, store, auth) {
alert("set: store " + entity_id + " on " + store);
});
}