@axa-fr/react-oidc 6.0.0-beta3 → 6.0.0-beta4

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.
@@ -80,11 +80,16 @@ const getCurrentDatabaseDomain = (database, url) => {
80
80
  }
81
81
  for (const [key, currentDatabase] of Object.entries(database)) {
82
82
  const oidcServerConfiguration = currentDatabase.oidcServerConfiguration;
83
- if(url === oidcServerConfiguration.tokenEndpoint){
83
+
84
+ if(!oidcServerConfiguration){
85
+ continue;
86
+ }
87
+
88
+ if(oidcServerConfiguration.tokenEndpoint && url === oidcServerConfiguration.tokenEndpoint){
84
89
  continue;
85
90
  }
86
91
 
87
- const domainsToSendTokens = oidcServerConfiguration != null ? [
92
+ const domainsToSendTokens = oidcServerConfiguration.userInfoEndpoint ? [
88
93
  oidcServerConfiguration.userInfoEndpoint, ...trustedDomains[key]
89
94
  ] : [...trustedDomains[key]];
90
95
 
@@ -235,6 +240,11 @@ self.addEventListener('fetch', handleFetch);
235
240
 
236
241
 
237
242
  const checkDomain =(domains, tokenEndpoint) => {
243
+
244
+ if(!tokenEndpoint){
245
+ return;
246
+ }
247
+
238
248
  const domain = domains.find(domain => tokenEndpoint.startsWith(domain));
239
249
  if(!domain){
240
250
  throw new Error("Domain " + tokenEndpoint+ " is not trusted, please add domain in TrustedDomains.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/react-oidc",
3
- "version": "6.0.0-beta3",
3
+ "version": "6.0.0-beta4",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "jsnext:main": "dist/index.js",
@@ -80,11 +80,16 @@ const getCurrentDatabaseDomain = (database, url) => {
80
80
  }
81
81
  for (const [key, currentDatabase] of Object.entries(database)) {
82
82
  const oidcServerConfiguration = currentDatabase.oidcServerConfiguration;
83
- if(url === oidcServerConfiguration.tokenEndpoint){
83
+
84
+ if(!oidcServerConfiguration){
85
+ continue;
86
+ }
87
+
88
+ if(oidcServerConfiguration.tokenEndpoint && url === oidcServerConfiguration.tokenEndpoint){
84
89
  continue;
85
90
  }
86
91
 
87
- const domainsToSendTokens = oidcServerConfiguration != null ? [
92
+ const domainsToSendTokens = oidcServerConfiguration.userInfoEndpoint ? [
88
93
  oidcServerConfiguration.userInfoEndpoint, ...trustedDomains[key]
89
94
  ] : [...trustedDomains[key]];
90
95
 
@@ -235,6 +240,11 @@ self.addEventListener('fetch', handleFetch);
235
240
 
236
241
 
237
242
  const checkDomain =(domains, tokenEndpoint) => {
243
+
244
+ if(!tokenEndpoint){
245
+ return;
246
+ }
247
+
238
248
  const domain = domains.find(domain => tokenEndpoint.startsWith(domain));
239
249
  if(!domain){
240
250
  throw new Error("Domain " + tokenEndpoint+ " is not trusted, please add domain in TrustedDomains.js");