Mercurial > lada > lada-client
comparison app/override/RestProxy.js @ 608:7fd9350eacf9 openid
Add client side openID authentication handling
If the client is not authenticated it will be redirected
to the identity provider provided by the lada-server in the
error message. The lada-server keeps track of the association
and verifies the openID parameters sent by the client
in the X-OPENID-PARAMS header
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 12 Mar 2015 17:39:16 +0100 |
parents | |
children | fb89f61ab272 |
comparison
equal
deleted
inserted
replaced
607:80077aeaa9ed | 608:7fd9350eacf9 |
---|---|
1 /* Copyright (C) 2015 by Bundesamt fuer Strahlenschutz | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out | |
6 * the documentation coming with IMIS-Labordaten-Application for details. | |
7 */ | |
8 | |
9 Ext.define('Lada.override.RestProxy', { | |
10 override: 'Ext.data.proxy.Rest', | |
11 | |
12 buildRequest: function (operation) { | |
13 this.headers = { 'X-OPENID-PARAMS': Lada.openIDParams }; | |
14 return this.callParent(arguments); | |
15 }, | |
16 | |
17 processResponse: function (success, operation, request, response, callback, scope) { | |
18 if (!success && response.status == 401) { | |
19 var json = Ext.decode(response.responseText); | |
20 if (json) { | |
21 if (json.message == "699") { | |
22 /* This is the unauthorized message with the authentication | |
23 * redirect in the data */ | |
24 | |
25 /* We decided to handle this with a redirect to the identity | |
26 * provider. In which case we have no other option then to | |
27 * handle it here with relaunch. */ | |
28 Lada.launch(); // Data loss! | |
29 } | |
30 } | |
31 } | |
32 this.callParent(arguments); | |
33 } | |
34 }); |