@asgardeo/javascript 0.17.0 → 0.18.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/dist/cjs/index.js +12 -7
- package/dist/cjs/index.js.map +2 -2
- package/dist/index.js +12 -7
- package/dist/index.js.map +2 -2
- package/dist/utils/processOpenIDScopes.d.ts +7 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -355,11 +355,14 @@ Message: ${this.message}`;
|
|
|
355
355
|
// src/utils/processOpenIDScopes.ts
|
|
356
356
|
var processOpenIDScopes = (scopes) => {
|
|
357
357
|
let processedScopes = [];
|
|
358
|
-
|
|
358
|
+
let userConfiguredScopes = false;
|
|
359
|
+
if (scopes !== void 0 && scopes !== null) {
|
|
359
360
|
if (Array.isArray(scopes)) {
|
|
360
361
|
processedScopes = scopes;
|
|
362
|
+
userConfiguredScopes = scopes.length > 0;
|
|
361
363
|
} else if (typeof scopes === "string") {
|
|
362
|
-
processedScopes = scopes.split(" ");
|
|
364
|
+
processedScopes = scopes ? scopes.split(" ") : [];
|
|
365
|
+
userConfiguredScopes = scopes.length > 0;
|
|
363
366
|
} else {
|
|
364
367
|
throw new AsgardeoRuntimeError(
|
|
365
368
|
"Scopes must be a string or an array of strings.",
|
|
@@ -369,11 +372,13 @@ var processOpenIDScopes = (scopes) => {
|
|
|
369
372
|
);
|
|
370
373
|
}
|
|
371
374
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
processedScopes.
|
|
375
|
-
|
|
376
|
-
|
|
375
|
+
if (!userConfiguredScopes) {
|
|
376
|
+
OIDCRequestConstants_default.SignIn.Payload.DEFAULT_SCOPES.forEach((defaultScope) => {
|
|
377
|
+
if (!processedScopes.includes(defaultScope)) {
|
|
378
|
+
processedScopes.push(defaultScope);
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
}
|
|
377
382
|
return processedScopes.join(" ");
|
|
378
383
|
};
|
|
379
384
|
var processOpenIDScopes_default = processOpenIDScopes;
|