@axa-fr/oidc-client 7.22.18 → 7.22.19

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.
Files changed (73) hide show
  1. package/README.md +31 -39
  2. package/bin/copy-service-worker-files.mjs +24 -17
  3. package/dist/OidcTrustedDomains.js +14 -12
  4. package/dist/cache.d.ts.map +1 -1
  5. package/dist/checkSession.d.ts +1 -1
  6. package/dist/checkSession.d.ts.map +1 -1
  7. package/dist/checkSessionIFrame.d.ts.map +1 -1
  8. package/dist/crypto.d.ts.map +1 -1
  9. package/dist/fetch.d.ts +2 -1
  10. package/dist/fetch.d.ts.map +1 -1
  11. package/dist/index.d.ts +5 -5
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +935 -601
  14. package/dist/index.umd.cjs +2 -2
  15. package/dist/initSession.d.ts +1 -1
  16. package/dist/initSession.d.ts.map +1 -1
  17. package/dist/initWorker.d.ts +2 -2
  18. package/dist/initWorker.d.ts.map +1 -1
  19. package/dist/initWorkerOption.d.ts.map +1 -1
  20. package/dist/jwt.d.ts +2 -2
  21. package/dist/jwt.d.ts.map +1 -1
  22. package/dist/keepSession.d.ts.map +1 -1
  23. package/dist/location.d.ts.map +1 -1
  24. package/dist/login.d.ts +1 -1
  25. package/dist/login.d.ts.map +1 -1
  26. package/dist/logout.d.ts +1 -1
  27. package/dist/logout.d.ts.map +1 -1
  28. package/dist/oidc.d.ts +1 -1
  29. package/dist/oidc.d.ts.map +1 -1
  30. package/dist/oidcClient.d.ts +2 -2
  31. package/dist/oidcClient.d.ts.map +1 -1
  32. package/dist/parseTokens.d.ts.map +1 -1
  33. package/dist/renewTokens.d.ts.map +1 -1
  34. package/dist/requests.d.ts +1 -1
  35. package/dist/requests.d.ts.map +1 -1
  36. package/dist/silentLogin.d.ts.map +1 -1
  37. package/dist/timer.d.ts.map +1 -1
  38. package/dist/types.d.ts +1 -1
  39. package/dist/types.d.ts.map +1 -1
  40. package/dist/user.d.ts.map +1 -1
  41. package/dist/version.d.ts +1 -1
  42. package/package.json +2 -2
  43. package/src/cache.ts +21 -18
  44. package/src/checkSession.ts +89 -54
  45. package/src/checkSessionIFrame.ts +70 -69
  46. package/src/crypto.ts +27 -25
  47. package/src/events.ts +28 -28
  48. package/src/fetch.ts +40 -21
  49. package/src/index.ts +6 -17
  50. package/src/iniWorker.spec.ts +26 -16
  51. package/src/initSession.ts +115 -113
  52. package/src/initWorker.ts +299 -212
  53. package/src/initWorkerOption.ts +121 -114
  54. package/src/jwt.ts +150 -136
  55. package/src/keepSession.ts +100 -81
  56. package/src/location.ts +24 -26
  57. package/src/login.ts +246 -189
  58. package/src/logout.spec.ts +131 -76
  59. package/src/logout.ts +130 -115
  60. package/src/oidc.ts +426 -337
  61. package/src/oidcClient.ts +129 -105
  62. package/src/parseTokens.spec.ts +198 -179
  63. package/src/parseTokens.ts +221 -186
  64. package/src/renewTokens.ts +397 -284
  65. package/src/requests.spec.ts +5 -7
  66. package/src/requests.ts +142 -114
  67. package/src/route-utils.spec.ts +17 -19
  68. package/src/route-utils.ts +29 -26
  69. package/src/silentLogin.ts +145 -127
  70. package/src/timer.ts +10 -11
  71. package/src/types.ts +56 -46
  72. package/src/user.ts +17 -12
  73. package/src/version.ts +1 -1
