add a store parameter to response.html and to callbacks, in order to notify which store responded when launching many requests

This commit is contained in:
Benjamin Dauvergne 2012-07-11 16:42:09 +02:00
parent 5c9354ed56
commit 70826f489a
3 changed files with 20 additions and 11 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;

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>