@azure/msal-angular 0.0.0-alpha1

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 (55) hide show
  1. package/IMsalService.d.ts +16 -0
  2. package/IMsalService.d.ts.map +1 -0
  3. package/LICENSE +21 -0
  4. package/README.md +151 -0
  5. package/azure-msal-angular.d.ts +5 -0
  6. package/azure-msal-angular.d.ts.map +1 -0
  7. package/azure-msal-angular.metadata.json +1 -0
  8. package/bundles/azure-msal-angular.umd.js +991 -0
  9. package/bundles/azure-msal-angular.umd.js.map +1 -0
  10. package/bundles/azure-msal-angular.umd.min.js +2 -0
  11. package/bundles/azure-msal-angular.umd.min.js.map +1 -0
  12. package/constants.d.ts +6 -0
  13. package/constants.d.ts.map +1 -0
  14. package/esm2015/IMsalService.js +6 -0
  15. package/esm2015/azure-msal-angular.js +5 -0
  16. package/esm2015/constants.js +10 -0
  17. package/esm2015/msal.broadcast.config.js +6 -0
  18. package/esm2015/msal.broadcast.service.js +46 -0
  19. package/esm2015/msal.guard.config.js +6 -0
  20. package/esm2015/msal.guard.js +189 -0
  21. package/esm2015/msal.interceptor.config.js +6 -0
  22. package/esm2015/msal.interceptor.js +208 -0
  23. package/esm2015/msal.module.js +46 -0
  24. package/esm2015/msal.navigation.client.js +53 -0
  25. package/esm2015/msal.redirect.component.js +33 -0
  26. package/esm2015/msal.service.js +77 -0
  27. package/esm2015/packageMetadata.js +4 -0
  28. package/esm2015/public-api.js +18 -0
  29. package/fesm2015/azure-msal-angular.js +636 -0
  30. package/fesm2015/azure-msal-angular.js.map +1 -0
  31. package/msal.broadcast.config.d.ts +4 -0
  32. package/msal.broadcast.config.d.ts.map +1 -0
  33. package/msal.broadcast.service.d.ts +15 -0
  34. package/msal.broadcast.service.d.ts.map +1 -0
  35. package/msal.guard.config.d.ts +10 -0
  36. package/msal.guard.config.d.ts.map +1 -0
  37. package/msal.guard.d.ts +41 -0
  38. package/msal.guard.d.ts.map +1 -0
  39. package/msal.interceptor.config.d.ts +18 -0
  40. package/msal.interceptor.config.d.ts.map +1 -0
  41. package/msal.interceptor.d.ts +50 -0
  42. package/msal.interceptor.d.ts.map +1 -0
  43. package/msal.module.d.ts +8 -0
  44. package/msal.module.d.ts.map +1 -0
  45. package/msal.navigation.client.d.ts +17 -0
  46. package/msal.navigation.client.d.ts.map +1 -0
  47. package/msal.redirect.component.d.ts +13 -0
  48. package/msal.redirect.component.d.ts.map +1 -0
  49. package/msal.service.d.ts +29 -0
  50. package/msal.service.d.ts.map +1 -0
  51. package/package.json +35 -0
  52. package/packageMetadata.d.ts +3 -0
  53. package/packageMetadata.d.ts.map +1 -0
  54. package/public-api.d.ts +18 -0
  55. package/public-api.d.ts.map +1 -0
