@gridsuite/commons-ui 0.40.0 → 0.41.0
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.
- package/es/utils/AuthService.js +10 -5
- package/package.json +1 -1
package/es/utils/AuthService.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
/**
|
|
2
3
|
* Copyright (c) 2020, RTE (http://www.rte-france.com)
|
|
3
4
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -38,7 +39,7 @@ function initializeAuthenticationDev(dispatch, isSilentRenew, validateUser) {
|
|
|
38
39
|
}
|
|
39
40
|
var accessTokenExpiringNotificationTime = 60; // seconds
|
|
40
41
|
|
|
41
|
-
function initializeAuthenticationProd(dispatch, isSilentRenew, idpSettings, validateUser) {
|
|
42
|
+
function initializeAuthenticationProd(dispatch, isSilentRenew, idpSettings, validateUser, authorizationCodeFlowEnabled) {
|
|
42
43
|
return idpSettings.then(function (r) {
|
|
43
44
|
return r.json();
|
|
44
45
|
}).then(function (idpSettings) {
|
|
@@ -88,18 +89,22 @@ function initializeAuthenticationProd(dispatch, isSilentRenew, idpSettings, vali
|
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
authority = authority || sessionStorage.getItem(hackauthoritykey) || idpSettings.authority;
|
|
91
|
-
var
|
|
92
|
+
var responseSettings = authorizationCodeFlowEnabled ? {
|
|
93
|
+
response_type: 'code'
|
|
94
|
+
} : {
|
|
95
|
+
response_type: 'id_token token',
|
|
96
|
+
response_mode: 'fragment'
|
|
97
|
+
};
|
|
98
|
+
var settings = _extends({
|
|
92
99
|
authority: authority,
|
|
93
100
|
client_id: idpSettings.client_id,
|
|
94
101
|
redirect_uri: idpSettings.redirect_uri,
|
|
95
102
|
post_logout_redirect_uri: idpSettings.post_logout_redirect_uri,
|
|
96
103
|
silent_redirect_uri: idpSettings.silent_redirect_uri,
|
|
97
|
-
response_mode: 'fragment',
|
|
98
|
-
response_type: 'id_token token',
|
|
99
104
|
scope: idpSettings.scope,
|
|
100
105
|
automaticSilentRenew: !isSilentRenew,
|
|
101
106
|
accessTokenExpiringNotificationTime: accessTokenExpiringNotificationTime
|
|
102
|
-
};
|
|
107
|
+
}, responseSettings);
|
|
103
108
|
var userManager = new UserManager(settings);
|
|
104
109
|
userManager.idpSettings = idpSettings; //store our settings in there as well to use it later
|
|
105
110
|
if (!isSilentRenew) {
|