@azure/msal-angular 2.0.0 → 2.0.4

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/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Microsoft Authentication Library for Angular
2
2
 
3
- ![npm (scoped)](https://img.shields.io/npm/v/@azure/msal-angular)![npm](https://img.shields.io/npm/dw/@azure/msal-angular)
3
+ ![npm (scoped)](https://img.shields.io/npm/v/@azure/msal-angular)
4
+ ![npm](https://img.shields.io/npm/dw/@azure/msal-angular)
5
+ [![codecov](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js/branch/dev/graph/badge.svg?flag=msal-angular)](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js)
4
6
 
5
7
  | <a href="https://docs.microsoft.com/azure/active-directory/develop/tutorial-v2-angular-auth-code" target="blank">Getting Started</a>| <a href="https://aka.ms/aaddevv2" target="_blank">AAD Docs</a> | <a href="https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_angular.html" target="_blank">Library Reference</a> | [Support](README.md#community-help-and-support) | <a href="https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-v2-samples" target="blank">Samples</a>
6
8
  | --- | --- | --- | --- | --- |
@@ -8,6 +10,7 @@
8
10
  1. [About](#about)
9
11
  1. [Guides](#guides)
10
12
  1. [FAQ](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/FAQ.md)
13
+ 1. [Changelog](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/CHANGELOG.md)
11
14
  1. [Version Support](#version-support)
12
15
  1. [Prerequisites](#prerequisites)
13
16
  1. [Installation](#installation)
@@ -68,7 +71,6 @@ MSAL Angular Basics
68
71
 
69
72
  Advanced Topics
70
73
  1. [Logging](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/v2-docs/logging.md)
71
- 1. [CORS API](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/v2-docs/cors-api.md)
72
74
  1. [Multi-Tenant](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/multi-tenant.md)
73
75
  1. [Security](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/security.md)
74
76
  1. [Internet Explorer Support](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/v2-docs/ie-support.md)
@@ -100,8 +102,10 @@ See [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/bl
100
102
  ### Advanced MSAL Angular v2 Samples
101
103
  * [Angular SPA with ASP.NET Core web API](https://github.com/Azure-Samples/ms-identity-javascript-angular-tutorial/tree/main/3-Authorization-II/1-call-api)
102
104
  * [Angular SPA with APS.NET Core web API using App Roles and RBAC](https://github.com/Azure-Samples/ms-identity-javascript-angular-tutorial/tree/main/5-AccessControl/1-call-api-roles)
105
+ * [Angular SPA calling Microsoft Graph via ASP.NET Core web API using on-behalf-of flow](https://github.com/Azure-Samples/ms-identity-javascript-angular-tutorial/tree/main/7-AdvancedScenarios/1-call-api-obo)
106
+ * [Angular SPA calling ASP.NET Core Web API using Proof of Possession tokens](https://github.com/Azure-Samples/ms-identity-javascript-angular-tutorial/tree/main/7-AdvancedScenarios/2-call-api-pop)
103
107
  * [Multi-tenant tutorial using MSAL Angular v2](https://github.com/Azure-Samples/ms-identity-javascript-angular-tutorial/tree/main/6-Multitenancy/1-call-api-mt)
104
-
108
+ * [Deployment tutorial using Azure App Service and Azure Storage](https://github.com/Azure-Samples/ms-identity-javascript-angular-tutorial/tree/main/4-Deployment)
105
109
 
106
110
  ## Build and running tests
107
111
 
@@ -1 +1 @@
1
- {"__symbolic":"module","version":4,"metadata":{"MsalService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":24,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":30,"character":9},"arguments":[{"__symbolic":"reference","name":"MSAL_INSTANCE"}]}],null],"parameters":[{"__symbolic":"reference","module":"@azure/msal-browser","name":"IPublicClientApplication","line":30,"character":48},{"__symbolic":"reference","module":"@angular/common","name":"Location","line":31,"character":26}]}],"acquireTokenPopup":[{"__symbolic":"method"}],"acquireTokenRedirect":[{"__symbolic":"method"}],"acquireTokenSilent":[{"__symbolic":"method"}],"handleRedirectObservable":[{"__symbolic":"method"}],"loginPopup":[{"__symbolic":"method"}],"loginRedirect":[{"__symbolic":"method"}],"logout":[{"__symbolic":"method"}],"logoutRedirect":[{"__symbolic":"method"}],"logoutPopup":[{"__symbolic":"method"}],"ssoSilent":[{"__symbolic":"method"}],"getLogger":[{"__symbolic":"method"}],"setLogger":[{"__symbolic":"method"}]}},"IMsalService":{"__symbolic":"interface"},"MsalGuard":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":16,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":21,"character":9},"arguments":[{"__symbolic":"reference","name":"MSAL_GUARD_CONFIG"}]}],null,null,null,null],"parameters":[{"__symbolic":"reference","name":"MsalGuardConfiguration"},{"__symbolic":"reference","name":"MsalBroadcastService"},{"__symbolic":"reference","name":"MsalService"},{"__symbolic":"reference","module":"@angular/common","name":"Location","line":24,"character":26},{"__symbolic":"reference","module":"@angular/router","name":"Router","line":25,"character":24}]}],"parseUrl":[{"__symbolic":"method"}],"getDestinationUrl":[{"__symbolic":"method"}],"loginInteractively":[{"__symbolic":"method"}],"activateHelper":[{"__symbolic":"method"}],"canActivate":[{"__symbolic":"method"}],"canActivateChild":[{"__symbolic":"method"}],"canLoad":[{"__symbolic":"method"}]}},"MsalGuardConfiguration":{"__symbolic":"interface"},"MsalGuardAuthRequest":{"__symbolic":"interface"},"MsalInterceptor":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":20,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":23,"character":9},"arguments":[{"__symbolic":"reference","name":"MSAL_INTERCEPTOR_CONFIG"}]}],null,null],"parameters":[{"__symbolic":"reference","name":"MsalInterceptorConfiguration"},{"__symbolic":"reference","name":"MsalService"},{"__symbolic":"reference","module":"@angular/common","name":"Location","line":25,"character":26}]}],"intercept":[{"__symbolic":"method"}],"acquireTokenInteractively":[{"__symbolic":"method"}],"getScopesForEndpoint":[{"__symbolic":"method"}],"matchResourcesToEndpoint":[{"__symbolic":"method"}],"matchScopesToEndpoint":[{"__symbolic":"method"}]}},"MsalInterceptorConfiguration":{"__symbolic":"interface"},"MsalInterceptorAuthRequest":{"__symbolic":"interface"},"ProtectedResourceScopes":{"__symbolic":"interface"},"MSAL_INSTANCE":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":7,"character":33},"arguments":["MSAL_INSTANCE"]},"MSAL_GUARD_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":9,"character":37},"arguments":["MSAL_GUARD_CONFIG"]},"MSAL_INTERCEPTOR_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":11,"character":43},"arguments":["MSAL_INTERCEPTOR_CONFIG"]},"MsalBroadcastService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":11,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":19,"character":9},"arguments":[{"__symbolic":"reference","name":"MSAL_INSTANCE"}]}],null],"parameters":[{"__symbolic":"reference","module":"@azure/msal-browser","name":"IPublicClientApplication","line":19,"character":53},{"__symbolic":"reference","name":"MsalService"}]}]}},"MsalModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":16,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"MsalRedirectComponent"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":19,"character":8}],"providers":[{"__symbolic":"reference","name":"MsalGuard"},{"__symbolic":"reference","name":"MsalBroadcastService"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["msalInstance","guardConfig","interceptorConfig"],"value":{"ngModule":{"__symbolic":"reference","name":"MsalModule"},"providers":[{"provide":{"__symbolic":"reference","name":"MSAL_INSTANCE"},"useValue":{"__symbolic":"reference","name":"msalInstance"}},{"provide":{"__symbolic":"reference","name":"MSAL_GUARD_CONFIG"},"useValue":{"__symbolic":"reference","name":"guardConfig"}},{"provide":{"__symbolic":"reference","name":"MSAL_INTERCEPTOR_CONFIG"},"useValue":{"__symbolic":"reference","name":"interceptorConfig"}},{"__symbolic":"reference","name":"MsalService"}]}}}},"MsalRedirectComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":14,"character":1},"arguments":[{"selector":"app-redirect","template":""}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"MsalService"}]}],"ngOnInit":[{"__symbolic":"method"}]}},"MsalCustomNavigationClient":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@azure/msal-browser","name":"NavigationClient","line":17,"character":48},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":16,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"MsalService"},{"__symbolic":"reference","module":"@angular/router","name":"Router","line":21,"character":24},{"__symbolic":"reference","module":"@angular/common","name":"Location","line":22,"character":26}]}],"navigateInternal":[{"__symbolic":"method"}]}}},"origins":{"MsalService":"./msal.service","IMsalService":"./IMsalService","MsalGuard":"./msal.guard","MsalGuardConfiguration":"./msal.guard.config","MsalGuardAuthRequest":"./msal.guard.config","MsalInterceptor":"./msal.interceptor","MsalInterceptorConfiguration":"./msal.interceptor.config","MsalInterceptorAuthRequest":"./msal.interceptor.config","ProtectedResourceScopes":"./msal.interceptor.config","MSAL_INSTANCE":"./constants","MSAL_GUARD_CONFIG":"./constants","MSAL_INTERCEPTOR_CONFIG":"./constants","MsalBroadcastService":"./msal.broadcast.service","MsalModule":"./msal.module","MsalRedirectComponent":"./msal.redirect.component","MsalCustomNavigationClient":"./msal.navigation.client"},"importAs":"@azure/msal-angular"}
1
+ {"__symbolic":"module","version":4,"metadata":{"MsalService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":24,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":30,"character":9},"arguments":[{"__symbolic":"reference","name":"MSAL_INSTANCE"}]}],null],"parameters":[{"__symbolic":"reference","module":"@azure/msal-browser","name":"IPublicClientApplication","line":30,"character":48},{"__symbolic":"reference","module":"@angular/common","name":"Location","line":31,"character":26}]}],"acquireTokenPopup":[{"__symbolic":"method"}],"acquireTokenRedirect":[{"__symbolic":"method"}],"acquireTokenSilent":[{"__symbolic":"method"}],"handleRedirectObservable":[{"__symbolic":"method"}],"loginPopup":[{"__symbolic":"method"}],"loginRedirect":[{"__symbolic":"method"}],"logout":[{"__symbolic":"method"}],"logoutRedirect":[{"__symbolic":"method"}],"logoutPopup":[{"__symbolic":"method"}],"ssoSilent":[{"__symbolic":"method"}],"getLogger":[{"__symbolic":"method"}],"setLogger":[{"__symbolic":"method"}]}},"IMsalService":{"__symbolic":"interface"},"MsalGuard":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":16,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":21,"character":9},"arguments":[{"__symbolic":"reference","name":"MSAL_GUARD_CONFIG"}]}],null,null,null,null],"parameters":[{"__symbolic":"reference","name":"MsalGuardConfiguration"},{"__symbolic":"reference","name":"MsalBroadcastService"},{"__symbolic":"reference","name":"MsalService"},{"__symbolic":"reference","module":"@angular/common","name":"Location","line":24,"character":26},{"__symbolic":"reference","module":"@angular/router","name":"Router","line":25,"character":24}]}],"parseUrl":[{"__symbolic":"method"}],"getDestinationUrl":[{"__symbolic":"method"}],"loginInteractively":[{"__symbolic":"method"}],"activateHelper":[{"__symbolic":"method"}],"canActivate":[{"__symbolic":"method"}],"canActivateChild":[{"__symbolic":"method"}],"canLoad":[{"__symbolic":"method"}]}},"MsalGuardConfiguration":{"__symbolic":"interface"},"MsalGuardAuthRequest":{"__symbolic":"interface"},"MsalInterceptor":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":20,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":25,"character":9},"arguments":[{"__symbolic":"reference","name":"MSAL_INTERCEPTOR_CONFIG"}]}],null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":29,"character":9},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":29,"character":16}]}]],"parameters":[{"__symbolic":"reference","name":"MsalInterceptorConfiguration"},{"__symbolic":"reference","name":"MsalService"},{"__symbolic":"reference","module":"@angular/common","name":"Location","line":27,"character":26},{"__symbolic":"reference","name":"any"}]}],"intercept":[{"__symbolic":"method"}],"acquireTokenInteractively":[{"__symbolic":"method"}],"getScopesForEndpoint":[{"__symbolic":"method"}],"matchResourcesToEndpoint":[{"__symbolic":"method"}],"getAbsoluteUrl":[{"__symbolic":"method"}],"matchScopesToEndpoint":[{"__symbolic":"method"}]}},"MsalInterceptorConfiguration":{"__symbolic":"interface"},"MsalInterceptorAuthRequest":{"__symbolic":"interface"},"ProtectedResourceScopes":{"__symbolic":"interface"},"MSAL_INSTANCE":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":7,"character":33},"arguments":["MSAL_INSTANCE"]},"MSAL_GUARD_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":9,"character":37},"arguments":["MSAL_GUARD_CONFIG"]},"MSAL_INTERCEPTOR_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":11,"character":43},"arguments":["MSAL_INTERCEPTOR_CONFIG"]},"MsalBroadcastService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":11,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":19,"character":9},"arguments":[{"__symbolic":"reference","name":"MSAL_INSTANCE"}]}],null],"parameters":[{"__symbolic":"reference","module":"@azure/msal-browser","name":"IPublicClientApplication","line":19,"character":53},{"__symbolic":"reference","name":"MsalService"}]}]}},"MsalModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":16,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"MsalRedirectComponent"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":19,"character":8}],"providers":[{"__symbolic":"reference","name":"MsalGuard"},{"__symbolic":"reference","name":"MsalBroadcastService"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["msalInstance","guardConfig","interceptorConfig"],"value":{"ngModule":{"__symbolic":"reference","name":"MsalModule"},"providers":[{"provide":{"__symbolic":"reference","name":"MSAL_INSTANCE"},"useValue":{"__symbolic":"reference","name":"msalInstance"}},{"provide":{"__symbolic":"reference","name":"MSAL_GUARD_CONFIG"},"useValue":{"__symbolic":"reference","name":"guardConfig"}},{"provide":{"__symbolic":"reference","name":"MSAL_INTERCEPTOR_CONFIG"},"useValue":{"__symbolic":"reference","name":"interceptorConfig"}},{"__symbolic":"reference","name":"MsalService"}]}}}},"MsalRedirectComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":14,"character":1},"arguments":[{"selector":"app-redirect","template":""}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"MsalService"}]}],"ngOnInit":[{"__symbolic":"method"}]}},"MsalCustomNavigationClient":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@azure/msal-browser","name":"NavigationClient","line":17,"character":48},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":16,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"MsalService"},{"__symbolic":"reference","module":"@angular/router","name":"Router","line":21,"character":24},{"__symbolic":"reference","module":"@angular/common","name":"Location","line":22,"character":26}]}],"navigateInternal":[{"__symbolic":"method"}]}},"version":"2.0.4"},"origins":{"MsalService":"./msal.service","IMsalService":"./IMsalService","MsalGuard":"./msal.guard","MsalGuardConfiguration":"./msal.guard.config","MsalGuardAuthRequest":"./msal.guard.config","MsalInterceptor":"./msal.interceptor","MsalInterceptorConfiguration":"./msal.interceptor.config","MsalInterceptorAuthRequest":"./msal.interceptor.config","ProtectedResourceScopes":"./msal.interceptor.config","MSAL_INSTANCE":"./constants","MSAL_GUARD_CONFIG":"./constants","MSAL_INTERCEPTOR_CONFIG":"./constants","MsalBroadcastService":"./msal.broadcast.service","MsalModule":"./msal.module","MsalRedirectComponent":"./msal.redirect.component","MsalCustomNavigationClient":"./msal.navigation.client","version":"./packageMetadata"},"importAs":"@azure/msal-angular"}
@@ -14,7 +14,7 @@
14
14
 
