@equinor/fusion-framework-module-msal 10.0.2 → 11.0.0-next.1

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 (82) hide show
  1. package/CHANGELOG.md +175 -0
  2. package/README.md +17 -368
  3. package/dist/esm/MsalConfigurator.js +176 -88
  4. package/dist/esm/MsalConfigurator.js.map +1 -1
  5. package/dist/esm/__tests__/MsalConfigurator.test.js +75 -0
  6. package/dist/esm/__tests__/MsalConfigurator.test.js.map +1 -1
  7. package/dist/esm/__tests__/create-proxy-provider.test.js +53 -0
  8. package/dist/esm/__tests__/create-proxy-provider.test.js.map +1 -0
  9. package/dist/esm/__tests__/mock/create-mock-user-from-token.test.js +39 -0
  10. package/dist/esm/__tests__/mock/create-mock-user-from-token.test.js.map +1 -0
  11. package/dist/esm/__tests__/mock/msal-mock.test.js +451 -0
  12. package/dist/esm/__tests__/mock/msal-mock.test.js.map +1 -0
  13. package/dist/esm/index.js +5 -0
  14. package/dist/esm/index.js.map +1 -1
  15. package/dist/esm/mock/MsalMockClient.js +484 -0
  16. package/dist/esm/mock/MsalMockClient.js.map +1 -0
  17. package/dist/esm/mock/MsalMockConfigurator.js +239 -0
  18. package/dist/esm/mock/MsalMockConfigurator.js.map +1 -0
  19. package/dist/esm/mock/create-mock-token.js +60 -0
  20. package/dist/esm/mock/create-mock-token.js.map +1 -0
  21. package/dist/esm/mock/create-mock-user-from-token.js +40 -0
  22. package/dist/esm/mock/create-mock-user-from-token.js.map +1 -0
  23. package/dist/esm/mock/create-msal-mock-client.js +20 -0
  24. package/dist/esm/mock/create-msal-mock-client.js.map +1 -0
  25. package/dist/esm/mock/decode-jwt-segment.js +22 -0
  26. package/dist/esm/mock/decode-jwt-segment.js.map +1 -0
  27. package/dist/esm/mock/index.js +31 -0
  28. package/dist/esm/mock/index.js.map +1 -0
  29. package/dist/esm/mock/module.js +38 -0
  30. package/dist/esm/mock/module.js.map +1 -0
  31. package/dist/esm/msal-config-schema.js +37 -0
  32. package/dist/esm/msal-config-schema.js.map +1 -0
  33. package/dist/esm/telemetry-config-schema.js +16 -0
  34. package/dist/esm/telemetry-config-schema.js.map +1 -0
  35. package/dist/esm/version.js +1 -1
  36. package/dist/esm/version.js.map +1 -1
  37. package/dist/esm/versioning/resolve-version.js +0 -1
  38. package/dist/esm/versioning/resolve-version.js.map +1 -1
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/dist/types/MsalConfigurator.d.ts +96 -20
  41. package/dist/types/__tests__/create-proxy-provider.test.d.ts +1 -0
  42. package/dist/types/__tests__/mock/create-mock-user-from-token.test.d.ts +1 -0
  43. package/dist/types/__tests__/mock/msal-mock.test.d.ts +1 -0
  44. package/dist/types/index.d.ts +5 -0
  45. package/dist/types/mock/MsalMockClient.d.ts +282 -0
  46. package/dist/types/mock/MsalMockConfigurator.d.ts +186 -0
  47. package/dist/types/mock/create-mock-token.d.ts +54 -0
  48. package/dist/types/mock/create-mock-user-from-token.d.ts +25 -0
  49. package/dist/types/mock/create-msal-mock-client.d.ts +14 -0
  50. package/dist/types/mock/decode-jwt-segment.d.ts +13 -0
  51. package/dist/types/mock/index.d.ts +30 -0
  52. package/dist/types/mock/module.d.ts +35 -0
  53. package/dist/types/msal-config-schema.d.ts +64 -0
  54. package/dist/types/telemetry-config-schema.d.ts +8 -0
  55. package/dist/types/version.d.ts +1 -1
  56. package/docs/api-reference.md +85 -0
  57. package/docs/auth-code-flow.md +86 -0
  58. package/docs/migration-v2-to-v4.md +115 -0
  59. package/docs/testing.md +191 -0
  60. package/docs/troubleshooting.md +17 -0
  61. package/docs/version-management.md +67 -0
  62. package/package.json +12 -5
  63. package/src/MsalConfigurator.ts +202 -115
  64. package/src/__tests__/MsalConfigurator.test.ts +106 -0
  65. package/src/__tests__/create-proxy-provider.test.ts +77 -0
  66. package/src/__tests__/mock/create-mock-user-from-token.test.ts +46 -0
  67. package/src/__tests__/mock/msal-mock.test.ts +613 -0
  68. package/src/index.ts +6 -0
  69. package/src/mock/MsalMockClient.ts +618 -0
  70. package/src/mock/MsalMockConfigurator.ts +305 -0
  71. package/src/mock/create-mock-token.ts +92 -0
  72. package/src/mock/create-mock-user-from-token.ts +46 -0
  73. package/src/mock/create-msal-mock-client.ts +25 -0
  74. package/src/mock/decode-jwt-segment.ts +22 -0
  75. package/src/mock/index.ts +30 -0
  76. package/src/mock/module.ts +54 -0
  77. package/src/msal-config-schema.ts +81 -0
  78. package/src/telemetry-config-schema.ts +25 -0
  79. package/src/version.ts +1 -1
  80. package/src/versioning/resolve-version.ts +0 -1
  81. package/vitest.config.ts +1 -1
  82. package/.changeset/msal-auth-provider-fix.md +0 -7