@@ -2,85 +2,140 @@
2
2
 
3
3
  import { describe, expect, it, vi } from 'vitest';
4
4
 
5
- import { logoutAsync } from "./logout";
6
- import {ILOidcLocation, OidcLocation} from "./location";
5
+ import { ILOidcLocation } from './location';
6
+ import { logoutAsync } from './logout';
7
7
 
8
8
  describe('Logout test suite', () => {
9
- const expectedFinalUrl = "http://api/connect/endsession?id_token_hint=abcd&post_logout_redirect_uri=http%3A%2F%2Flocalhost%3A4200%2Flogged_out";
10
- it.each([
11
- {logout_tokens_to_invalidate:['access_token', 'refresh_token'], extras:null, expectedResults: ["token=abcd&token_type_hint=access_token&client_id=interactive.public.short","token=abdc&token_type_hint=refresh_token&client_id=interactive.public.short"], expectedFinalUrl},
12
- {logout_tokens_to_invalidate:['refresh_token'],extras:null, expectedResults: ["token=abdc&token_type_hint=refresh_token&client_id=interactive.public.short"], expectedFinalUrl},
13
- {logout_tokens_to_invalidate:['access_token'],extras:null, expectedResults: ["token=abcd&token_type_hint=access_token&client_id=interactive.public.short"], expectedFinalUrl},
14
- {logout_tokens_to_invalidate:[],extras:null, expectedResults: [], expectedFinalUrl},
15
- {logout_tokens_to_invalidate:[],extras: {"id_token_hint": undefined}, expectedResults: [], expectedFinalUrl: "http://api/connect/endsession?post_logout_redirect_uri=http%3A%2F%2Flocalhost%3A4200%2Flogged_out" },
16
- {logout_tokens_to_invalidate:[],extras: {"no_reload:oidc":"true"}, expectedResults: [], expectedFinalUrl:""},
17
- {logout_tokens_to_invalidate:['refresh_token'],extras:{"client_secret:revoke_refresh_token":"secret"}, expectedResults: ["token=abdc&token_type_hint=refresh_token&client_id=interactive.public.short&client_secret=secret"], expectedFinalUrl},
18
- {logout_tokens_to_invalidate:['access_token'],extras:{"client_secret:revoke_access_token":"secret"}, expectedResults: ["token=abcd&token_type_hint=access_token&client_id=interactive.public.short&client_secret=secret"], expectedFinalUrl},
19
- ])('Logout should revoke tokens $logout_tokens_to_invalidate', async ({ logout_tokens_to_invalidate, extras =null, expectedResults, expectedFinalUrl}) => {
20
-
21
- const configuration = {
22
- client_id: 'interactive.public.short',
23
- redirect_uri: 'http://localhost:4200/authentication/callback',
24
- scope: 'openid profile email api offline_access',
25
- authority: 'http://api',
26
- refresh_time_before_tokens_expiration_in_second: 70,
27
- logout_tokens_to_invalidate,
28
- };
29
-
30
- const fetch = (url, data) => {
31
- if(url === "http://api/connect/revocation") {
32
- return Promise.resolve({status: 200});
33
- }
34
- return Promise.resolve({
35
- status : 200,
36
- });
37
- };
38
-
39
- const mockFetchFn = vi.fn().mockImplementation(fetch);
40
-
41
- const oidc = {
42
- configuration,
43
- tokens : {idToken: "abcd", accessToken: "abcd", refreshToken: "abdc" },
44
- initAsync: () => Promise.resolve({
45
- revocationEndpoint: "http://api/connect/revocation",
46
- endSessionEndpoint: "http://api/connect/endsession",
47
- }),
48
- destroyAsync: () => Promise.resolve(),
49
- logoutSameTabAsync: () => Promise.resolve(),
50
- };
51
-
52
- const oidcDatabase = {default: () => oidc};
53
-
54
- let finalUrl = "";
55
- class OidcLocationMock implements ILOidcLocation{
56
- open(url: string): void {
57
- finalUrl = url;
58
- }
59
-
60
- getCurrentHref(): string {
61
- return "";
62
- }
63
-
64
- getPath(): string {
65
- return "";
66
- }
67
-
68
- reload(): void {
69
- }
70
-
71
- getOrigin(): string {
72
- return "http://localhost:4200";
73
- }
74
-
9
+ const expectedFinalUrl =
10
+ 'http://api/connect/endsession?id_token_hint=abcd&post_logout_redirect_uri=http%3A%2F%2Flocalhost%3A4200%2Flogged_out';
11
+ it.each([
12
+ {
13
+ logout_tokens_to_invalidate: ['access_token', 'refresh_token'],
14
+ extras: null,
15
+ expectedResults: [
16
+ 'token=abcd&token_type_hint=access_token&client_id=interactive.public.short',
17
+ 'token=abdc&token_type_hint=refresh_token&client_id=interactive.public.short',
18
+ ],
19
+ expectedFinalUrl,
20
+ },
21
+ {
22
+ logout_tokens_to_invalidate: ['refresh_token'],
23
+ extras: null,
24
+ expectedResults: [
25
+ 'token=abdc&token_type_hint=refresh_token&client_id=interactive.public.short',
26
+ ],
27
+ expectedFinalUrl,
28
+ },
29
+ {
30
+ logout_tokens_to_invalidate: ['access_token'],
31
+ extras: null,
32
+ expectedResults: [
33
+ 'token=abcd&token_type_hint=access_token&client_id=interactive.public.short',
34
+ ],
35
+ expectedFinalUrl,
36
+ },
37
+ { logout_tokens_to_invalidate: [], extras: null, expectedResults: [], expectedFinalUrl },
38
+ {
39
+ logout_tokens_to_invalidate: [],
40
+ extras: { id_token_hint: undefined },
41
+ expectedResults: [],
42
+ expectedFinalUrl:
43
+ 'http://api/connect/endsession?post_logout_redirect_uri=http%3A%2F%2Flocalhost%3A4200%2Flogged_out',
44
+ },
45
+ {
46
+ logout_tokens_to_invalidate: [],
47
+ extras: { 'no_reload:oidc': 'true' },
48
+ expectedResults: [],
49
+ expectedFinalUrl: '',
50
+ },
51
+ {
52
+ logout_tokens_to_invalidate: ['refresh_token'],
53
+ extras: { 'client_secret:revoke_refresh_token': 'secret' },
54
+ expectedResults: [
55
+ 'token=abdc&token_type_hint=refresh_token&client_id=interactive.public.short&client_secret=secret',
56
+ ],
57
+ expectedFinalUrl,
58
+ },
59
+ {
60
+ logout_tokens_to_invalidate: ['access_token'],
61
+ extras: { 'client_secret:revoke_access_token': 'secret' },
62
+ expectedResults: [
63
+ 'token=abcd&token_type_hint=access_token&client_id=interactive.public.short&client_secret=secret',
64
+ ],
65
+ expectedFinalUrl,
66
+ },
67
+ ])(
68
+ 'Logout should revoke tokens $logout_tokens_to_invalidate',
69
+ async ({ logout_tokens_to_invalidate, extras = null, expectedResults, expectedFinalUrl }) => {
70
+ const configuration = {
71
+ client_id: 'interactive.public.short',
72
+ redirect_uri: 'http://localhost:4200/authentication/callback',
73
+ scope: 'openid profile email api offline_access',
74
+ authority: 'http://api',
75
+ refresh_time_before_tokens_expiration_in_second: 70,
76
+ logout_tokens_to_invalidate,
77
+ };
78
+
79
+ const fetch = (url, data) => {
80
+ if (url === 'http://api/connect/revocation') {
81
+ return Promise.resolve({ status: 200 });
82
+ }
83
+ return Promise.resolve({
84
+ status: 200,
85
+ });
86
+ };
87
+
88
+ const mockFetchFn = vi.fn().mockImplementation(fetch);
89
+
90
+ const oidc = {
91
+ configuration,
92
+ tokens: { idToken: 'abcd', accessToken: 'abcd', refreshToken: 'abdc' },
93
+ initAsync: () =>
94
+ Promise.resolve({
95
+ revocationEndpoint: 'http://api/connect/revocation',
96
+ endSessionEndpoint: 'http://api/connect/endsession',
97
+ }),
98
+ destroyAsync: () => Promise.resolve(),
99
+ logoutSameTabAsync: () => Promise.resolve(),
100
+ };
101
+
102
+ const oidcDatabase = { default: () => oidc };
103
+
104
+ let finalUrl = '';
105
+ class OidcLocationMock implements ILOidcLocation {
106
+ open(url: string): void {
107
+ finalUrl = url;
108
+ }
109
+
110
+ getCurrentHref(): string {
111
+ return '';
75
112
  }
76
113
 
77
- await logoutAsync(oidc, oidcDatabase, mockFetchFn, console, new OidcLocationMock())("/logged_out", extras);
78
-
79
- // @ts-ignore
114
+ getPath(): string {
115
+ return '';
116
+ }
117
+
118
+ reload(): void {}
119
+
120
+ getOrigin(): string {
121
+ return 'http://localhost:4200';
122
+ }
123
+ }
124
+
125
+ await logoutAsync(
126
+ oidc,
127
+ oidcDatabase,
128
+ mockFetchFn,
129
+ console,
130
+ new OidcLocationMock(),
131
+ )('/logged_out', extras);
132
+
133
+ // @ts-ignore
134
+
135
+ const results = mockFetchFn.mock.calls.map((call, index) => call[1].body);
80
136
 
81
- const results = mockFetchFn.mock.calls.map((call, index) => call[1].body);
82
-
83
- expect(results).toEqual(expectedResults);
84
- expect(finalUrl).toBe(expectedFinalUrl);
85
- });
137
+ expect(results).toEqual(expectedResults);
138
+ expect(finalUrl).toBe(expectedFinalUrl);
139
+ },
140
+ );
86
141
  });
package/src/logout.ts CHANGED
@@ -1,153 +1,168 @@
1
+ import { eventNames } from './events';
1
2
  import { initSession } from './initSession.js';
2
3
  import { initWorkerAsync } from './initWorker.js';
4
+ import { ILOidcLocation } from './location';
3
5
  import { performRevocationRequestAsync, TOKEN_TYPE } from './requests.js';
4
6
  import timer from './timer.js';
5
7
  import { StringMap } from './types.js';
6
- import {ILOidcLocation} from "./location";
7
- import {eventNames} from "./events";
8
8
 
9
9
  export const oidcLogoutTokens = {
10
- access_token: 'access_token',
11
- refresh_token: 'refresh_token',
10
+ access_token: 'access_token',
11
+ refresh_token: 'refresh_token',
12
12
  };
13
13
 
14
- const extractExtras = (extras: StringMap, postKey: string):StringMap => {
15
- const postExtras:StringMap = {};
16
- if (extras) {
17
- for (const [key, value] of Object.entries(extras)) {
18
- if (key.endsWith(postKey)) {
19
- const newKey = key.replace(postKey, '');
20
- postExtras[newKey] = value;
21
- }
22
- }
23
- return postExtras;
14
+ const extractExtras = (extras: StringMap, postKey: string): StringMap => {
15
+ const postExtras: StringMap = {};
16
+ if (extras) {
17
+ for (const [key, value] of Object.entries(extras)) {
18
+ if (key.endsWith(postKey)) {
19
+ const newKey = key.replace(postKey, '');
20
+ postExtras[newKey] = value;
21
+ }
24
22
  }
25
23
  return postExtras;
26
- }
24
+ }
25
+ return postExtras;
26
+ };
27
27
 
28
- const keepExtras = (extras: StringMap):StringMap => {
29
- const postExtras : StringMap = {};
30
- if (extras) {
31
- for (const [key, value] of Object.entries(extras)) {
32
- if (!key.includes(':')) {
33
- postExtras[key] = value;
34
- }
35
- }
36
- return postExtras;
28
+ const keepExtras = (extras: StringMap): StringMap => {
29
+ const postExtras: StringMap = {};
30
+ if (extras) {
31
+ for (const [key, value] of Object.entries(extras)) {
32
+ if (!key.includes(':')) {
33
+ postExtras[key] = value;
34
+ }
37
35
  }
38
36
  return postExtras;
39
- }
37
+ }
38
+ return postExtras;
39
+ };
40
40
 
41
- export const destroyAsync = (oidc) => async (status) => {
42
- timer.clearTimeout(oidc.timeoutId);
43
- oidc.timeoutId = null;
44
- if (oidc.checkSessionIFrame) {
45
- oidc.checkSessionIFrame.stop();
46
- }
47
- const serviceWorker = await initWorkerAsync(oidc.configuration, oidc.configurationName);
48
- if (!serviceWorker) {
49
- const session = initSession(oidc.configurationName, oidc.configuration.storage);
50
- await session.clearAsync(status);
51
- } else {
52
- await serviceWorker.clearAsync(status);
53
- }
54
- oidc.tokens = null;
55
- oidc.userInfo = null;
41
+ export const destroyAsync = oidc => async status => {
42
+ timer.clearTimeout(oidc.timeoutId);
43
+ oidc.timeoutId = null;
44
+ if (oidc.checkSessionIFrame) {
45
+ oidc.checkSessionIFrame.stop();
46
+ }
47
+ const serviceWorker = await initWorkerAsync(oidc.configuration, oidc.configurationName);
48
+ if (!serviceWorker) {
49
+ const session = initSession(oidc.configurationName, oidc.configuration.storage);
50
+ await session.clearAsync(status);
51
+ } else {
52
+ await serviceWorker.clearAsync(status);
53
+ }
54
+ oidc.tokens = null;
55
+ oidc.userInfo = null;
56
56
  };
57
57
 
58
- export const logoutAsync = (oidc,
59
- oidcDatabase,
60
- fetch,
61
- console, oicLocation:ILOidcLocation) => async (callbackPathOrUrl: string | null | undefined = undefined, extras: StringMap = null) => {
58
+ export const logoutAsync =
59
+ (oidc, oidcDatabase, fetch, console, oicLocation: ILOidcLocation) =>
60
+ async (callbackPathOrUrl: string | null | undefined = undefined, extras: StringMap = null) => {
62
61
  const configuration = oidc.configuration;
63
- const oidcServerConfiguration = await oidc.initAsync(configuration.authority, configuration.authority_configuration);
64
- if (callbackPathOrUrl && (typeof callbackPathOrUrl !== 'string')) {
65
- callbackPathOrUrl = undefined;
66
- console.warn('callbackPathOrUrl path is not a string');
62
+ const oidcServerConfiguration = await oidc.initAsync(
63
+ configuration.authority,
64
+ configuration.authority_configuration,
65
+ );
66
+ if (callbackPathOrUrl && typeof callbackPathOrUrl !== 'string') {
67
+ callbackPathOrUrl = undefined;
68
+ console.warn('callbackPathOrUrl path is not a string');
67
69
  }
68
- const path = (callbackPathOrUrl === null || callbackPathOrUrl === undefined) ? oicLocation.getPath() : callbackPathOrUrl;
70
+ const path =
71
+ callbackPathOrUrl === null || callbackPathOrUrl === undefined
72
+ ? oicLocation.getPath()
73
+ : callbackPathOrUrl;
69
74
  let isUri = false;
70
75
  if (callbackPathOrUrl) {
71
- isUri = callbackPathOrUrl.includes('https://') || callbackPathOrUrl.includes('http://');
76
+ isUri = callbackPathOrUrl.includes('https://') || callbackPathOrUrl.includes('http://');
72
77
  }
73
- const url = isUri ? callbackPathOrUrl : oicLocation.getOrigin() + path
78
+ const url = isUri ? callbackPathOrUrl : oicLocation.getOrigin() + path;
74
79
  // @ts-ignore
75
80
  const idToken = oidc.tokens ? oidc.tokens.idToken : '';
76
81
  try {
77
- const revocationEndpoint = oidcServerConfiguration.revocationEndpoint;
78
- if (revocationEndpoint) {
79
- const promises = [];
80
- const accessToken = oidc.tokens ? oidc.tokens.accessToken : null;
81
- if (accessToken && configuration.logout_tokens_to_invalidate.includes(oidcLogoutTokens.access_token)) {
82
- const revokeAccessTokenExtras = extractExtras(extras, ':revoke_access_token');
83
- const revokeAccessTokenPromise = performRevocationRequestAsync(fetch)(revocationEndpoint,
84
- accessToken,
85
- TOKEN_TYPE.access_token,
86
- configuration.client_id,
87
- revokeAccessTokenExtras);
88
- promises.push(revokeAccessTokenPromise);
89
- }
90
- const refreshToken = oidc.tokens ? oidc.tokens.refreshToken : null;
91
- if (refreshToken && configuration.logout_tokens_to_invalidate.includes(oidcLogoutTokens.refresh_token)) {
92
- const revokeAccessTokenExtras = extractExtras(extras, ':revoke_refresh_token');
93
- const revokeRefreshTokenPromise = performRevocationRequestAsync(fetch)(revocationEndpoint,
94
- refreshToken,
95
- TOKEN_TYPE.refresh_token,
96
- configuration.client_id,
97
- revokeAccessTokenExtras);
98
- promises.push(revokeRefreshTokenPromise);
99
- }
100
- if (promises.length > 0) {
101
- await Promise.all(promises);
102
- }
82
+ const revocationEndpoint = oidcServerConfiguration.revocationEndpoint;
83
+ if (revocationEndpoint) {
84
+ const promises = [];
85
+ const accessToken = oidc.tokens ? oidc.tokens.accessToken : null;
86
+ if (
87
+ accessToken &&
88
+ configuration.logout_tokens_to_invalidate.includes(oidcLogoutTokens.access_token)
89
+ ) {
90
+ const revokeAccessTokenExtras = extractExtras(extras, ':revoke_access_token');
91
+ const revokeAccessTokenPromise = performRevocationRequestAsync(fetch)(
92
+ revocationEndpoint,
93
+ accessToken,
94
+ TOKEN_TYPE.access_token,
95
+ configuration.client_id,
96
+ revokeAccessTokenExtras,
97
+ );
98
+ promises.push(revokeAccessTokenPromise);
99
+ }
100
+ const refreshToken = oidc.tokens ? oidc.tokens.refreshToken : null;
101
+ if (
102
+ refreshToken &&
103
+ configuration.logout_tokens_to_invalidate.includes(oidcLogoutTokens.refresh_token)
104
+ ) {
105
+ const revokeAccessTokenExtras = extractExtras(extras, ':revoke_refresh_token');
106
+ const revokeRefreshTokenPromise = performRevocationRequestAsync(fetch)(
107
+ revocationEndpoint,
108
+ refreshToken,
109
+ TOKEN_TYPE.refresh_token,
110
+ configuration.client_id,
111
+ revokeAccessTokenExtras,
112
+ );
113
+ promises.push(revokeRefreshTokenPromise);
114
+ }
115
+ if (promises.length > 0) {
116
+ await Promise.all(promises);
103
117
  }
118
+ }
104
119
  } catch (exception) {
105
- console.warn('logoutAsync: error when revoking tokens, if the error persist, you ay configure property logout_tokens_to_invalidate from configuration to avoid this error');
106
- console.warn(exception);
120
+ console.warn(
121
+ 'logoutAsync: error when revoking tokens, if the error persist, you ay configure property logout_tokens_to_invalidate from configuration to avoid this error',
122
+ );
123
+ console.warn(exception);
107
124
  }
108
- // @ts-ignore
109
- const sub = oidc.tokens && oidc.tokens.idTokenPayload ? oidc.tokens.idTokenPayload.sub : null;
110
-
111
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
125
+ const sub = oidc.tokens?.idTokenPayload?.sub ?? null;
126
+
112
127
  await oidc.destroyAsync('LOGGED_OUT');
113
- for (const [key, itemOidc] of Object.entries(oidcDatabase)) {
114
- if (itemOidc !== oidc) {
115
- // @ts-ignore
116
- await oidc.logoutSameTabAsync(oidc.configuration.client_id, sub);
117
- } else {
118
- oidc.publishEvent(eventNames.logout_from_same_tab, {} );
119
- }
128
+ for (const [, itemOidc] of Object.entries(oidcDatabase)) {
129
+ if (itemOidc !== oidc) {
130
+ // @ts-ignore
131
+ await oidc.logoutSameTabAsync(oidc.configuration.client_id, sub);
132
+ } else {
133
+ oidc.publishEvent(eventNames.logout_from_same_tab, {});
134
+ }
120
135
  }
121
-
136
+
122
137
  const oidcExtras = extractExtras(extras, ':oidc');
123
- let noReload = oidcExtras && oidcExtras['no_reload'] === 'true';
124
-
125
- if(noReload) {
126
- return;
138
+ const noReload = oidcExtras && oidcExtras['no_reload'] === 'true';
139
+
140
+ if (noReload) {
141
+ return;
127
142
  }
128
143
 
129
144
  const endPointExtras = keepExtras(extras);
130
-
145
+
131
146
  if (oidcServerConfiguration.endSessionEndpoint) {
132
- if (!('id_token_hint' in endPointExtras)) {
133
- endPointExtras['id_token_hint'] = idToken;
134
- }
135
- if (!('post_logout_redirect_uri' in endPointExtras) && callbackPathOrUrl !== null) {
136
- endPointExtras['post_logout_redirect_uri'] = url;
147
+ if (!('id_token_hint' in endPointExtras)) {
148
+ endPointExtras['id_token_hint'] = idToken;
149
+ }
150
+ if (!('post_logout_redirect_uri' in endPointExtras) && callbackPathOrUrl !== null) {
151
+ endPointExtras['post_logout_redirect_uri'] = url;
152
+ }
153
+ let queryString = '';
154
+ for (const [key, value] of Object.entries(endPointExtras)) {
155
+ if (value !== null && value !== undefined) {
156
+ if (queryString === '') {
157
+ queryString += '?';
158
+ } else {
159
+ queryString += '&';
160
+ }
161
+ queryString += `${key}=${encodeURIComponent(value)}`;
137
162
  }
138
- let queryString = '';
139
- for (const [key, value] of Object.entries(endPointExtras)) {
140
- if(value !== null && value !== undefined) {
141
- if (queryString === '') {
142
- queryString += '?';
143
- } else {
144
- queryString += '&';
145
- }
146
- queryString += `${key}=${encodeURIComponent(value)}`;
147
- }
148
- }
149
- oicLocation.open(`${oidcServerConfiguration.endSessionEndpoint}${queryString}`);
163
+ }
164
+ oicLocation.open(`${oidcServerConfiguration.endSessionEndpoint}${queryString}`);
150
165
  } else {
151
- oicLocation.reload();
166
+ oicLocation.reload();
152
167
  }
153
- };
168
+ };