15
15
  /* eslint-disable header/header */
16
16
  var name = "@azure/msal-angular";
17
- var version = "2.0.0";
17
+ var version = "2.0.4";
18
18
 
19
19
  /*
20
20
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -101,9 +101,9 @@
101
101
  this.inProgress$ = this._inProgress.asObservable();
102
102
  this.msalInstance.addEventCallback(function (message) {
103
103
  _this._msalSubject.next(message);
104
- var status = msalBrowser.EventMessageUtils.getInteractionStatusFromEvent(message);
104
+ var status = msalBrowser.EventMessageUtils.getInteractionStatusFromEvent(message, _this._inProgress.value);
105
105
  if (status !== null) {
106
- _this.authService.getLogger().verbose("BroadcastService - " + message.eventType + " results in setting inProgress to " + status);
106
+ _this.authService.getLogger().verbose("BroadcastService - " + message.eventType + " results in setting inProgress from " + _this._inProgress.value + " to " + status);
107
107
  _this._inProgress.next(status);
108
108
  }
109
109
  });
@@ -200,9 +200,15 @@
200
200
  * short-circuit to prevent redirecting or popups.
201
201
  * TODO: Update to allow running in iframe once allowRedirectInIframe is implemented
202
202
  */
203
- if (msalBrowser.UrlString.hashContainsKnownProperties(window.location.hash) && msalBrowser.BrowserUtils.isInIframe()) {
204
- 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.");
205
- return rxjs.of(false);
203
+ if (typeof window !== "undefined") {
204
+ if (msalBrowser.UrlString.hashContainsKnownProperties(window.location.hash) && msalBrowser.BrowserUtils.isInIframe()) {
205
+ 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.");
206
+ return rxjs.of(false);
207
+ }
208
+ }
209
+ else {
210
+ this.authService.getLogger().info("Guard - window is undefined, MSAL does not support server-side token acquisition");
211
+ return rxjs.of(true);
206
212
  }
207
213
  /**
208
214
  * If a loginFailedRoute is set in the config, set this as the loginFailedRoute
@@ -224,7 +230,7 @@
224
230
  }
225
231
  _this.authService.getLogger().verbose("Guard - at least 1 account exists, can activate or load");
226
232
  // Prevent navigating the app to /#code= or /code=
227
- if (state && currentPath.indexOf("code=") > -1) {
233
+ if (state && state.url.indexOf("code=") > -1) {
228
234
  _this.authService.getLogger().info("Guard - Hash contains known code response, stopping navigation.");
229
235
  // Path routing (navigate to current path without hash)
230
236
  if (currentPath.indexOf("#") > -1) {
@@ -279,10 +285,13 @@
279
285
  * Licensed under the MIT License.
280
286
  */
281
287
  var MsalInterceptor = /** @class */ (function () {
282
- function MsalInterceptor(msalInterceptorConfig, authService, location) {
288
+ function MsalInterceptor(msalInterceptorConfig, authService, location,
289
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
290
+ document) {
283
291
  this.msalInterceptorConfig = msalInterceptorConfig;
284
292
  this.authService = authService;
285
293
  this.location = location;
294
+ this._document = document;
286
295
  }
287
296
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
288
297
  MsalInterceptor.prototype.intercept = function (req, next) {
@@ -333,6 +342,7 @@
333
342
  };
334
343
  /**
335
344
  * Invoke interaction for the given set of scopes
345
+ * @param authRequest Request
336
346
  * @param scopes Array of scopes for the request
337
347
  * @returns Result from the interactive request
338
348
  */
@@ -349,7 +359,7 @@
349
359
  /**
350
360
  * Looks up the scopes for the given endpoint from the protectedResourceMap
351
361
  * @param endpoint Url of the request
352
- * @param endpoint Http method of the request
362
+ * @param httpMethod Http method of the request
353
363
  * @returns Array of scopes, or null if not found
354
364
  *
355
365
  */
@@ -359,34 +369,53 @@
359
369
  var normalizedEndpoint = this.location.normalize(endpoint);
360
370
  var protectedResourcesArray = Array.from(this.msalInterceptorConfig.protectedResourceMap.keys());
361
371
  var matchingProtectedResources = this.matchResourcesToEndpoint(protectedResourcesArray, normalizedEndpoint);
362
- if (matchingProtectedResources.length > 0) {
363
- return this.matchScopesToEndpoint(this.msalInterceptorConfig.protectedResourceMap, matchingProtectedResources, httpMethod);
372
+ // Check absolute urls of resources first before checking relative to prevent incorrect matching where multiple resources have similar relative urls
373
+ if (matchingProtectedResources.absoluteResources.length > 0) {
374
+ return this.matchScopesToEndpoint(this.msalInterceptorConfig.protectedResourceMap, matchingProtectedResources.absoluteResources, httpMethod);
375
+ }
376
+ else if (matchingProtectedResources.relativeResources.length > 0) {
377
+ return this.matchScopesToEndpoint(this.msalInterceptorConfig.protectedResourceMap, matchingProtectedResources.relativeResources, httpMethod);
364
378
  }
365
379
  return null;
366
380
  };
367
381
  /**
368
382
  * Finds resource endpoints that match request endpoint
369
- * @param protectedResourcesArray
383
+ * @param protectedResourcesEndpoints
370
384
  * @param endpoint
371
- * @param location
372
385
  * @returns
373
386
  */
374
387
  MsalInterceptor.prototype.matchResourcesToEndpoint = function (protectedResourcesEndpoints, endpoint) {
375
388
  var _this = this;
376
- return protectedResourcesEndpoints.filter(function (key) {
389
+ var matchingResources = { absoluteResources: [], relativeResources: [] };
390
+ protectedResourcesEndpoints.forEach(function (key) {
391
+ // Normalizes and adds resource to matchingResources.absoluteResources if key matches endpoint. StringUtils.matchPattern accounts for wildcards
377
392
  var normalizedKey = _this.location.normalize(key);
393
+ if (msalBrowser.StringUtils.matchPattern(normalizedKey, endpoint)) {
394
+ matchingResources.absoluteResources.push(key);
395
+ }
396
+ // Get url components for relative urls
397
+ var absoluteKey = _this.getAbsoluteUrl(key);
398
+ var keyComponents = new msalBrowser.UrlString(absoluteKey).getUrlComponents();
399
+ var absoluteEndpoint = _this.getAbsoluteUrl(endpoint);
400
+ var endpointComponents = new msalBrowser.UrlString(absoluteEndpoint).getUrlComponents();
378
401
  // Normalized key should include query strings if applicable
379
- var keyComponents = new msalBrowser.UrlString(key).getUrlComponents();
380
402
  var relativeNormalizedKey = keyComponents.QueryString ? keyComponents.AbsolutePath + "?" + keyComponents.QueryString : _this.location.normalize(keyComponents.AbsolutePath);
381
- // Relative endpoint not applicable, matching endpoint with protected resource. StringUtils.matchPattern accounts for wildcards
382
- if (relativeNormalizedKey === "" || relativeNormalizedKey === "/*") {
383
- return msalBrowser.StringUtils.matchPattern(normalizedKey, endpoint);
384
- }
385
- else {
386
- // Matching endpoint with both protected resource and relative url of protected resource
387
- return msalBrowser.StringUtils.matchPattern(normalizedKey, endpoint) || msalBrowser.StringUtils.matchPattern(relativeNormalizedKey, endpoint);
403
+ // Add resource to matchingResources.relativeResources if same origin, relativeKey matches endpoint, and is not empty
404
+ if (keyComponents.HostNameAndPort === endpointComponents.HostNameAndPort && msalBrowser.StringUtils.matchPattern(relativeNormalizedKey, absoluteEndpoint) && relativeNormalizedKey !== "" && relativeNormalizedKey !== "/*") {
405
+ matchingResources.relativeResources.push(key);
388
406
  }
389
407
  });
408
+ return matchingResources;
409
+ };
410
+ /**
411
+ * Transforms relative urls to absolute urls
412
+ * @param url
413
+ * @returns
414
+ */
415
+ MsalInterceptor.prototype.getAbsoluteUrl = function (url) {
416
+ var link = this._document.createElement("a");
417
+ link.href = url;
418
+ return link.href;
390
419
  };
391
420
  /**
392
421
  * Finds scopes from first matching endpoint with HTTP method that matches request
@@ -417,9 +446,15 @@
417
446
  var normalizedResourceMethod = entry.httpMethod.toLowerCase();
418
447
  // Method in protectedResourceMap matches request http method
419
448
  if (normalizedResourceMethod === normalizedRequestMethod) {
420
- entry.scopes.forEach(function (scope) {
421
- scopesForEndpoint.push(scope);
422
- });
449
+ // Validate if scopes comes null to unprotect the resource in a certain http method
450
+ if (entry.scopes === null) {
451
+ allMatchedScopes.push(null);
452
+ }
453
+ else {
454
+ entry.scopes.forEach(function (scope) {
455
+ scopesForEndpoint.push(scope);
456
+ });
457
+ }
423
458
  }
424
459
  }
425
460
  });
@@ -445,7 +480,8 @@
445
480
  MsalInterceptor.ctorParameters = function () { return [
446
481
  { type: undefined, decorators: [{ type: core.Inject, args: [MSAL_INTERCEPTOR_CONFIG,] }] },
447
482
  { type: MsalService },
448
- { type: common.Location }
483
+ { type: common.Location },
484
+ { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
449
485
  ]; };
450
486
 
451
487
  /*
@@ -831,29 +867,32 @@
831
867
  * See performance doc for details:
832
868
  * https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/v2-docs/performance.md
833
869
  */
834
- var MsalCustomNavigationClient = /** @class */ (function (_super) {
835
- __extends(MsalCustomNavigationClient, _super);
870
+ var MsalCustomNavigationClient = /** @class */ (function (_super_1) {
871
+ __extends(MsalCustomNavigationClient, _super_1);
836
872
  function MsalCustomNavigationClient(authService, router, location) {
837
- var _this = _super.call(this) || this;
873
+ var _this = _super_1.call(this) || this;
838
874
  _this.authService = authService;
839
875
  _this.router = router;
840
876
  _this.location = location;
841
877
  return _this;
842
878
  }
843
879
  MsalCustomNavigationClient.prototype.navigateInternal = function (url, options) {
880
+ var _super = Object.create(null, {
881
+ navigateInternal: { get: function () { return _super_1.prototype.navigateInternal; } }
882
+ });
844
883
  return __awaiter(this, void 0, void 0, function () {
845
884
  var urlComponents, newUrl;
846
885
  return __generator(this, function (_a) {
847
- this.authService.getLogger().verbose("MsalCustomNavigationClient called");
848
- urlComponents = new msalBrowser.UrlString(url).getUrlComponents();
849
- newUrl = urlComponents.QueryString ? urlComponents.AbsolutePath + "?" + urlComponents.QueryString : this.location.normalize(urlComponents.AbsolutePath);
850
- // Replaces current state if noHistory flag set to true
851
- this.authService.getLogger().verbosePii("MsalCustomNavigationClient - navigating to newUrl: " + newUrl);
886
+ this.authService.getLogger().trace("MsalCustomNavigationClient called");
887
+ this.authService.getLogger().verbose("MsalCustomNavigationClient - navigating");
888
+ this.authService.getLogger().verbosePii("MsalCustomNavigationClient - navigating to url: " + url);
852
889
  // Prevent hash clearing from causing an issue with Client-side navigation after redirect is handled
853
890
  if (options.noHistory) {
854
- window.location.replace(newUrl);
891
+ return [2 /*return*/, _super.navigateInternal.call(this, url, options)];
855
892
  }
856
893
  else {
894
+ urlComponents = new msalBrowser.UrlString(url).getUrlComponents();
895
+ newUrl = urlComponents.QueryString ? urlComponents.AbsolutePath + "?" + urlComponents.QueryString : this.location.normalize(urlComponents.AbsolutePath);
857
896
  this.router.navigateByUrl(newUrl, { replaceUrl: options.noHistory });
858
897
  }
859
898
  return [2 /*return*/, Promise.resolve(options.noHistory)];
@@ -890,6 +929,7 @@
890
929
  exports.MsalModule = MsalModule;
891
930
  exports.MsalRedirectComponent = MsalRedirectComponent;
892
931
  exports.MsalService = MsalService;
932
+ exports.version = version;
893
933
 
894
934
  Object.defineProperty(exports, '__esModule', { value: true });
895
935