@@ -0,0 +1,991 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@azure/msal-browser'), require('rxjs'), require('@angular/router'), require('rxjs/operators')) :
3
+ typeof define === 'function' && define.amd ? define('@azure/msal-angular', ['exports', '@angular/core', '@angular/common', '@azure/msal-browser', 'rxjs', '@angular/router', 'rxjs/operators'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.azure = global.azure || {}, global.azure['msal-angular'] = {}), global.ng.core, global.ng.common, global['@azure/msal-browser'], global.rxjs, global.ng.router, global.rxjs.operators));
5
+ }(this, (function (exports, core, common, msalBrowser, rxjs, router, operators) { 'use strict';
6
+
7
+ /*
8
+ * Copyright (c) Microsoft Corporation. All rights reserved.
9
+ * Licensed under the MIT License.
10
+ */
11
+ var MSAL_INSTANCE = new core.InjectionToken("MSAL_INSTANCE");
12
+ var MSAL_GUARD_CONFIG = new core.InjectionToken("MSAL_GUARD_CONFIG");
13
+ var MSAL_INTERCEPTOR_CONFIG = new core.InjectionToken("MSAL_INTERCEPTOR_CONFIG");
14
+ var MSAL_BROADCAST_CONFIG = new core.InjectionToken("MSAL_BROADCAST_CONFIG");
15
+
16
+ /* eslint-disable header/header */
17
+ var name = "@azure/msal-angular";
18
+ var version = "2.4.3";
19
+
20
+ /*
21
+ * Copyright (c) Microsoft Corporation. All rights reserved.
22
+ * Licensed under the MIT License.
23
+ */
24
+ var MsalService = /** @class */ (function () {
25
+ function MsalService(instance, location) {
26
+ this.instance = instance;
27
+ this.location = location;
28
+ var hash = this.location.path(true).split("#").pop();
29
+ if (hash) {
30
+ this.redirectHash = "#" + hash;
31
+ }
32
+ this.instance.initializeWrapperLibrary(msalBrowser.WrapperSKU.Angular, version);
33
+ }
34
+ MsalService.prototype.initialize = function () {
35
+ return rxjs.from(this.instance.initialize());
36
+ };
37
+ MsalService.prototype.acquireTokenPopup = function (request) {
38
+ return rxjs.from(this.instance.acquireTokenPopup(request));
39
+ };
40
+ MsalService.prototype.acquireTokenRedirect = function (request) {
41
+ return rxjs.from(this.instance.acquireTokenRedirect(request));
42
+ };
43
+ MsalService.prototype.acquireTokenSilent = function (silentRequest) {
44
+ return rxjs.from(this.instance.acquireTokenSilent(silentRequest));
45
+ };
46
+ MsalService.prototype.handleRedirectObservable = function (hash) {
47
+ return rxjs.from(this.instance.handleRedirectPromise(hash || this.redirectHash));
48
+ };
49
+ MsalService.prototype.loginPopup = function (request) {
50
+ return rxjs.from(this.instance.loginPopup(request));
51
+ };
52
+ MsalService.prototype.loginRedirect = function (request) {
53
+ return rxjs.from(this.instance.loginRedirect(request));
54
+ };
55
+ MsalService.prototype.logout = function (logoutRequest) {
56
+ return rxjs.from(this.instance.logout(logoutRequest));
57
+ };
58
+ MsalService.prototype.logoutRedirect = function (logoutRequest) {
59
+ return rxjs.from(this.instance.logoutRedirect(logoutRequest));
60
+ };
61
+ MsalService.prototype.logoutPopup = function (logoutRequest) {
62
+ return rxjs.from(this.instance.logoutPopup(logoutRequest));
63
+ };
64
+ MsalService.prototype.ssoSilent = function (request) {
65
+ return rxjs.from(this.instance.ssoSilent(request));
66
+ };
67
+ /**
68
+ * Gets logger for msal-angular.
69
+ * If no logger set, returns logger instance created with same options as msal-browser
70
+ */
71
+ MsalService.prototype.getLogger = function () {
72
+ if (!this.logger) {
73
+ this.logger = this.instance.getLogger().clone(name, version);
74
+ }
75
+ return this.logger;
76
+ };
77
+ // Create a logger instance for msal-angular with the same options as msal-browser
78
+ MsalService.prototype.setLogger = function (logger) {
79
+ this.logger = logger.clone(name, version);
80
+ this.instance.setLogger(logger);
81
+ };
82
+ return MsalService;
83
+ }());
84
+ MsalService.decorators = [
85
+ { type: core.Injectable }
86
+ ];
87
+ MsalService.ctorParameters = function () { return [
88
+ { type: undefined, decorators: [{ type: core.Inject, args: [MSAL_INSTANCE,] }] },
89
+ { type: common.Location }
90
+ ]; };
91
+
92
+ /*
93
+ * Copyright (c) Microsoft Corporation. All rights reserved.
94
+ * Licensed under the MIT License.
95
+ */
96
+ var MsalBroadcastService = /** @class */ (function () {
97
+ function MsalBroadcastService(msalInstance, authService, msalBroadcastConfig) {
98
+ var _this = this;
99
+ this.msalInstance = msalInstance;
100
+ this.authService = authService;
101
+ this.msalBroadcastConfig = msalBroadcastConfig;
102
+ // Make _msalSubject a ReplaySubject if configured to replay past events
103
+ if (this.msalBroadcastConfig && this.msalBroadcastConfig.eventsToReplay > 0) {
104
+ this.authService.getLogger().verbose("BroadcastService - replayPastEvents set on BroadcastConfig, replaying the last " + this.msalBroadcastConfig.eventsToReplay + " events");
105
+ this._msalSubject = new rxjs.ReplaySubject(this.msalBroadcastConfig.eventsToReplay);
106
+ }
107
+ else {
108
+ // Defaults to _msalSubject being a Subject
109
+ this._msalSubject = new rxjs.Subject();
110
+ }
111
+ this.msalSubject$ = this._msalSubject.asObservable();
112
+ // InProgress as BehaviorSubject so most recent inProgress state will be available upon subscription
113
+ this._inProgress = new rxjs.BehaviorSubject(msalBrowser.InteractionStatus.Startup);
114
+ this.inProgress$ = this._inProgress.asObservable();
115
+ this.msalInstance.addEventCallback(function (message) {
116
+ _this._msalSubject.next(message);
117
+ var status = msalBrowser.EventMessageUtils.getInteractionStatusFromEvent(message, _this._inProgress.value);
118
+ if (status !== null) {
119
+ _this.authService.getLogger().verbose("BroadcastService - " + message.eventType + " results in setting inProgress from " + _this._inProgress.value + " to " + status);
120
+ _this._inProgress.next(status);
121
+ }
122
+ });
123
+ }
124
+ return MsalBroadcastService;
125
+ }());
126
+ MsalBroadcastService.decorators = [
127
+ { type: core.Injectable }
128
+ ];
129
+ MsalBroadcastService.ctorParameters = function () { return [
130
+ { type: undefined, decorators: [{ type: core.Inject, args: [MSAL_INSTANCE,] }] },
131
+ { type: MsalService },
132
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MSAL_BROADCAST_CONFIG,] }] }
133
+ ]; };
134
+
135
+ /*
136
+ * Copyright (c) Microsoft Corporation. All rights reserved.
137
+ * Licensed under the MIT License.
138
+ */
139
+ var MsalGuard = /** @class */ (function () {
140
+ function MsalGuard(msalGuardConfig, msalBroadcastService, authService, location, router) {
141
+ this.msalGuardConfig = msalGuardConfig;
142
+ this.msalBroadcastService = msalBroadcastService;
143
+ this.authService = authService;
144
+ this.location = location;
145
+ this.router = router;
146
+ // Subscribing so events in MsalGuard will set inProgress$ observable
147
+ this.msalBroadcastService.inProgress$.subscribe();
148
+ }
149
+ /**
150
+ * Parses url string to UrlTree
151
+ * @param url
152
+ */
153
+ MsalGuard.prototype.parseUrl = function (url) {
154
+ return this.router.parseUrl(url);
155
+ };
156
+ /**
157
+ * Builds the absolute url for the destination page
158
+ * @param path Relative path of requested page
159
+ * @returns Full destination url
160
+ */
161
+ MsalGuard.prototype.getDestinationUrl = function (path) {
162
+ this.authService.getLogger().verbose("Guard - getting destination url");
163
+ // Absolute base url for the application (default to origin if base element not present)
164
+ var baseElements = document.getElementsByTagName("base");
165
+ var baseUrl = this.location.normalize(baseElements.length ? baseElements[0].href : window.location.origin);
166
+ // Path of page (including hash, if using hash routing)
167
+ var pathUrl = this.location.prepareExternalUrl(path);
168
+ // Hash location strategy
169
+ if (pathUrl.startsWith("#")) {
170
+ this.authService.getLogger().verbose("Guard - destination by hash routing");
171
+ return baseUrl + "/" + pathUrl;
172
+ }
173
+ /*
174
+ * If using path location strategy, pathUrl will include the relative portion of the base path (e.g. /base/page).
175
+ * Since baseUrl also includes /base, can just concatentate baseUrl + path
176
+ */
177
+ return "" + baseUrl + path;
178
+ };
179
+ /**
180
+ * Interactively prompt the user to login
181
+ * @param url Path of the requested page
182
+ */
183
+ MsalGuard.prototype.loginInteractively = function (state) {
184
+ var _this = this;
185
+ var authRequest = typeof this.msalGuardConfig.authRequest === "function"
186
+ ? this.msalGuardConfig.authRequest(this.authService, state)
187
+ : Object.assign({}, this.msalGuardConfig.authRequest);
188
+ if (this.msalGuardConfig.interactionType === msalBrowser.InteractionType.Popup) {
189
+ this.authService.getLogger().verbose("Guard - logging in by popup");
190
+ return this.authService.loginPopup(authRequest)
191
+ .pipe(operators.map(function (response) {
192
+ _this.authService.getLogger().verbose("Guard - login by popup successful, can activate, setting active account");
193
+ _this.authService.instance.setActiveAccount(response.account);
194
+ return true;
195
+ }));
196
+ }
197
+ this.authService.getLogger().verbose("Guard - logging in by redirect");
198
+ var redirectStartPage = this.getDestinationUrl(state.url);
199
+ return this.authService.loginRedirect(Object.assign({ redirectStartPage: redirectStartPage }, authRequest))
200
+ .pipe(operators.map(function () { return false; }));
201
+ };
202
+ /**
203
+ * Helper which checks for the correct interaction type, prevents page with Guard to be set as reidrect, and calls handleRedirectObservable
204
+ * @param state
205
+ */
206
+ MsalGuard.prototype.activateHelper = function (state) {
207
+ var _this = this;
208
+ if (this.msalGuardConfig.interactionType !== msalBrowser.InteractionType.Popup && this.msalGuardConfig.interactionType !== msalBrowser.InteractionType.Redirect) {
209
+ throw new msalBrowser.BrowserConfigurationAuthError("invalid_interaction_type", "Invalid interaction type provided to MSAL Guard. InteractionType.Popup or InteractionType.Redirect must be provided in the MsalGuardConfiguration");
210
+ }
211
+ this.authService.getLogger().verbose("MSAL Guard activated");
212
+ /*
213
+ * If a page with MSAL Guard is set as the redirect for acquireTokenSilent,
214
+ * short-circuit to prevent redirecting or popups.
215
+ */
216
+ if (typeof window !== "undefined") {
217
+ if (msalBrowser.UrlString.hashContainsKnownProperties(window.location.hash) && msalBrowser.BrowserUtils.isInIframe() && !this.authService.instance.getConfiguration().system.allowRedirectInIframe) {
218
+ this.authService.getLogger().warning("Guard - redirectUri set to page with MSAL Guard. It is recommended to not set redirectUri to a page that requires authentication.");
219
+ return rxjs.of(false);
220
+ }
221
+ }
222
+ else {
223
+ this.authService.getLogger().info("Guard - window is undefined, MSAL does not support server-side token acquisition");
224
+ return rxjs.of(true);
225
+ }
226
+ /**
227
+ * If a loginFailedRoute is set in the config, set this as the loginFailedRoute
228
+ */
229
+ if (this.msalGuardConfig.loginFailedRoute) {
230
+ this.loginFailedRoute = this.parseUrl(this.msalGuardConfig.loginFailedRoute);
231
+ }
232
+ // Capture current path before it gets changed by handleRedirectObservable
233
+ var currentPath = this.location.path(true);
234
+ return this.authService.handleRedirectObservable()
235
+ .pipe(operators.concatMap(function () {
236
+ if (!_this.authService.instance.getAllAccounts().length) {
237
+ if (state) {
238
+ _this.authService.getLogger().verbose("Guard - no accounts retrieved, log in required to activate");
239
+ return _this.loginInteractively(state);
240
+ }
241
+ _this.authService.getLogger().verbose("Guard - no accounts retrieved, no state, cannot load");
242
+ return rxjs.of(false);
243
+ }
244
+ _this.authService.getLogger().verbose("Guard - at least 1 account exists, can activate or load");
245
+ // Prevent navigating the app to /#code= or /code=
246
+ if (state) {
247
+ /*
248
+ * Path routing:
249
+ * state.url: /#code=...
250
+ * state.root.fragment: code=...
251
+ */
252
+ /*
253
+ * Hash routing:
254
+ * state.url: /code
255
+ * state.root.fragment: null
256
+ */
257
+ var urlContainsCode = _this.includesCode(state.url);
258
+ var fragmentContainsCode = !!state.root && !!state.root.fragment && _this.includesCode("#" + state.root.fragment);
259
+ var hashRouting = _this.location.prepareExternalUrl(state.url).indexOf("#") === 0;
260
+ // Ensure code parameter is in fragment (and not in query parameter), or that hash hash routing is used
261
+ if (urlContainsCode && (fragmentContainsCode || hashRouting)) {
262
+ _this.authService.getLogger().info("Guard - Hash contains known code response, stopping navigation.");
263
+ // Path routing (navigate to current path without hash)
264
+ if (currentPath.indexOf("#") > -1) {
265
+ return rxjs.of(_this.parseUrl(_this.location.path()));
266
+ }
267
+ // Hash routing (navigate to root path)
268
+ return rxjs.of(_this.parseUrl(""));
269
+ }
270
+ }
271
+ return rxjs.of(true);
272
+ }), operators.catchError(function (error) {
273
+ _this.authService.getLogger().error("Guard - error while logging in, unable to activate");
274
+ _this.authService.getLogger().errorPii("Guard - error: " + error.message);
275
+ /**
276
+ * If a loginFailedRoute is set, checks to see if Angular 10+ is used and state is passed in before returning route
277
+ * Apps using Angular 9 will receive of(false) in canLoad interface, as it does not support UrlTree return types
278
+ */
279
+ if (_this.loginFailedRoute && parseInt(core.VERSION.major, 10) > 9 && state) {
280
+ _this.authService.getLogger().verbose("Guard - loginFailedRoute set, redirecting");
281
+ return rxjs.of(_this.loginFailedRoute);
282
+ }
283
+ return rxjs.of(false);
284
+ }));
285
+ };
286
+ MsalGuard.prototype.includesCode = function (path) {
287
+ return (path.lastIndexOf("/code") > -1 &&
288
+ path.lastIndexOf("/code") === path.length - "/code".length) || // path.endsWith("/code")
289
+ path.indexOf("#code=") > -1 ||
290
+ path.indexOf("&code=") > -1;
291
+ };
292
+ MsalGuard.prototype.canActivate = function (route, state) {
293
+ this.authService.getLogger().verbose("Guard - canActivate");
294
+ return this.activateHelper(state);
295
+ };
296
+ MsalGuard.prototype.canActivateChild = function (route, state) {
297
+ this.authService.getLogger().verbose("Guard - canActivateChild");
298
+ return this.activateHelper(state);
299
+ };
300
+ MsalGuard.prototype.canLoad = function () {
301
+ this.authService.getLogger().verbose("Guard - canLoad");
302
+ // @ts-ignore
303
+ return this.activateHelper();
304
+ };
305
+ return MsalGuard;
306
+ }());
307
+ MsalGuard.decorators = [
308
+ { type: core.Injectable }
309
+ ];
310
+ MsalGuard.ctorParameters = function () { return [
311
+ { type: undefined, decorators: [{ type: core.Inject, args: [MSAL_GUARD_CONFIG,] }] },
312
+ { type: MsalBroadcastService },
313
+ { type: MsalService },
314
+ { type: common.Location },
315
+ { type: router.Router }
316
+ ]; };
317
+
318
+ /*
319
+ * Copyright (c) Microsoft Corporation. All rights reserved.
320
+ * Licensed under the MIT License.
321
+ */
322
+ var MsalInterceptor = /** @class */ (function () {
323
+ function MsalInterceptor(msalInterceptorConfig, authService, location,
324
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
325
+ document) {
326
+ this.msalInterceptorConfig = msalInterceptorConfig;
327
+ this.authService = authService;
328
+ this.location = location;
329
+ this._document = document;
330
+ }
331
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
332
+ MsalInterceptor.prototype.intercept = function (req, next) {
333
+ var _this = this;
334
+ if (this.msalInterceptorConfig.interactionType !== msalBrowser.InteractionType.Popup && this.msalInterceptorConfig.interactionType !== msalBrowser.InteractionType.Redirect) {
335
+ throw new msalBrowser.BrowserConfigurationAuthError("invalid_interaction_type", "Invalid interaction type provided to MSAL Interceptor. InteractionType.Popup, InteractionType.Redirect must be provided in the msalInterceptorConfiguration");
336
+ }
337
+ this.authService.getLogger().verbose("MSAL Interceptor activated");
338
+ var scopes = this.getScopesForEndpoint(req.url, req.method);
339
+ // If no scopes for endpoint, does not acquire token
340
+ if (!scopes || scopes.length === 0) {
341
+ this.authService.getLogger().verbose("Interceptor - no scopes for endpoint");
342
+ return next.handle(req);
343
+ }
344
+ // Sets account as active account or first account
345
+ var account;
346
+ if (!!this.authService.instance.getActiveAccount()) {
347
+ this.authService.getLogger().verbose("Interceptor - active account selected");
348
+ account = this.authService.instance.getActiveAccount();
349
+ }
350
+ else {
351
+ this.authService.getLogger().verbose("Interceptor - no active account, fallback to first account");
352
+ account = this.authService.instance.getAllAccounts()[0];
353
+ }
354
+ var authRequest = typeof this.msalInterceptorConfig.authRequest === "function"
355
+ ? this.msalInterceptorConfig.authRequest(this.authService, req, { account: account })
356
+ : Object.assign(Object.assign({}, this.msalInterceptorConfig.authRequest), { account: account });
357
+ this.authService.getLogger().info("Interceptor - " + scopes.length + " scopes found for endpoint");
358
+ this.authService.getLogger().infoPii("Interceptor - [" + scopes + "] scopes found for " + req.url);
359
+ // Note: For MSA accounts, include openid scope when calling acquireTokenSilent to return idToken
360
+ return this.authService.acquireTokenSilent(Object.assign(Object.assign({}, authRequest), { scopes: scopes, account: account }))
361
+ .pipe(operators.catchError(function () {
362
+ _this.authService.getLogger().error("Interceptor - acquireTokenSilent rejected with error. Invoking interaction to resolve.");
363
+ return _this.acquireTokenInteractively(authRequest, scopes);
364
+ }), operators.switchMap(function (result) {
365
+ if (!result.accessToken) {
366
+ _this.authService.getLogger().error("Interceptor - acquireTokenSilent resolved with null access token. Known issue with B2C tenants, invoking interaction to resolve.");
367
+ return _this.acquireTokenInteractively(authRequest, scopes);
368
+ }
369
+ return rxjs.of(result);
370
+ }), operators.switchMap(function (result) {
371
+ _this.authService.getLogger().verbose("Interceptor - setting authorization headers");
372
+ var headers = req.headers
373
+ .set("Authorization", "Bearer " + result.accessToken);
374
+ var requestClone = req.clone({ headers: headers });
375
+ return next.handle(requestClone);
376
+ }));
377
+ };
378
+ /**
379
+ * Invoke interaction for the given set of scopes
380
+ * @param authRequest Request
381
+ * @param scopes Array of scopes for the request
382
+ * @returns Result from the interactive request
383
+ */
384
+ MsalInterceptor.prototype.acquireTokenInteractively = function (authRequest, scopes) {
385
+ if (this.msalInterceptorConfig.interactionType === msalBrowser.InteractionType.Popup) {
386
+ this.authService.getLogger().verbose("Interceptor - error acquiring token silently, acquiring by popup");
387
+ return this.authService.acquireTokenPopup(Object.assign(Object.assign({}, authRequest), { scopes: scopes }));
388
+ }
389
+ this.authService.getLogger().verbose("Interceptor - error acquiring token silently, acquiring by redirect");
390
+ var redirectStartPage = window.location.href;
391
+ this.authService.acquireTokenRedirect(Object.assign(Object.assign({}, authRequest), { scopes: scopes, redirectStartPage: redirectStartPage }));
392
+ return rxjs.EMPTY;
393
+ };
394
+ /**
395
+ * Looks up the scopes for the given endpoint from the protectedResourceMap
396
+ * @param endpoint Url of the request
397
+ * @param httpMethod Http method of the request
398
+ * @returns Array of scopes, or null if not found
399
+ *
400
+ */
401
+ MsalInterceptor.prototype.getScopesForEndpoint = function (endpoint, httpMethod) {
402
+ this.authService.getLogger().verbose("Interceptor - getting scopes for endpoint");
403
+ // Ensures endpoints and protected resources compared are normalized
404
+ var normalizedEndpoint = this.location.normalize(endpoint);
405
+ var protectedResourcesArray = Array.from(this.msalInterceptorConfig.protectedResourceMap.keys());
406
+ var matchingProtectedResources = this.matchResourcesToEndpoint(protectedResourcesArray, normalizedEndpoint);
407
+ // Check absolute urls of resources first before checking relative to prevent incorrect matching where multiple resources have similar relative urls
408
+ if (matchingProtectedResources.absoluteResources.length > 0) {
409
+ return this.matchScopesToEndpoint(this.msalInterceptorConfig.protectedResourceMap, matchingProtectedResources.absoluteResources, httpMethod);
410
+ }
411
+ else if (matchingProtectedResources.relativeResources.length > 0) {
412
+ return this.matchScopesToEndpoint(this.msalInterceptorConfig.protectedResourceMap, matchingProtectedResources.relativeResources, httpMethod);
413
+ }
414
+ return null;
415
+ };
416
+ /**
417
+ * Finds resource endpoints that match request endpoint
418
+ * @param protectedResourcesEndpoints
419
+ * @param endpoint
420
+ * @returns
421
+ */
422
+ MsalInterceptor.prototype.matchResourcesToEndpoint = function (protectedResourcesEndpoints, endpoint) {
423
+ var _this = this;
424
+ var matchingResources = { absoluteResources: [], relativeResources: [] };
425
+ protectedResourcesEndpoints.forEach(function (key) {
426
+ // Normalizes and adds resource to matchingResources.absoluteResources if key matches endpoint. StringUtils.matchPattern accounts for wildcards
427
+ var normalizedKey = _this.location.normalize(key);
428
+ if (msalBrowser.StringUtils.matchPattern(normalizedKey, endpoint)) {
429
+ matchingResources.absoluteResources.push(key);
430
+ }
431
+ // Get url components for relative urls
432
+ var absoluteKey = _this.getAbsoluteUrl(key);
433
+ var keyComponents = new msalBrowser.UrlString(absoluteKey).getUrlComponents();
434
+ var absoluteEndpoint = _this.getAbsoluteUrl(endpoint);
435
+ var endpointComponents = new msalBrowser.UrlString(absoluteEndpoint).getUrlComponents();
436
+ // Normalized key should include query strings if applicable
437
+ var relativeNormalizedKey = keyComponents.QueryString ? keyComponents.AbsolutePath + "?" + keyComponents.QueryString : _this.location.normalize(keyComponents.AbsolutePath);
438
+ // Add resource to matchingResources.relativeResources if same origin, relativeKey matches endpoint, and is not empty
439
+ if (keyComponents.HostNameAndPort === endpointComponents.HostNameAndPort && msalBrowser.StringUtils.matchPattern(relativeNormalizedKey, absoluteEndpoint) && relativeNormalizedKey !== "" && relativeNormalizedKey !== "/*") {
440
+ matchingResources.relativeResources.push(key);
441
+ }
442
+ });
443
+ return matchingResources;
444
+ };
445
+ /**
446
+ * Transforms relative urls to absolute urls
447
+ * @param url
448
+ * @returns
449
+ */
450
+ MsalInterceptor.prototype.getAbsoluteUrl = function (url) {
451
+ var link = this._document.createElement("a");
452
+ link.href = url;
453
+ return link.href;
454
+ };
455
+ /**
456
+ * Finds scopes from first matching endpoint with HTTP method that matches request
457
+ * @param protectedResourceMap Protected resource map
458
+ * @param endpointArray Array of resources that match request endpoint
459
+ * @param httpMethod Http method of the request
460
+ * @returns
461
+ */
462
+ MsalInterceptor.prototype.matchScopesToEndpoint = function (protectedResourceMap, endpointArray, httpMethod) {
463
+ var allMatchedScopes = [];
464
+ // Check each matched endpoint for matching HttpMethod and scopes
465
+ endpointArray.forEach(function (matchedEndpoint) {
466
+ var scopesForEndpoint = [];
467
+ var methodAndScopesArray = protectedResourceMap.get(matchedEndpoint);
468
+ // Return if resource is unprotected
469
+ if (methodAndScopesArray === null) {
470
+ allMatchedScopes.push(null);
471
+ return;
472
+ }
473
+ methodAndScopesArray.forEach(function (entry) {
474
+ // Entry is either array of scopes or ProtectedResourceScopes object
475
+ if (typeof entry === "string") {
476
+ scopesForEndpoint.push(entry);
477
+ }
478
+ else {
479
+ // Ensure methods being compared are normalized
480
+ var normalizedRequestMethod = httpMethod.toLowerCase();
481
+ var normalizedResourceMethod = entry.httpMethod.toLowerCase();
482
+ // Method in protectedResourceMap matches request http method
483
+ if (normalizedResourceMethod === normalizedRequestMethod) {
484
+ // Validate if scopes comes null to unprotect the resource in a certain http method
485
+ if (entry.scopes === null) {
486
+ allMatchedScopes.push(null);
487
+ }
488
+ else {
489
+ entry.scopes.forEach(function (scope) {
490
+ scopesForEndpoint.push(scope);
491
+ });
492
+ }
493
+ }
494
+ }
495
+ });
496
+ // Only add to all scopes if scopes for endpoint and method is found
497
+ if (scopesForEndpoint.length > 0) {
498
+ allMatchedScopes.push(scopesForEndpoint);
499
+ }
500
+ });
501
+ if (allMatchedScopes.length > 0) {
502
+ if (allMatchedScopes.length > 1) {
503
+ this.authService.getLogger().warning("Interceptor - More than 1 matching scopes for endpoint found.");
504
+ }
505
+ // Returns scopes for first matching endpoint
506
+ return allMatchedScopes[0];
507
+ }
508
+ return null;
509
+ };
510
+ return MsalInterceptor;
511
+ }());
512
+ MsalInterceptor.decorators = [
513
+ { type: core.Injectable }
514
+ ];
515
+ MsalInterceptor.ctorParameters = function () { return [
516
+ { type: undefined, decorators: [{ type: core.Inject, args: [MSAL_INTERCEPTOR_CONFIG,] }] },
517
+ { type: MsalService },
518
+ { type: common.Location },
519
+ { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
520
+ ]; };
521
+
522
+ /*
523
+ * Copyright (c) Microsoft Corporation. All rights reserved.
524
+ * Licensed under the MIT License.
525
+ */
526
+ var MsalRedirectComponent = /** @class */ (function () {
527
+ function MsalRedirectComponent(authService) {
528
+ this.authService = authService;
529
+ }
530
+ MsalRedirectComponent.prototype.ngOnInit = function () {
531
+ var _this = this;
532
+ this.authService.getLogger().verbose("MsalRedirectComponent activated");
533
+ this.authService.initialize().pipe(operators.concatMap(function () {
534
+ return _this.authService.handleRedirectObservable();
535
+ })).subscribe();
536
+ };
537
+ return MsalRedirectComponent;
538
+ }());
539
+ MsalRedirectComponent.decorators = [
540
+ { type: core.Component, args: [{
541
+ selector: "app-redirect",
542
+ template: ""
543
+ },] }
544
+ ];
545
+ MsalRedirectComponent.ctorParameters = function () { return [
546
+ { type: MsalService }
547
+ ]; };
548
+
549
+ /*
550
+ * Copyright (c) Microsoft Corporation. All rights reserved.
551
+ * Licensed under the MIT License.
552
+ */
553
+ var MsalModule = /** @class */ (function () {
554
+ function MsalModule() {
555
+ }
556
+ MsalModule.forRoot = function (msalInstance, guardConfig, interceptorConfig) {
557
+ return {
558
+ ngModule: MsalModule,
559
+ providers: [
560
+ {
561
+ provide: MSAL_INSTANCE,
562
+ useValue: msalInstance
563
+ },
564
+ {
565
+ provide: MSAL_GUARD_CONFIG,
566
+ useValue: guardConfig
567
+ },
568
+ {
569
+ provide: MSAL_INTERCEPTOR_CONFIG,
570
+ useValue: interceptorConfig
571
+ },
572
+ MsalService
573
+ ]
574
+ };
575
+ };
576
+ return MsalModule;
577
+ }());
578
+ MsalModule.decorators = [
579
+ { type: core.NgModule, args: [{
580
+ declarations: [MsalRedirectComponent],
581
+ imports: [
582
+ common.CommonModule
583
+ ],
584
+ providers: [
585
+ MsalGuard,
586
+ MsalBroadcastService
587
+ ]
588
+ },] }
589
+ ];
590
+
591
+ /******************************************************************************
592
+ Copyright (c) Microsoft Corporation.
593
+
594
+ Permission to use, copy, modify, and/or distribute this software for any
595
+ purpose with or without fee is hereby granted.
596
+
597
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
598
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
599
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
600
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
601
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
602
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
603
+ PERFORMANCE OF THIS SOFTWARE.
604
+ ***************************************************************************** */
605
+ /* global Reflect, Promise */
606
+ var extendStatics = function (d, b) {
607
+ extendStatics = Object.setPrototypeOf ||
608
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
609
+ function (d, b) { for (var p in b)
610
+ if (Object.prototype.hasOwnProperty.call(b, p))
611
+ d[p] = b[p]; };
612
+ return extendStatics(d, b);
613
+ };
614
+ function __extends(d, b) {
615
+ if (typeof b !== "function" && b !== null)
616
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
617
+ extendStatics(d, b);
618
+ function __() { this.constructor = d; }
619
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
620
+ }
621
+ var __assign = function () {
622
+ __assign = Object.assign || function __assign(t) {
623
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
624
+ s = arguments[i];
625
+ for (var p in s)
626
+ if (Object.prototype.hasOwnProperty.call(s, p))
627
+ t[p] = s[p];
628
+ }
629
+ return t;
630
+ };
631
+ return __assign.apply(this, arguments);
632
+ };
633
+ function __rest(s, e) {
634
+ var t = {};
635
+ for (var p in s)
636
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
637
+ t[p] = s[p];
638
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
639
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
640
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
641
+ t[p[i]] = s[p[i]];
642
+ }
643
+ return t;
644
+ }
645
+ function __decorate(decorators, target, key, desc) {
646
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
647
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
648
+ r = Reflect.decorate(decorators, target, key, desc);
649
+ else
650
+ for (var i = decorators.length - 1; i >= 0; i--)
651
+ if (d = decorators[i])
652
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
653
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
654
+ }
655
+ function __param(paramIndex, decorator) {
656
+ return function (target, key) { decorator(target, key, paramIndex); };
657
+ }
658
+ function __metadata(metadataKey, metadataValue) {
659
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
660
+ return Reflect.metadata(metadataKey, metadataValue);
661
+ }
662
+ function __awaiter(thisArg, _arguments, P, generator) {
663
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
664
+ return new (P || (P = Promise))(function (resolve, reject) {
665
+ function fulfilled(value) { try {
666
+ step(generator.next(value));
667
+ }
668
+ catch (e) {
669
+ reject(e);
670
+ } }
671
+ function rejected(value) { try {
672
+ step(generator["throw"](value));
673
+ }
674
+ catch (e) {
675
+ reject(e);
676
+ } }
677
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
678
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
679
+ });
680
+ }
681
+ function __generator(thisArg, body) {
682
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
683
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
684
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
685
+ function verb(n) { return function (v) { return step([n, v]); }; }
686
+ function step(op) {
687
+ if (f)
688
+ throw new TypeError("Generator is already executing.");
689
+ while (_)
690
+ try {
691
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
692
+ return t;
693
+ if (y = 0, t)
694
+ op = [op[0] & 2, t.value];
695
+ switch (op[0]) {
696
+ case 0:
697
+ case 1:
698
+ t = op;
699
+ break;
700
+ case 4:
701
+ _.label++;
702
+ return { value: op[1], done: false };
703
+ case 5:
704
+ _.label++;
705
+ y = op[1];
706
+ op = [0];
707
+ continue;
708
+ case 7:
709
+ op = _.ops.pop();
710
+ _.trys.pop();
711
+ continue;
712
+ default:
713
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
714
+ _ = 0;
715
+ continue;
716
+ }
717
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
718
+ _.label = op[1];
719
+ break;
720
+ }
721
+ if (op[0] === 6 && _.label < t[1]) {
722
+ _.label = t[1];
723
+ t = op;
724
+ break;
725
+ }
726
+ if (t && _.label < t[2]) {
727
+ _.label = t[2];
728
+ _.ops.push(op);
729
+ break;
730
+ }
731
+ if (t[2])
732
+ _.ops.pop();
733
+ _.trys.pop();
734
+ continue;
735
+ }
736
+ op = body.call(thisArg, _);
737
+ }
738
+ catch (e) {
739
+ op = [6, e];
740
+ y = 0;
741
+ }
742
+ finally {
743
+ f = t = 0;
744
+ }
745
+ if (op[0] & 5)
746
+ throw op[1];
747
+ return { value: op[0] ? op[1] : void 0, done: true };
748
+ }
749
+ }
750
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
751
+ if (k2 === undefined)
752
+ k2 = k;
753
+ var desc = Object.getOwnPropertyDescriptor(m, k);
754
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
755
+ desc = { enumerable: true, get: function () { return m[k]; } };
756
+ }
757
+ Object.defineProperty(o, k2, desc);
758
+ }) : (function (o, m, k, k2) {
759
+ if (k2 === undefined)
760
+ k2 = k;
761
+ o[k2] = m[k];
762
+ });
763
+ function __exportStar(m, o) {
764
+ for (var p in m)
765
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
766
+ __createBinding(o, m, p);
767
+ }
768
+ function __values(o) {
769
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
770
+ if (m)
771
+ return m.call(o);
772
+ if (o && typeof o.length === "number")
773
+ return {
774
+ next: function () {
775
+ if (o && i >= o.length)
776
+ o = void 0;
777
+ return { value: o && o[i++], done: !o };
778
+ }
779
+ };
780
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
781
+ }
782
+ function __read(o, n) {
783
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
784
+ if (!m)
785
+ return o;
786
+ var i = m.call(o), r, ar = [], e;
787
+ try {
788
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
789
+ ar.push(r.value);
790
+ }
791
+ catch (error) {
792
+ e = { error: error };
793
+ }
794
+ finally {
795
+ try {
796
+ if (r && !r.done && (m = i["return"]))
797
+ m.call(i);
798
+ }
799
+ finally {
800
+ if (e)
801
+ throw e.error;
802
+ }
803
+ }
804
+ return ar;
805
+ }
806
+ /** @deprecated */
807
+ function __spread() {
808
+ for (var ar = [], i = 0; i < arguments.length; i++)
809
+ ar = ar.concat(__read(arguments[i]));
810
+ return ar;
811
+ }
812
+ /** @deprecated */
813
+ function __spreadArrays() {
814
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
815
+ s += arguments[i].length;
816
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
817
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
818
+ r[k] = a[j];
819
+ return r;
820
+ }
821
+ function __spreadArray(to, from, pack) {
822
+ if (pack || arguments.length === 2)
823
+ for (var i = 0, l = from.length, ar; i < l; i++) {
824
+ if (ar || !(i in from)) {
825
+ if (!ar)
826
+ ar = Array.prototype.slice.call(from, 0, i);
827
+ ar[i] = from[i];
828
+ }
829
+ }
830
+ return to.concat(ar || Array.prototype.slice.call(from));
831
+ }
832
+ function __await(v) {
833
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
834
+ }
835
+ function __asyncGenerator(thisArg, _arguments, generator) {
836
+ if (!Symbol.asyncIterator)
837
+ throw new TypeError("Symbol.asyncIterator is not defined.");
838
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
839
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
840
+ function verb(n) { if (g[n])
841
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
842
+ function resume(n, v) { try {
843
+ step(g[n](v));
844
+ }
845
+ catch (e) {
846
+ settle(q[0][3], e);
847
+ } }
848
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
849
+ function fulfill(value) { resume("next", value); }
850
+ function reject(value) { resume("throw", value); }
851
+ function settle(f, v) { if (f(v), q.shift(), q.length)
852
+ resume(q[0][0], q[0][1]); }
853
+ }
854
+ function __asyncDelegator(o) {
855
+ var i, p;
856
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
857
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
858
+ }
859
+ function __asyncValues(o) {
860
+ if (!Symbol.asyncIterator)
861
+ throw new TypeError("Symbol.asyncIterator is not defined.");
862
+ var m = o[Symbol.asyncIterator], i;
863
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
864
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
865
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
866
+ }
867
+ function __makeTemplateObject(cooked, raw) {
868
+ if (Object.defineProperty) {
869
+ Object.defineProperty(cooked, "raw", { value: raw });
870
+ }
871
+ else {
872
+ cooked.raw = raw;
873
+ }
874
+ return cooked;
875
+ }
876
+ ;
877
+ var __setModuleDefault = Object.create ? (function (o, v) {
878
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
879
+ }) : function (o, v) {
880
+ o["default"] = v;
881
+ };
882
+ function __importStar(mod) {
883
+ if (mod && mod.__esModule)
884
+ return mod;
885
+ var result = {};
886
+ if (mod != null)
887
+ for (var k in mod)
888
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
889
+ __createBinding(result, mod, k);
890
+ __setModuleDefault(result, mod);
891
+ return result;
892
+ }
893
+ function __importDefault(mod) {
894
+ return (mod && mod.__esModule) ? mod : { default: mod };
895
+ }
896
+ function __classPrivateFieldGet(receiver, state, kind, f) {
897
+ if (kind === "a" && !f)
898
+ throw new TypeError("Private accessor was defined without a getter");
899
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
900
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
901
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
902
+ }
903
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
904
+ if (kind === "m")
905
+ throw new TypeError("Private method is not writable");
906
+ if (kind === "a" && !f)
907
+ throw new TypeError("Private accessor was defined without a setter");
908
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
909
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
910
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
911
+ }
912
+ function __classPrivateFieldIn(state, receiver) {
913
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
914
+ throw new TypeError("Cannot use 'in' operator on non-object");
915
+ return typeof state === "function" ? receiver === state : state.has(receiver);
916
+ }
917
+
918
+ /**
919
+ * Custom navigation used for Angular client-side navigation.
920
+ * See performance doc for details:
921
+ * https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/v2-docs/performance.md
922
+ */
923
+ var MsalCustomNavigationClient = /** @class */ (function (_super_1) {
924
+ __extends(MsalCustomNavigationClient, _super_1);
925
+ function MsalCustomNavigationClient(authService, router, location) {
926
+ var _this = _super_1.call(this) || this;
927
+ _this.authService = authService;
928
+ _this.router = router;
929
+ _this.location = location;
930
+ return _this;
931
+ }
932
+ MsalCustomNavigationClient.prototype.navigateInternal = function (url, options) {
933
+ var _super = Object.create(null, {
934
+ navigateInternal: { get: function () { return _super_1.prototype.navigateInternal; } }
935
+ });
936
+ return __awaiter(this, void 0, void 0, function () {
937
+ var urlComponents, newUrl;
938
+ return __generator(this, function (_a) {
939
+ this.authService.getLogger().trace("MsalCustomNavigationClient called");
940
+ this.authService.getLogger().verbose("MsalCustomNavigationClient - navigating");
941
+ this.authService.getLogger().verbosePii("MsalCustomNavigationClient - navigating to url: " + url);
942
+ // Prevent hash clearing from causing an issue with Client-side navigation after redirect is handled
943
+ if (options.noHistory) {
944
+ return [2 /*return*/, _super.navigateInternal.call(this, url, options)];
945
+ }
946
+ else {
947
+ urlComponents = new msalBrowser.UrlString(url).getUrlComponents();
948
+ newUrl = urlComponents.QueryString ? urlComponents.AbsolutePath + "?" + urlComponents.QueryString : this.location.normalize(urlComponents.AbsolutePath);
949
+ this.router.navigateByUrl(newUrl, { replaceUrl: options.noHistory });
950
+ }
951
+ return [2 /*return*/, Promise.resolve(options.noHistory)];
952
+ });
953
+ });
954
+ };
955
+ return MsalCustomNavigationClient;
956
+ }(msalBrowser.NavigationClient));
957
+ MsalCustomNavigationClient.decorators = [
958
+ { type: core.Injectable }
959
+ ];
960
+ MsalCustomNavigationClient.ctorParameters = function () { return [
961
+ { type: MsalService },
962
+ { type: router.Router },
963
+ { type: common.Location }
964
+ ]; };
965
+
966
+ /*
967
+ * Copyright (c) Microsoft Corporation. All rights reserved.
968
+ * Licensed under the MIT License.
969
+ */
970
+
971
+ /**
972
+ * Generated bundle index. Do not edit.
973
+ */
974
+
975
+ exports.MSAL_BROADCAST_CONFIG = MSAL_BROADCAST_CONFIG;
976
+ exports.MSAL_GUARD_CONFIG = MSAL_GUARD_CONFIG;
977
+ exports.MSAL_INSTANCE = MSAL_INSTANCE;
978
+ exports.MSAL_INTERCEPTOR_CONFIG = MSAL_INTERCEPTOR_CONFIG;
979
+ exports.MsalBroadcastService = MsalBroadcastService;
980
+ exports.MsalCustomNavigationClient = MsalCustomNavigationClient;
981
+ exports.MsalGuard = MsalGuard;
982
+ exports.MsalInterceptor = MsalInterceptor;
983
+ exports.MsalModule = MsalModule;
984
+ exports.MsalRedirectComponent = MsalRedirectComponent;
985
+ exports.MsalService = MsalService;
986
+ exports.version = version;
987
+
988
+ Object.defineProperty(exports, '__esModule', { value: true });
989
+
990
+ })));
991
+ //# sourceMappingURL=azure-msal-angular.umd.js.map