@@ -0,0 +1,484 @@
1
+ import { createMockToken } from './create-mock-token';
2
+ /**
3
+ * A stand-in for the MSAL client that resolves tokens in-process.
4
+ *
5
+ * @remarks
6
+ * Constructed from {@link MsalClientConfig} — the very same argument
7
+ * {@link MsalClient} takes — so it is a drop-in substitute rather than a second
8
+ * API to learn. `setClientConfig` therefore means the same thing whether a test
9
+ * runs against Entra ID or against this client.
10
+ *
11
+ * Only the boundary that would contact Entra ID is replaced. The real
12
+ * `MsalProvider` runs on top of it unchanged, so account handling, silent-token
13
+ * preference, scope resolution, proxy providers and telemetry behave as they do in
14
+ * production — the test exercises the framework rather than the mock.
15
+ *
16
+ * Tokens are structurally valid, unsigned JWTs and are byte-identical between runs.
17
+ * They are **not** cryptographically valid and are rejected by any real service.
18
+ */
19
+ export class MsalMockClient {
20
+ #user;
21
+ #cache = new Map();
22
+ #activeAccountId = null;
23
+ #token = null;
24
+ /**
25
+ * The account currently signed in, or `null`.
26
+ *
27
+ * @remarks
28
+ * Reads through the cache rather than holding an account of its own, so an
29
+ * account removed by a sign-out cannot linger as the active one.
30
+ *
31
+ * @returns The cached active account, or `null` when none is active.
32
+ */
33
+ get #account() {
34
+ return this.#activeAccountId ? (this.#cache.get(this.#activeAccountId) ?? null) : null;
35
+ }
36
+ /**
37
+ * Signs an account in, adding it to the cache and making it active.
38
+ *
39
+ * @param account - The account to sign in.
40
+ * @returns The signed-in account.
41
+ */
42
+ #signIn(account) {
43
+ this.#cache.set(account.homeAccountId, account);
44
+ this.#activeAccountId = account.homeAccountId;
45
+ return account;
46
+ }
47
+ /**
48
+ * Signs the active account out, as MSAL does — the account leaves the cache.
49
+ */
50
+ #signOut() {
51
+ // Only clear the cache entry when a session is active; this preserves an already signed-out state.
52
+ if (this.#activeAccountId) {
53
+ this.#cache.delete(this.#activeAccountId);
54
+ this.#activeAccountId = null;
55
+ }
56
+ }
57
+ /**
58
+ * Mirrors MSAL's redirect completion, which is a no-op for this in-process mock.
59
+ * @returns Always `null`, because the mock performs no redirect.
60
+ */
61
+ async handleRedirectPromise() {
62
+ return null;
63
+ }
64
+ /**
65
+ * Mirrors silent SSO and returns a token for the cached mock account.
66
+ * @param request - Silent SSO options and requested scopes.
67
+ * @returns A mock authentication result.
68
+ * @throws When no account is cached.
69
+ */
70
+ async ssoSilent(request) {
71
+ // Silent SSO must fail without a session so providers exercise their login path.
72
+ if (!this.#account) {
73
+ throw new Error('MsalMockClient: no cached account for silent sign-in');
74
+ }
75
+ return this.#createResult(request.scopes);
76
+ }
77
+ /**
78
+ * Mirrors popup login by signing in the configured mock user immediately.
79
+ * @param request - Optional popup options and requested scopes.
80
+ * @returns A mock authentication result.
81
+ */
82
+ async loginPopup(request) {
83
+ this.#signIn(this.#createAccount());
84
+ return this.#createResult(request?.scopes);
85
+ }
86
+ /**
87
+ * Mirrors redirect login without navigating, because the mock has no browser boundary.
88
+ * @param _request - Redirect options, accepted for interface compatibility.
89
+ */
90
+ async loginRedirect(_request) {
91
+ this.#signIn(this.#createAccount());
92
+ }
93
+ /**
94
+ * Mirrors the framework login entry point with an immediate mock sign-in.
95
+ * @param options - Login options including the requested scopes.
96
+ * @returns A mock login result.
97
+ */
98
+ async login(options) {
99
+ this.#signIn(this.#createAccount());
100
+ return this.#createResult(options.request?.scopes);
101
+ }
102
+ /** Mirrors logout by removing the active mock account from the cache. */
103
+ async logout() {
104
+ this.#signOut();
105
+ }
106
+ /**
107
+ * Mirrors MSAL initialization without performing a network handshake.
108
+ * @param _request - Initialization options, accepted for interface compatibility.
109
+ */
110
+ async initialize(_request) {
111
+ // No network handshake to perform
112
+ }
113
+ /**
114
+ * Mirrors popup token acquisition using the mock login flow.
115
+ * @param request - Popup token request.
116
+ * @returns A mock authentication result.
117
+ */
118
+ async acquireTokenPopup(request) {
119
+ return this.loginPopup(request);
120
+ }
121
+ /**
122
+ * Mirrors redirect token acquisition without browser navigation.
123
+ * @param request - Redirect token request.
124
+ */
125
+ async acquireTokenRedirect(request) {
126
+ return this.loginRedirect(request);
127
+ }
128
+ /**
129
+ * Mirrors silent token acquisition for the cached mock account.
130
+ * @param request - Silent token request.
131
+ * @returns A mock authentication result.
132
+ * @throws When no account is cached.
133
+ */
134
+ async acquireTokenSilent(request) {
135
+ // Silent acquisition must fail without a session, matching the real MSAL boundary.
136
+ if (!this.#account) {
137
+ throw new Error('MsalMockClient: no cached account for silent sign-in');
138
+ }
139
+ return this.#createResult(request.scopes);
140
+ }
141
+ /**
142
+ * Mirrors MSAL event registration; events are intentionally not emitted by the mock.
143
+ * @param _callback - Event handler, accepted for interface compatibility.
144
+ * @param _eventTypes - Event types, accepted for interface compatibility.
145
+ * @returns Always `null`, because the mock registers no callback.
146
+ */
147
+ addEventCallback(_callback, _eventTypes) {
148
+ return null;
149
+ }
150
+ /**
151
+ * Mirrors event removal as a no-op because this mock registers no callbacks.
152
+ * @param _callbackId - Callback identifier, accepted for interface compatibility.
153
+ */
154
+ removeEventCallback(_callbackId) {
155
+ // No-op for mock
156
+ }
157
+ /**
158
+ * Mirrors performance callback registration with a stable mock identifier.
159
+ * @param _callback - Performance handler, accepted for interface compatibility.
160
+ * @returns A stable mock callback identifier.
161
+ */
162
+ addPerformanceCallback(_callback) {
163
+ return 'mock-performance-callback';
164
+ }
165
+ /**
166
+ * Mirrors performance callback removal and reports successful mock removal.
167
+ * @param _callbackId - Callback identifier, accepted for interface compatibility.
168
+ * @returns Always `true` because no callback state is retained.
169
+ */
170
+ removePerformanceCallback(_callbackId) {
171
+ return true;
172
+ }
173
+ /**
174
+ * Mirrors MSAL account lookup against the mock cache.
175
+ * @param accountFilter - Account fields to match.
176
+ * @returns The first matching account, or `null`.
177
+ */
178
+ getAccount(accountFilter) {
179
+ const filter = (accountFilter ?? {});
180
+ // Filter the cache so callers observe the same account-selection semantics as MSAL.
181
+ const matches = this.getAllAccounts().filter((account) => (filter.homeAccountId === undefined || filter.homeAccountId === account.homeAccountId) &&
182
+ (filter.localAccountId === undefined || filter.localAccountId === account.localAccountId) &&
183
+ (filter.username === undefined || filter.username === account.username) &&
184
+ (filter.tenantId === undefined || filter.tenantId === account.tenantId));
185
+ return matches[0] ?? null;
186
+ }
187
+ /**
188
+ * Mirrors MSAL account enumeration using the mock cache.
189
+ * @param _accountFilter - Account filter, accepted for interface compatibility.
190
+ * @returns All accounts currently in the mock cache.
191
+ */
192
+ getAllAccounts(_accountFilter) {
193
+ return [...this.#cache.values()];
194
+ }
195
+ /**
196
+ * Mirrors redirect logout without navigating in the mock environment.
197
+ * @param _request - Logout options, accepted for interface compatibility.
198
+ */
199
+ async logoutRedirect(_request) {
200
+ this.#signOut();
201
+ }
202
+ /**
203
+ * Mirrors popup logout without opening a browser window.
204
+ * @param _request - Logout options, accepted for interface compatibility.
205
+ */
206
+ async logoutPopup(_request) {
207
+ this.#signOut();
208
+ }
209
+ /**
210
+ * Mirrors MSAL logger access; the mock does not retain a logger.
211
+ * @returns An interface-compatible empty logger value.
212
+ */
213
+ getLogger() {
214
+ // MSAL's Logger has a large internal surface with no mock consumers depend on; callers only pass it through
215
+ return undefined;
216
+ }
217
+ /**
218
+ * Mirrors logger configuration as a no-op for the mock.
219
+ * @param _logger - Logger, accepted for interface compatibility.
220
+ */
221
+ setLogger(_logger) {
222
+ // No-op for mock
223
+ }
224
+ /**
225
+ * Mirrors wrapper metadata initialization as a no-op for the mock.
226
+ * @param _sku - Wrapper identifier, accepted for interface compatibility.
227
+ * @param _version - Wrapper version, accepted for interface compatibility.
228
+ */
229
+ initializeWrapperLibrary(_sku, _version) {
230
+ // No-op for mock wrapper
231
+ }
232
+ /**
233
+ * Mirrors navigation-client configuration as a no-op because no navigation occurs.
234
+ * @param _navigationClient - Navigation client, accepted for interface compatibility.
235
+ */
236
+ setNavigationClient(_navigationClient) {
237
+ // No-op for mock
238
+ }
239
+ /**
240
+ * Mirrors configuration access and rejects it because the mock has no browser config.
241
+ * @returns Never; this mock does not expose browser configuration.
242
+ * @throws Always, because browser configuration is unsupported.
243
+ */
244
+ getConfiguration() {
245
+ throw new Error('MsalMockClient: getConfiguration is not supported in the mock client');
246
+ }
247
+ /**
248
+ * Mirrors cache hydration as a no-op because mock tokens are created in-process.
249
+ * @param _result - Authentication result, accepted for interface compatibility.
250
+ * @param _request - Original token request, accepted for interface compatibility.
251
+ */
252
+ async hydrateCache(_result, _request) {
253
+ // No-op for mock
254
+ }
255
+ /**
256
+ * Mirrors MSAL cache clearing by removing every mock account.
257
+ * @param _request - Cache-clear options, accepted for interface compatibility.
258
+ */
259
+ async clearCache(_request) {
260
+ this.#cache.clear();
261
+ this.#activeAccountId = null;
262
+ }
263
+ /**
264
+ * Mirrors the generic token acquisition entry point for the active mock account.
265
+ * @param options - Token acquisition options.
266
+ * @returns A mock result, or `null` without an active account.
267
+ */
268
+ async acquireToken(options) {
269
+ // Generic acquisition returns no result when no account is active, matching MSAL's nullable result.
270
+ if (!this.#account) {
271
+ return null;
272
+ }
273
+ return this.#createResult(options.request?.scopes);
274
+ }
275
+ /**
276
+ * Mirrors authorization-code exchange by signing in and returning a mock result.
277
+ * @param request - Authorization-code request.
278
+ * @returns A mock authentication result.
279
+ */
280
+ async acquireTokenByCode(request) {
281
+ this.#signIn(this.#createAccount());
282
+ return this.#createResult(request?.scopes);
283
+ }
284
+ /**
285
+ * Creates a mock client for the services the given configuration points at.
286
+ *
287
+ * @remarks
288
+ * Takes the same argument as {@link MsalClient}. A user named `Test User` is
289
+ * already in the account cache, so a provider built on this client boots the
290
+ * way one does for a returning user with a live session — no sign-in runs, and
291
+ * the provider's start-up path sees the state it would see in production. Use
292
+ * {@link MsalMockClient.setUser | setUser} to say who that user is.
293
+ *
294
+ * @param config - The same client configuration the real client is built from.
295
+ */
296
+ constructor(config) {
297
+ const tenantId = config.auth.tenantId ?? MsalMockClient.#tenantFromAuthority(config.auth);
298
+ this.#user = {
299
+ name: 'Test User',
300
+ username: 'test.user@equinor.com',
301
+ userId: 'fusion-mock-user',
302
+ tenantId: tenantId ?? 'fusion-mock-tenant',
303
+ scopes: ['fusion-mock-scope'],
304
+ clientId: config.auth.clientId,
305
+ };
306
+ this.#signIn(this.#createAccount());
307
+ }
308
+ /**
309
+ * Reads the tenant out of an authority URL.
310
+ *
311
+ * @remarks
312
+ * A configuration may carry only `authority`, in which case the tenant still
313
+ * has to end up on the tokens this client mints for the account to look like
314
+ * the one a real sign-in would have produced.
315
+ *
316
+ * @param auth - The auth section of the client configuration.
317
+ * @returns The tenant, or `undefined` when the authority carries none.
318
+ */
319
+ static #tenantFromAuthority(auth) {
320
+ // An explicit tenant takes precedence; only parse authority when configuration omitted it.
321
+ if (!auth.authority) {
322
+ return undefined;
323
+ }
324
+ try {
325
+ // Remove empty URL path segments to identify the authority's tenant consistently.
326
+ const segments = new URL(auth.authority).pathname.split('/').filter(Boolean);
327
+ return segments.at(-1);
328
+ }
329
+ catch {
330
+ return undefined;
331
+ }
332
+ }
333
+ /**
334
+ * Returns the client identifier used by tokens minted by this mock.
335
+ * @returns The configured client identifier.
336
+ */
337
+ get clientId() {
338
+ return this.#user.clientId;
339
+ }
340
+ /**
341
+ * Returns the tenant identifier used by tokens minted by this mock.
342
+ * @returns The configured tenant identifier.
343
+ */
344
+ get tenantId() {
345
+ return this.#user.tenantId;
346
+ }
347
+ /**
348
+ * Reports whether the mock currently has an active account.
349
+ * @returns Whether an account is active.
350
+ */
351
+ get hasValidClaims() {
352
+ return this.#account !== null;
353
+ }
354
+ /**
355
+ * Mirrors MSAL active-account access using the mock's single active account.
356
+ * @returns The active account, or `null`.
357
+ */
358
+ getActiveAccount() {
359
+ return this.#account;
360
+ }
361
+ /**
362
+ * Makes an account the active one, adding it to the cache if it is unknown.
363
+ *
364
+ * @remarks
365
+ * Real MSAL requires the account to already be cached. Accepting an unknown
366
+ * one is a deliberate concession to tests: it is the shortest way to swap the
367
+ * signed-in user between runs, without reconstructing the framework.
368
+ *
369
+ * @param next - The account to make active, or `null` to sign out.
370
+ */
371
+ setActiveAccount(next) {
372
+ // A null account is the MSAL sign-out signal, so clear the active mock session.
373
+ if (!next) {
374
+ this.#signOut();
375
+ return;
376
+ }
377
+ this.#signIn(next);
378
+ }
379
+ /**
380
+ * Declares who is signed in, replacing whoever was.
381
+ *
382
+ * @remarks
383
+ * This is the counterpart to a real sign-in: the client is configured with
384
+ * what it talks to, and learns the user separately. `MsalMockConfigurator`
385
+ * applies it as the configuration is assembled, so the account is in the cache
386
+ * before `MsalProvider.initialize` runs — the provider then behaves as it does
387
+ * for a returning user with a live session.
388
+ *
389
+ * Values left out keep whatever they were. Passing `null` signs out and
390
+ * forgets the identity, so the provider follows its unauthenticated path;
391
+ * `{ signedOut: true }` does the same but keeps the identity, so a later login
392
+ * resolves as that user.
393
+ *
394
+ * @param user - The user to sign in, or `null` when nobody is.
395
+ */
396
+ setUser(user) {
397
+ // Declaring a user replaces the session rather than adding to it, so a test
398
+ // that names a second user does not silently end up with two cached accounts
399
+ this.#cache.clear();
400
+ this.#activeAccountId = null;
401
+ // A null user explicitly clears the session and identity supplied to the mock.
402
+ if (!user) {
403
+ return;
404
+ }
405
+ const { account, signedOut, ...rest } = user;
406
+ // Merge overrides while retaining defaults for fields omitted by the test.
407
+ this.#user = {
408
+ ...this.#user,
409
+ ...rest,
410
+ name: rest.name ?? account?.name ?? this.#user.name,
411
+ username: rest.username ?? account?.username ?? this.#user.username,
412
+ userId: rest.userId ?? account?.localAccountId ?? this.#user.userId,
413
+ tenantId: rest.tenantId ?? account?.tenantId ?? this.#user.tenantId,
414
+ scopes: rest.scopes ?? this.#user.scopes,
415
+ };
416
+ // Keep identity data without caching an account when the test starts signed out.
417
+ if (signedOut) {
418
+ return;
419
+ }
420
+ this.#signIn(account ?? this.#createAccount());
421
+ }
422
+ /**
423
+ * Overrides the token returned by future results, independent of who is signed in.
424
+ *
425
+ * @remarks
426
+ * Use this when a backend mock validates its own tokens (specific claims, an
427
+ * audience, or a signature) — supplying the exact token here means that
428
+ * backend sees the token it issued, rather than a mock-shaped substitute this
429
+ * client would otherwise fabricate from the signed-in user's fields.
430
+ *
431
+ * @param token - The token to return verbatim, or `null` to resume generating one.
432
+ */
433
+ setToken(token) {
434
+ this.#token = token;
435
+ }
436
+ /**
437
+ * Creates the one account represented by this mock's configured identity.
438
+ * @returns An MSAL-shaped account for the configured user.
439
+ */
440
+ #createAccount() {
441
+ return {
442
+ homeAccountId: `${this.#user.userId}.${this.#user.tenantId}`,
443
+ localAccountId: this.#user.userId,
444
+ environment: 'login.microsoftonline.com',
445
+ tenantId: this.#user.tenantId,
446
+ username: this.#user.username,
447
+ name: this.#user.name,
448
+ };
449
+ }
450
+ /**
451
+ * Creates an MSAL-shaped token result for the requested or default scopes.
452
+ * @param scopes - Requested scopes, or the user's configured defaults.
453
+ * @returns An MSAL-shaped mock authentication result.
454
+ */
455
+ #createResult(scopes) {
456
+ const granted = scopes?.length ? scopes : this.#user.scopes;
457
+ // a caller-supplied token is sent verbatim so a backend mock validating it sees what it expects
458
+ const token = this.#token ??
459
+ createMockToken({
460
+ name: this.#user.name,
461
+ preferred_username: this.#user.username,
462
+ oid: this.#user.userId,
463
+ tid: this.#user.tenantId,
464
+ aud: this.#user.clientId,
465
+ scp: granted.join(' '),
466
+ });
467
+ // Object shape matches AuthenticationResult's fields consumers rely on; the real
468
+ // type also carries browser-only fields (e.g. `familyId`) this mock intentionally omits
469
+ return {
470
+ account: this.#account ?? this.#createAccount(),
471
+ accessToken: token,
472
+ idToken: token,
473
+ scopes: granted,
474
+ tokenType: 'Bearer',
475
+ expiresOn: new Date('2033-11-14T22:13:20.000Z'),
476
+ authority: `https://login.microsoftonline.com/${this.#user.tenantId}`,
477
+ uniqueId: this.#user.userId,
478
+ tenantId: this.#user.tenantId,
479
+ fromCache: false,
480
+ correlationId: 'fusion-mock-correlation',
481
+ };
482
+ }
483
+ }
484
+ //# sourceMappingURL=MsalMockClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MsalMockClient.js","sourceRoot":"","sources":["../../../src/mock/MsalMockClient.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAqCtD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,cAAc;IACzB,KAAK,CAEH;IACF,MAAM,GAAG,IAAI,GAAG,EAAuB,CAAC;IACxC,gBAAgB,GAAkB,IAAI,CAAC;IACvC,MAAM,GAAkB,IAAI,CAAC;IAE7B;;;;;;;;OAQG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACzF,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,OAAoB;QAC1B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;QAC9C,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,mGAAmG;QACnG,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC1C,IAAI,CAAC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