@phila/sso-core 0.0.1 → 0.0.3

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/index.mjs CHANGED
@@ -1,58 +1,67 @@
1
- import { LogLevel as A, PublicClientApplication as y, InteractionRequiredAuthError as l } from "@azure/msal-browser";
2
- class m {
1
+ import { LogLevel, PublicClientApplication, InteractionRequiredAuthError } from "@azure/msal-browser";
2
+ class SSOEventEmitter {
3
3
  listeners = /* @__PURE__ */ new Map();
4
- on(t, e) {
5
- this.listeners.has(t) || this.listeners.set(t, /* @__PURE__ */ new Set());
6
- const i = this.listeners.get(t);
7
- return i.add(e), () => {
8
- i.delete(e);
4
+ on(event, listener) {
5
+ if (!this.listeners.has(event)) {
6
+ this.listeners.set(event, /* @__PURE__ */ new Set());
7
+ }
8
+ const set = this.listeners.get(event);
9
+ set.add(listener);
10
+ return () => {
11
+ set.delete(listener);
9
12
  };
10
13
  }
11
- emit(t, e) {
12
- const i = this.listeners.get(t);
13
- if (i)
14
- for (const o of i)
15
- o(e);
14
+ emit(event, data) {
15
+ const set = this.listeners.get(event);
16
+ if (set) {
17
+ for (const listener of set) {
18
+ listener(data);
19
+ }
20
+ }
16
21
  }
17
22
  removeAllListeners() {
18
23
  this.listeners.clear();
19
24
  }
20
25
  }
21
- const r = {
26
+ const DEFAULT_POLICIES = {
22
27
  SIGN_UP_SIGN_IN: "B2C_1A_SIGNUP_SIGNIN",
23
28
  SIGN_IN_ONLY: "B2C_1A_AD_SIGNIN_ONLY",
24
29
  RESET_PASSWORD: "B2C_1A_PASSWORDRESET"
25
- }, h = {
30
+ };
31
+ const DEFAULT_SCOPES = {
26
32
  OPENID: "openid",
27
33
  PROFILE: "profile",
28
34
  OFFLINE_ACCESS: "offline_access"
29
- }, u = {
35
+ };
36
+ const CACHE_CONFIG = {
30
37
  LOCATION: "sessionStorage",
31
- STORE_AUTH_STATE_IN_COOKIE: !1
32
- }, R = {
38
+ STORE_AUTH_STATE_IN_COOKIE: false
39
+ };
40
+ const MSAL_ERROR_CODES = {
33
41
  USER_CANCELLED: "user_cancelled",
34
42
  NO_CACHED_AUTHORITY: "no_cached_authority_error",
35
43
  INTERACTION_REQUIRED: "interaction_required",
36
44
  FORGOT_PASSWORD: "AADB2C90118"
37
- }, d = "|";
38
- function _(s) {
39
- return btoa(JSON.stringify(s));
45
+ };
46
+ const STATE_SEPARATOR = "|";
47
+ function encodeState(stateObj) {
48
+ return btoa(JSON.stringify(stateObj));
40
49
  }
41
- function E(s) {
50
+ function decodeState(encoded) {
42
51
  try {
43
- return JSON.parse(atob(s));
52
+ return JSON.parse(atob(encoded));
44
53
  } catch {
45
54
  return null;
46
55
  }
47
56
  }
48
- function L(s) {
49
- if (!s) return null;
50
- const t = s.split(d);
51
- if (t.length < 2) return null;
52
- const e = t.slice(1).join(d);
53
- return E(e);
57
+ function extractCustomState(msalState) {
58
+ if (!msalState) return null;
59
+ const parts = msalState.split(STATE_SEPARATOR);
60
+ if (parts.length < 2) return null;
61
+ const customPart = parts.slice(1).join(STATE_SEPARATOR);
62
+ return decodeState(customPart);
54
63
  }
55
- class a {
64
+ class B2CProvider {
56
65
  type = "b2c";
57
66
  clientId;
58
67
  b2cEnv;
@@ -62,12 +71,19 @@ class a {
62
71
  policies;
63
72
  apiScopes;
64
73
  cacheLocation;
65
- constructor(t) {
66
- this.clientId = t.clientId, this.b2cEnv = t.b2cEnvironment, this.authorityDomain = t.authorityDomain, this.redirectUri = t.redirectUri, this.postLogoutRedirectUri = t.postLogoutRedirectUri ?? t.redirectUri, this.policies = {
67
- signUpSignIn: t.policies?.signUpSignIn ?? r.SIGN_UP_SIGN_IN,
68
- signInOnly: t.policies?.signInOnly ?? r.SIGN_IN_ONLY,
69
- resetPassword: t.policies?.resetPassword ?? r.RESET_PASSWORD
70
- }, this.apiScopes = t.apiScopes ?? [], this.cacheLocation = t.cacheLocation ?? u.LOCATION;
74
+ constructor(config) {
75
+ this.clientId = config.clientId;
76
+ this.b2cEnv = config.b2cEnvironment;
77
+ this.authorityDomain = config.authorityDomain;
78
+ this.redirectUri = config.redirectUri;
79
+ this.postLogoutRedirectUri = config.postLogoutRedirectUri ?? config.redirectUri;
80
+ this.policies = {
81
+ signUpSignIn: config.policies?.signUpSignIn ?? DEFAULT_POLICIES.SIGN_UP_SIGN_IN,
82
+ signInOnly: config.policies?.signInOnly ?? DEFAULT_POLICIES.SIGN_IN_ONLY,
83
+ resetPassword: config.policies?.resetPassword ?? DEFAULT_POLICIES.RESET_PASSWORD
84
+ };
85
+ this.apiScopes = config.apiScopes ?? [];
86
+ this.cacheLocation = config.cacheLocation ?? CACHE_CONFIG.LOCATION;
71
87
  }
72
88
  buildMsalConfig() {
73
89
  return {
@@ -77,35 +93,37 @@ class a {
77
93
  knownAuthorities: this.getKnownAuthorities(),
78
94
  redirectUri: this.redirectUri,
79
95
  postLogoutRedirectUri: this.postLogoutRedirectUri,
80
- navigateToLoginRequestUrl: !1
96
+ navigateToLoginRequestUrl: false
81
97
  },
82
98
  cache: {
83
99
  cacheLocation: this.cacheLocation,
84
- storeAuthStateInCookie: u.STORE_AUTH_STATE_IN_COOKIE
100
+ storeAuthStateInCookie: CACHE_CONFIG.STORE_AUTH_STATE_IN_COOKIE
85
101
  },
86
102
  system: {
87
103
  loggerOptions: {
88
- logLevel: A.Warning,
89
- loggerCallback: (t, e) => {
90
- console.warn("[sso-core/b2c]", e);
104
+ logLevel: LogLevel.Warning,
105
+ loggerCallback: (_level, message) => {
106
+ console.warn("[sso-core/b2c]", message);
91
107
  }
92
108
  }
93
109
  }
94
110
  };
95
111
  }
96
- getAuthority(t) {
97
- const e = t ?? this.policies.signUpSignIn;
98
- return `https://${this.authorityDomain}/${this.b2cEnv}.onmicrosoft.com/${e}`;
112
+ getAuthority(policy) {
113
+ const p = policy ?? this.policies.signUpSignIn;
114
+ return `https://${this.authorityDomain}/${this.b2cEnv}.onmicrosoft.com/${p}`;
99
115
  }
100
116
  getKnownAuthorities() {
101
117
  return [this.authorityDomain];
102
118
  }
103
- identifyPolicy(t) {
104
- const e = t.idTokenClaims;
105
- return e ? (e.acr ?? e.tfp)?.toUpperCase() ?? null : null;
119
+ identifyPolicy(response) {
120
+ const claims = response.idTokenClaims;
121
+ if (!claims) return null;
122
+ const acr = claims.acr ?? claims.tfp;
123
+ return acr?.toUpperCase() ?? null;
106
124
  }
107
125
  getDefaultScopes() {
108
- return [h.OPENID, h.PROFILE];
126
+ return [DEFAULT_SCOPES.OPENID, DEFAULT_SCOPES.PROFILE];
109
127
  }
110
128
  getApiScopes() {
111
129
  return this.apiScopes;
@@ -123,174 +141,247 @@ class a {
123
141
  return this.policies;
124
142
  }
125
143
  }
126
- const g = {
127
- isAuthenticated: !1,
128
- isLoading: !1,
144
+ const INITIAL_STATE = {
145
+ isAuthenticated: false,
146
+ isLoading: false,
129
147
  user: null,
130
148
  token: null,
131
149
  error: null,
132
150
  activePolicy: null,
133
- authReady: !1
151
+ authReady: false
134
152
  };
135
- class w {
136
- events = new m();
153
+ class SSOClient {
154
+ events = new SSOEventEmitter();
137
155
  provider;
138
156
  debug;
139
157
  encodedState;
140
158
  msalInstance = null;
141
- _state = { ...g };
142
- constructor(t) {
143
- this.provider = t.provider, this.debug = t.debug ?? !1, this.encodedState = t.state ? _(t.state) : null;
159
+ _state = { ...INITIAL_STATE };
160
+ constructor(config) {
161
+ this.provider = config.provider;
162
+ this.debug = config.debug ?? false;
163
+ this.encodedState = config.state ? encodeState(config.state) : null;
144
164
  }
145
165
  get state() {
146
166
  return this._state;
147
167
  }
148
168
  // ── Lifecycle ──
149
169
  async initialize() {
150
- this.log("Initializing SSOClient..."), this.updateState({ isLoading: !0 });
151
- const t = this.provider.buildMsalConfig();
152
- this.msalInstance = new y(t), await this.msalInstance.initialize();
153
- const e = await this.handleRedirect();
154
- return this.updateState({ isLoading: !1, authReady: !0 }), e;
170
+ this.log("Initializing SSOClient...");
171
+ this.updateState({ isLoading: true });
172
+ const msalConfig = this.provider.buildMsalConfig();
173
+ this.msalInstance = new PublicClientApplication(msalConfig);
174
+ await this.msalInstance.initialize();
175
+ const result = await this.handleRedirect();
176
+ this.updateState({ isLoading: false, authReady: true });
177
+ return result;
155
178
  }
156
179
  destroy() {
157
- this.events.removeAllListeners(), this.msalInstance = null, this._state = { ...g };
180
+ this.events.removeAllListeners();
181
+ this.msalInstance = null;
182
+ this._state = { ...INITIAL_STATE };
158
183
  }
159
184
  // ── Auth Actions ──
160
185
  async handleRedirect() {
161
- this.assertInitialized(), this.log("Handling redirect promise...");
186
+ this.assertInitialized();
187
+ this.log("Handling redirect promise...");
162
188
  try {
163
- const t = await this.msalInstance.handleRedirectPromise();
164
- if (!t)
165
- return this.selectAccount(null), null;
166
- this.log("Redirect response received", t);
167
- const e = L(t.state), i = this.provider.identifyPolicy(t);
168
- if (this.updateState({ activePolicy: i }), this.isForgotPasswordPolicy(i))
169
- return this.log("Forgot password flow completed"), this.events.emit("auth:forgotPassword", void 0), { ...t, customPostbackObject: e ?? void 0 };
170
- this.updateState({ isLoading: !0 }), this.selectAccount(i), await this.acquireTokenAfterRedirect(t);
171
- const o = {
172
- ...t,
173
- customPostbackObject: e ?? void 0
189
+ const response = await this.msalInstance.handleRedirectPromise();
190
+ if (!response) {
191
+ this.selectAccount(null);
192
+ return null;
193
+ }
194
+ this.log("Redirect response received", response);
195
+ const customState = extractCustomState(response.state);
196
+ const policy = this.provider.identifyPolicy(response);
197
+ this.updateState({ activePolicy: policy });
198
+ if (this.isForgotPasswordPolicy(policy)) {
199
+ this.log("Forgot password flow completed");
200
+ this.events.emit("auth:forgotPassword", void 0);
201
+ return { ...response, customPostbackObject: customState ?? void 0 };
202
+ }
203
+ this.updateState({ isLoading: true });
204
+ this.selectAccount(policy);
205
+ await this.acquireTokenAfterRedirect(response);
206
+ const authResponse = {
207
+ ...response,
208
+ customPostbackObject: customState ?? void 0
174
209
  };
175
- return this.events.emit("auth:signedIn", o), o;
176
- } catch (t) {
177
- return this.handleRedirectError(t);
210
+ this.events.emit("auth:signedIn", authResponse);
211
+ return authResponse;
212
+ } catch (error) {
213
+ return this.handleRedirectError(error);
178
214
  }
179
215
  }
180
- async signIn(t) {
181
- this.assertInitialized(), this.log("Initiating sign-in..."), this.updateState({ isLoading: !0 }), this.events.emit("auth:loading", !0);
182
- const e = this.buildLoginRequest(this.provider.getAuthority(), t);
183
- await this.msalInstance.loginRedirect(e);
184
- }
185
- async signInCityEmployee(t) {
186
- if (this.assertInitialized(), this.log("Initiating city employee sign-in..."), !(this.provider instanceof a))
187
- return this.signIn(t);
188
- const e = this.provider.getSignInOnlyAuthority(), i = this.buildLoginRequest(e, t);
189
- await this.msalInstance.loginRedirect(i);
190
- }
191
- async signOut(t) {
192
- this.assertInitialized(), this.log("Initiating sign-out...");
193
- const e = {
194
- postLogoutRedirectUri: t?.postLogoutRedirectUri,
216
+ async signIn(options) {
217
+ this.assertInitialized();
218
+ this.log("Initiating sign-in...");
219
+ this.updateState({ isLoading: true });
220
+ this.events.emit("auth:loading", true);
221
+ const request = this.buildLoginRequest(this.provider.getAuthority(), options);
222
+ await this.msalInstance.loginRedirect(request);
223
+ }
224
+ async signInCityEmployee(options) {
225
+ this.assertInitialized();
226
+ this.log("Initiating city employee sign-in...");
227
+ if (!(this.provider instanceof B2CProvider)) {
228
+ return this.signIn(options);
229
+ }
230
+ const authority = this.provider.getSignInOnlyAuthority();
231
+ const request = this.buildLoginRequest(authority, options);
232
+ await this.msalInstance.loginRedirect(request);
233
+ }
234
+ async signOut(options) {
235
+ this.assertInitialized();
236
+ this.log("Initiating sign-out...");
237
+ const logoutRequest = {
238
+ postLogoutRedirectUri: options?.postLogoutRedirectUri,
195
239
  authority: this.provider.getAuthority()
196
240
  };
197
- this.updateState({ isLoading: !0 }), this.events.emit("auth:signedOut", void 0), await this.msalInstance.logoutRedirect(e);
241
+ this.updateState({ isLoading: true });
242
+ this.events.emit("auth:signedOut", void 0);
243
+ await this.msalInstance.logoutRedirect(logoutRequest);
198
244
  }
199
245
  async forgotPassword() {
200
- if (this.assertInitialized(), !(this.provider instanceof a)) {
246
+ this.assertInitialized();
247
+ if (!(this.provider instanceof B2CProvider)) {
201
248
  this.log("Forgot password is only supported for B2C providers");
202
249
  return;
203
250
  }
204
251
  this.log("Initiating forgot password flow...");
205
- const t = this.provider.getResetPasswordAuthority();
206
- await this.msalInstance.loginRedirect({ scopes: [], authority: t });
207
- }
208
- async acquireToken(t) {
209
- this.assertInitialized(), this.log("Acquiring token...");
210
- const e = this._state.user;
211
- if (!e)
212
- return this.log("No account found, cannot acquire token"), null;
213
- const o = {
214
- scopes: t?.scopes ?? this.provider.getApiScopes(),
215
- forceRefresh: t?.forceRefresh ?? !1,
216
- account: e,
252
+ const authority = this.provider.getResetPasswordAuthority();
253
+ await this.msalInstance.loginRedirect({ scopes: [], authority });
254
+ }
255
+ async acquireToken(options) {
256
+ this.assertInitialized();
257
+ this.log("Acquiring token...");
258
+ const account = this._state.user;
259
+ if (!account) {
260
+ this.log("No account found, cannot acquire token");
261
+ return null;
262
+ }
263
+ const scopes = options?.scopes ?? this.provider.getApiScopes();
264
+ const tokenRequest = {
265
+ scopes,
266
+ forceRefresh: options?.forceRefresh ?? false,
267
+ account,
217
268
  authority: this._state.activePolicy ? this.provider.getAuthority(this._state.activePolicy) : this.provider.getAuthority()
218
269
  };
219
270
  try {
220
- const n = await this.msalInstance.acquireTokenSilent(o);
221
- if (!n.accessToken)
222
- throw new l("empty_token");
223
- return this.log("Token acquired silently"), this.updateState({ token: n.accessToken, error: null }), this.events.emit("auth:tokenAcquired", n.accessToken), n.accessToken;
224
- } catch (n) {
225
- if (n instanceof l) {
271
+ const response = await this.msalInstance.acquireTokenSilent(tokenRequest);
272
+ if (!response.accessToken) {
273
+ throw new InteractionRequiredAuthError("empty_token");
274
+ }
275
+ this.log("Token acquired silently");
276
+ this.updateState({ token: response.accessToken, error: null });
277
+ this.events.emit("auth:tokenAcquired", response.accessToken);
278
+ return response.accessToken;
279
+ } catch (error) {
280
+ if (error instanceof InteractionRequiredAuthError) {
226
281
  this.log("Silent token acquisition failed, falling back to redirect");
227
282
  try {
228
- return await this.msalInstance.acquireTokenRedirect(o), null;
229
- } catch (c) {
230
- return this.handleError(c), null;
283
+ await this.msalInstance.acquireTokenRedirect(tokenRequest);
284
+ return null;
285
+ } catch (redirectError) {
286
+ this.handleError(redirectError);
287
+ return null;
231
288
  }
232
289
  }
233
- return this.handleError(n), null;
290
+ this.handleError(error);
291
+ return null;
234
292
  }
235
293
  }
236
294
  // ── Internal Helpers ──
237
- selectAccount(t) {
238
- const e = this.msalInstance.getAllAccounts();
239
- if (e.length === 0) {
240
- this.updateState({ isAuthenticated: !1, user: null });
295
+ selectAccount(policy) {
296
+ const accounts = this.msalInstance.getAllAccounts();
297
+ if (accounts.length === 0) {
298
+ this.updateState({ isAuthenticated: false, user: null });
241
299
  return;
242
300
  }
243
- let i = null;
244
- if (e.length === 1)
245
- i = e[0];
246
- else if (t) {
247
- const o = e.filter((n) => {
248
- const p = n.idTokenClaims?.iss ?? "", f = this.provider.getKnownAuthorities().some((I) => p.toUpperCase().includes(I.toUpperCase())), S = n.homeAccountId.toUpperCase().includes(t.toUpperCase());
249
- return f && S;
301
+ let selected = null;
302
+ if (accounts.length === 1) {
303
+ selected = accounts[0];
304
+ } else if (policy) {
305
+ const filtered = accounts.filter((account) => {
306
+ const claims = account.idTokenClaims;
307
+ const iss = claims?.iss ?? "";
308
+ const knownAuthorities = this.provider.getKnownAuthorities();
309
+ const matchesAuthority = knownAuthorities.some((auth) => iss.toUpperCase().includes(auth.toUpperCase()));
310
+ const matchesPolicy = account.homeAccountId.toUpperCase().includes(policy.toUpperCase());
311
+ return matchesAuthority && matchesPolicy;
250
312
  });
251
- o.length >= 1 && (i = o[0]);
313
+ if (filtered.length >= 1) {
314
+ selected = filtered[0];
315
+ }
316
+ }
317
+ if (!selected && accounts.length > 0) {
318
+ selected = accounts[0];
319
+ }
320
+ if (selected) {
321
+ this.log("Account selected", selected.username);
322
+ this.updateState({ isAuthenticated: true, user: selected });
252
323
  }
253
- !i && e.length > 0 && (i = e[0]), i && (this.log("Account selected", i.username), this.updateState({ isAuthenticated: !0, user: i }));
254
324
  }
255
- async acquireTokenAfterRedirect(t) {
256
- const e = this.msalInstance.getAccountByHomeId(t.account?.homeAccountId ?? "") ?? t.account ?? null;
257
- e && this.updateState({ isAuthenticated: !0, user: e }), await this.acquireToken(), this.updateState({ isLoading: !1 });
325
+ async acquireTokenAfterRedirect(response) {
326
+ const account = this.msalInstance.getAccountByHomeId(response.account?.homeAccountId ?? "") ?? response.account ?? null;
327
+ if (account) {
328
+ this.updateState({ isAuthenticated: true, user: account });
329
+ }
330
+ await this.acquireToken();
331
+ this.updateState({ isLoading: false });
258
332
  }
259
- buildLoginRequest(t, e) {
333
+ buildLoginRequest(authority, options) {
334
+ const scopes = options?.scopes ?? this.provider.getDefaultScopes();
260
335
  return {
261
- scopes: e?.scopes ?? this.provider.getDefaultScopes(),
262
- authority: t,
336
+ scopes,
337
+ authority,
263
338
  state: this.encodedState ? `${this.encodedState}` : void 0,
264
- loginHint: e?.loginHint,
265
- domainHint: e?.domainHint
339
+ loginHint: options?.loginHint,
340
+ domainHint: options?.domainHint
266
341
  };
267
342
  }
268
- isForgotPasswordPolicy(t) {
269
- return !t || !(this.provider instanceof a) ? !1 : t.toUpperCase() === this.provider.getPolicies().resetPassword.toUpperCase();
270
- }
271
- handleRedirectError(t) {
272
- return t.errorMessage?.includes(R.FORGOT_PASSWORD) ? (this.log("Forgot password error detected, redirecting..."), this.forgotPassword(), null) : (this.handleError(t), this.updateState({ isLoading: !1 }), null);
343
+ isForgotPasswordPolicy(policy) {
344
+ if (!policy) return false;
345
+ if (!(this.provider instanceof B2CProvider)) return false;
346
+ return policy.toUpperCase() === this.provider.getPolicies().resetPassword.toUpperCase();
347
+ }
348
+ handleRedirectError(error) {
349
+ const err = error;
350
+ if (err.errorMessage?.includes(MSAL_ERROR_CODES.FORGOT_PASSWORD)) {
351
+ this.log("Forgot password error detected, redirecting...");
352
+ this.forgotPassword();
353
+ return null;
354
+ }
355
+ this.handleError(error);
356
+ this.updateState({ isLoading: false });
357
+ return null;
273
358
  }
274
- handleError(t) {
275
- const e = t instanceof Error ? t : new Error(String(t));
276
- this.log("Error:", e.message), this.updateState({ error: e }), this.events.emit("auth:error", e);
359
+ handleError(error) {
360
+ const err = error instanceof Error ? error : new Error(String(error));
361
+ this.log("Error:", err.message);
362
+ this.updateState({ error: err });
363
+ this.events.emit("auth:error", err);
277
364
  }
278
- updateState(t) {
279
- this._state = { ...this._state, ...t }, this.events.emit("auth:stateChanged", this._state);
365
+ updateState(partial) {
366
+ this._state = { ...this._state, ...partial };
367
+ this.events.emit("auth:stateChanged", this._state);
280
368
  }
281
369
  assertInitialized() {
282
- if (!this.msalInstance)
370
+ if (!this.msalInstance) {
283
371
  throw new Error("SSOClient not initialized. Call initialize() first.");
372
+ }
284
373
  }
285
- log(...t) {
286
- this.debug && console.log("[sso-core]", ...t);
374
+ log(...args) {
375
+ if (this.debug) {
376
+ console.log("[sso-core]", ...args);
377
+ }
287
378
  }
288
379
  }
289
- class C {
380
+ class CIAMProvider {
290
381
  type = "ciam";
291
382
  config;
292
- constructor(t) {
293
- this.config = t;
383
+ constructor(config) {
384
+ this.config = config;
294
385
  }
295
386
  buildMsalConfig() {
296
387
  return {
@@ -300,7 +391,7 @@ class C {
300
391
  knownAuthorities: this.getKnownAuthorities(),
301
392
  redirectUri: this.config.redirectUri,
302
393
  postLogoutRedirectUri: this.config.postLogoutRedirectUri ?? this.config.redirectUri,
303
- navigateToLoginRequestUrl: !1
394
+ navigateToLoginRequestUrl: false
304
395
  },
305
396
  cache: {
306
397
  cacheLocation: this.config.cacheLocation ?? "sessionStorage"
@@ -313,7 +404,7 @@ class C {
313
404
  getKnownAuthorities() {
314
405
  return [`${this.config.tenantSubdomain}.ciamlogin.com`];
315
406
  }
316
- identifyPolicy(t) {
407
+ identifyPolicy(_response) {
317
408
  return null;
318
409
  }
319
410
  getDefaultScopes() {
@@ -323,11 +414,11 @@ class C {
323
414
  return this.config.scopes ?? [];
324
415
  }
325
416
  }
326
- class P {
417
+ class EntraProvider {
327
418
  type = "entra";
328
419
  config;
329
- constructor(t) {
330
- this.config = t;
420
+ constructor(config) {
421
+ this.config = config;
331
422
  }
332
423
  buildMsalConfig() {
333
424
  return {
@@ -337,7 +428,7 @@ class P {
337
428
  knownAuthorities: this.getKnownAuthorities(),
338
429
  redirectUri: this.config.redirectUri,
339
430
  postLogoutRedirectUri: this.config.postLogoutRedirectUri ?? this.config.redirectUri,
340
- navigateToLoginRequestUrl: !1
431
+ navigateToLoginRequestUrl: false
341
432
  },
342
433
  cache: {
343
434
  cacheLocation: this.config.cacheLocation ?? "sessionStorage"
@@ -350,7 +441,7 @@ class P {
350
441
  getKnownAuthorities() {
351
442
  return ["login.microsoftonline.com"];
352
443
  }
353
- identifyPolicy(t) {
444
+ identifyPolicy(_response) {
354
445
  return null;
355
446
  }
356
447
  getDefaultScopes() {
@@ -361,18 +452,18 @@ class P {
361
452
  }
362
453
  }
363
454
  export {
364
- a as B2CProvider,
365
- u as CACHE_CONFIG,
366
- C as CIAMProvider,
367
- r as DEFAULT_POLICIES,
368
- h as DEFAULT_SCOPES,
369
- P as EntraProvider,
370
- R as MSAL_ERROR_CODES,
371
- w as SSOClient,
372
- m as SSOEventEmitter,
373
- d as STATE_SEPARATOR,
374
- E as decodeState,
375
- _ as encodeState,
376
- L as extractCustomState
455
+ B2CProvider,
456
+ CACHE_CONFIG,
457
+ CIAMProvider,
458
+ DEFAULT_POLICIES,
459
+ DEFAULT_SCOPES,
460
+ EntraProvider,
461
+ MSAL_ERROR_CODES,
462
+ SSOClient,
463
+ SSOEventEmitter,
464
+ STATE_SEPARATOR,
465
+ decodeState,
466
+ encodeState,
467
+ extractCustomState
377
468
  };
378
469
  //# sourceMappingURL=index.mjs.map