annotate app/override/RestProxy.js @ 1212:3e6756b0fc97

Fix and complement validation of Messprogramm from.
author Tom Gottfried <tom@intevation.de>
date Thu, 13 Oct 2016 14:42:26 +0200
parents f220ba587c89
children
rev   line source
920
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
1 /* Copyrighte(C) 2015 by Bundesamt fuer Strahlenschutz
608
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
3 *
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
7 */
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
8
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
9 Ext.define('Lada.override.RestProxy', {
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
10 override: 'Ext.data.proxy.Rest',
913
44d7822d0d55 Removed OpenId stuff.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 618
diff changeset
11 /*
608
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
12 buildRequest: function (operation) {
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
13 this.headers = { 'X-OPENID-PARAMS': Lada.openIDParams };
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
14 return this.callParent(arguments);
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
15 },
917
2bf35377414a Use rest response handler to act on unauthenticated request.
Raimund Renkert <rrenkert@intevation.de>
parents: 913
diff changeset
16 */
608
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
17 processResponse: function (success, operation, request, response, callback, scope) {
920
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
18 /*
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
19 SSO will send a 302 if the Client is not authenticated
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
20 unfortunately this seems to be filtered by the browser.
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
21 We assume that a 302 was send when the follwing statement
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
22 is true.
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
23 */
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
24 if (!success && response.status == 0 && response.responseText === "") {
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
25 Ext.MessageBox.confirm('Erneutes Login erforderlich',
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
26 'Ihre Session ist abgelaufen.<br/>'+
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
27 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' +
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
28 'Alle ungesicherten Daten gehen dabei verloren.<br/>' +
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
29 'Soll die Anwendung jetzt neu geladen werden?', this.reload);
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
30 }
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
31 this.callParent(arguments);
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
32 },
608
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
33
920
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
34
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
35 parseStatus: function(status) {
f220ba587c89 Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents: 917
diff changeset
36 console.log(status);
608
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
37 this.callParent(arguments);
618
fb89f61ab272 Improve error handling on authentication loss.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 608
diff changeset
38 },
917
2bf35377414a Use rest response handler to act on unauthenticated request.
Raimund Renkert <rrenkert@intevation.de>
parents: 913
diff changeset
39
618
fb89f61ab272 Improve error handling on authentication loss.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 608
diff changeset
40 reload: function(btn) {
fb89f61ab272 Improve error handling on authentication loss.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 608
diff changeset
41 if (btn === 'yes') {
fb89f61ab272 Improve error handling on authentication loss.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 608
diff changeset
42 location.reload();
fb89f61ab272 Improve error handling on authentication loss.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 608
diff changeset
43 }
608
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
44 }
7fd9350eacf9 Add client side openID authentication handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
45 });

http://lada.wald.intevation.org