comparison app/override/RestProxy.js @ 920:f220ba587c89

Adopted Client to SSO, detect a Sessiontimeout and reload the application
author Dustin Demuth <dustin@intevation.de>
date Fri, 14 Aug 2015 13:27:50 +0200
parents 2bf35377414a
children
comparison
equal deleted inserted replaced
919:c8599a543f03 920:f220ba587c89
1 /* Copyright (C) 2015 by Bundesamt fuer Strahlenschutz 1 /* Copyrighte(C) 2015 by Bundesamt fuer Strahlenschutz
2 * Software engineering by Intevation GmbH 2 * Software engineering by Intevation GmbH
3 * 3 *
4 * This file is Free Software under the GNU GPL (v>=3) 4 * This file is Free Software under the GNU GPL (v>=3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out 5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details. 6 * the documentation coming with IMIS-Labordaten-Application for details.
13 this.headers = { 'X-OPENID-PARAMS': Lada.openIDParams }; 13 this.headers = { 'X-OPENID-PARAMS': Lada.openIDParams };
14 return this.callParent(arguments); 14 return this.callParent(arguments);
15 }, 15 },
16 */ 16 */
17 processResponse: function (success, operation, request, response, callback, scope) { 17 processResponse: function (success, operation, request, response, callback, scope) {
18 /* Check if we were authenticated at one point (Lada.openIDParams) and 18 /*
19 * if the response means that we lost that authentcation */ 19 SSO will send a 302 if the Client is not authenticated
20 if (!success && response.status == 401) { 20 unfortunately this seems to be filtered by the browser.
21 var json = Ext.decode(response.responseText); 21 We assume that a 302 was send when the follwing statement
22 if (json) { 22 is true.
23 if (json.message === "699" || json.message === "698") { 23 */
24 /* This is the unauthorized message with the authentication 24 if (!success && response.status == 0 && response.responseText === "") {
25 * redirect in the data */ 25 Ext.MessageBox.confirm('Erneutes Login erforderlich',
26 'Ihre Session ist abgelaufen.<br/>'+
27 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' +
28 'Alle ungesicherten Daten gehen dabei verloren.<br/>' +
29 'Soll die Anwendung jetzt neu geladen werden?', this.reload);
30 }
31 this.callParent(arguments);
32 },
26 33
27 /* We decided to handle this with a redirect to the identity 34
28 * provider. In which case we have no other option then to 35 parseStatus: function(status) {
29 * handle it here with relaunch. */ 36 console.log(status);
30 Ext.MessageBox.confirm('Erneutes Login erforderlich',
31 'Ihre Session ist abgelaufen.<br/>'+
32 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' +
33 'Alle ungesicherten Daten gehen dabei verloren.<br/>' +
34 'Soll die Anwendung jetzt neu geladen werden?', this.reload);
35 }
36 }
37 }
38 this.callParent(arguments); 37 this.callParent(arguments);
39 }, 38 },
40 39
41 reload: function(btn) { 40 reload: function(btn) {
42 if (btn === 'yes') { 41 if (btn === 'yes') {

http://lada.wald.intevation.org