@gridsuite/commons-ui 0.20.2 → 0.20.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -106,7 +106,6 @@ var ElementSearchDialog = function ElementSearchDialog(props) {
106
106
  return renderElement(_extends({}, optionProps, {
107
107
  element: element,
108
108
  inputValue: inputValue,
109
- setExpanded: setExpanded,
110
109
  onClose: handleClose
111
110
  }));
112
111
  },
@@ -26,6 +26,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
26
26
  * License, v. 2.0. If a copy of the MPL was not distributed with this
27
27
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
28
28
  */
29
+ // set as a global variable to allow log level configuration at runtime
30
+ window.OIDCLog = _oidcClient.Log;
29
31
  var hackauthoritykey = 'oidc.hack.authority';
30
32
  var pathKey = 'powsybl-gridsuite-current-path';
31
33
 
@@ -46,6 +48,7 @@ function initializeAuthenticationProd(dispatch, isSilentRenew, idpSettings) {
46
48
  /* hack to ignore the iss check. XXX TODO to remove */
47
49
  var regextoken = /id_token=[^&]*/;
48
50
  var regexstate = /state=[^&]*/;
51
+ var regexexpires = /expires_in=[^&]*/;
49
52
  var authority;
50
53
 
51
54
  if (window.location.hash) {
@@ -58,11 +61,26 @@ function initializeAuthenticationProd(dispatch, isSilentRenew, idpSettings) {
58
61
  var strState = localStorage.getItem('oidc.' + state);
59
62
 
60
63
  if (strState != null) {
61
- authority = (0, _jwtDecode["default"])(id_token).iss;
64
+ var decoded = (0, _jwtDecode["default"])(id_token);
65
+ authority = decoded.iss;
62
66
  var storedState = JSON.parse(strState);
67
+ console.debug('Replacing authority in storedState. Before: ', storedState.authority, 'after: ', authority);
63
68
  storedState.authority = authority;
64
69
  localStorage.setItem('oidc.' + state, JSON.stringify(storedState));
65
70
  sessionStorage.setItem(hackauthoritykey, authority);
71
+ var matched_expires = window.location.hash.match(regexexpires);
72
+
73
+ if (matched_expires != null) {
74
+ var expires_in = parseInt(matched_expires[0].split('=')[1]);
75
+ var now = parseInt(Date.now() / 1000);
76
+ var exp = decoded.exp;
77
+
78
+ if (exp < now + expires_in) {
79
+ var newhash = window.location.hash.replace(matched_expires[0], 'expires_in=' + (exp - now));
80
+ console.debug('Replacing expires_in in window.location.hash because idtoken.exp is earlier. Before: ', window.location.hash, 'after: ', newhash);
81
+ window.location.hash = newhash;
82
+ }
83
+ }
66
84
  }
67
85
  }
68
86
  }
@@ -47,7 +47,8 @@ var equipmentStyles = function equipmentStyles(theme) {
47
47
  fontStyle: 'italic'
48
48
  },
49
49
  result: {
50
- width: '100%'
50
+ width: '100%',
51
+ padding: '2px'
51
52
  }
52
53
  };
53
54
  }; // Must be equivalent as the back enum
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.20.2",
3
+ "version": "0.20.5",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "main": "lib/index.js",
6
6
  "files": [