Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@azure/msal-angular

Package Overview
Dependencies
Maintainers
3
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/msal-angular - npm Package Compare versions

Comparing version 1.0.0-beta.4 to 1.0.0-beta.5

2

azure-msal-angular.metadata.json

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":4,"metadata":{"BroadcastService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"broadcast":[{"__symbolic":"method"}],"getMSALSubject":[{"__symbolic":"method"}],"getMSALItem":[{"__symbolic":"method"}],"subscribe":[{"__symbolic":"method"}]}},"MsalService":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"msal","name":"UserAgentApplication","line":31,"character":33},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":30,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":34,"character":9},"arguments":[{"__symbolic":"reference","name":"MSAL_CONFIG"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":35,"character":9},"arguments":[{"__symbolic":"reference","name":"MSAL_CONFIG_ANGULAR"}]}],null,null],"parameters":[{"__symbolic":"reference","module":"msal","name":"Configuration","line":34,"character":49},{"__symbolic":"reference","name":"MsalAngularConfiguration"},{"__symbolic":"reference","module":"@angular/router","name":"Router","line":36,"character":24},{"__symbolic":"reference","name":"BroadcastService"}]}],"isUnprotectedResource":[{"__symbolic":"method"}],"isEmpty":[{"__symbolic":"method"}],"getCacheStorage":[{"__symbolic":"method"}],"loginPopup":[{"__symbolic":"method"}],"acquireTokenSilent":[{"__symbolic":"method"}],"acquireTokenPopup":[{"__symbolic":"method"}],"handleRedirectCallback":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"clearCacheForScope":[{"__symbolic":"method"}],"getScopesForEndpoint":[{"__symbolic":"method"}]}},"MsalGuard":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":15,"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_CONFIG"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":9},"arguments":[{"__symbolic":"reference","name":"MSAL_CONFIG_ANGULAR"}]}],null,null,null,null,null,null],"parameters":[{"__symbolic":"reference","module":"msal","name":"Configuration","line":19,"character":49},{"__symbolic":"reference","name":"MsalAngularConfiguration"},{"__symbolic":"reference","name":"MsalService"},{"__symbolic":"reference","module":"@angular/router","name":"Router","line":22,"character":24},{"__symbolic":"reference","module":"@angular/router","name":"ActivatedRoute","line":23,"character":32},{"__symbolic":"reference","module":"@angular/common","name":"Location","line":24,"character":26},{"__symbolic":"reference","module":"@angular/common","name":"PlatformLocation","line":25,"character":34},{"__symbolic":"reference","name":"BroadcastService"}]}],"canActivate":[{"__symbolic":"method"}]}},"MsalInterceptor":{"__symbolic":"class","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","name":"BroadcastService"}]}],"intercept":[{"__symbolic":"method"}]}},"MsalModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":9,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":10,"character":12}],"declarations":[],"providers":[{"__symbolic":"reference","name":"MsalGuard"},{"__symbolic":"reference","name":"BroadcastService"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["config","angularConfig"],"defaults":[null,{"__symbolic":"reference","name":"ɵa"}],"value":{"ngModule":{"__symbolic":"reference","name":"MsalModule"},"providers":[{"provide":{"__symbolic":"reference","name":"MSAL_CONFIG"},"useValue":{"__symbolic":"reference","name":"config"}},{"provide":{"__symbolic":"reference","name":"MSAL_CONFIG_ANGULAR"},"useValue":{"__symbolic":"reference","name":"angularConfig"}},{"__symbolic":"reference","name":"MsalService"}]}}}},"ɵa":{"consentScopes":[],"popUp":false,"extraQueryParameters":{},"unprotectedResources":[],"protectedResourceMap":[]},"MsalAngularConfiguration":{"__symbolic":"interface"},"MSAL_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":2,"character":31},"arguments":["MSAL_CONFIG"]},"MSAL_CONFIG_ANGULAR":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":39},"arguments":["MSAL_CONFIG_ANGULAR"]}},"origins":{"BroadcastService":"./src/broadcast.service","MsalService":"./src/msal.service","MsalGuard":"./src/msal-guard.service","MsalInterceptor":"./src/msal.interceptor","MsalModule":"./src/msal.module","ɵa":"./src/msal-angular.configuration","MsalAngularConfiguration":"./src/msal-angular.configuration","MSAL_CONFIG":"./src/constants","MSAL_CONFIG_ANGULAR":"./src/constants"},"importAs":"@azure/msal-angular"}
{"__symbolic":"module","version":4,"metadata":{"BroadcastService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"broadcast":[{"__symbolic":"method"}],"getMSALSubject":[{"__symbolic":"method"}],"getMSALItem":[{"__symbolic":"method"}],"subscribe":[{"__symbolic":"method"}]}},"MsalService":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"msal","name":"UserAgentApplication","line":31,"character":33},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":30,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":34,"character":9},"arguments":[{"__symbolic":"reference","name":"MSAL_CONFIG"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":35,"character":9},"arguments":[{"__symbolic":"reference","name":"MSAL_CONFIG_ANGULAR"}]}],null,null],"parameters":[{"__symbolic":"reference","module":"msal","name":"Configuration","line":34,"character":49},{"__symbolic":"reference","name":"MsalAngularConfiguration"},{"__symbolic":"reference","module":"@angular/router","name":"Router","line":36,"character":24},{"__symbolic":"reference","name":"BroadcastService"}]}],"isUnprotectedResource":[{"__symbolic":"method"}],"isEmpty":[{"__symbolic":"method"}],"getCacheStorage":[{"__symbolic":"method"}],"loginPopup":[{"__symbolic":"method"}],"acquireTokenSilent":[{"__symbolic":"method"}],"acquireTokenPopup":[{"__symbolic":"method"}],"handleRedirectCallback":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"clearCacheForScope":[{"__symbolic":"method"}],"getScopesForEndpoint":[{"__symbolic":"method"}]}},"MsalGuard":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":15,"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_CONFIG"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":9},"arguments":[{"__symbolic":"reference","name":"MSAL_CONFIG_ANGULAR"}]}],null,null,null,null,null,null],"parameters":[{"__symbolic":"reference","module":"msal","name":"Configuration","line":19,"character":49},{"__symbolic":"reference","name":"MsalAngularConfiguration"},{"__symbolic":"reference","name":"MsalService"},{"__symbolic":"reference","module":"@angular/router","name":"Router","line":22,"character":24},{"__symbolic":"reference","module":"@angular/router","name":"ActivatedRoute","line":23,"character":32},{"__symbolic":"reference","module":"@angular/common","name":"Location","line":24,"character":26},{"__symbolic":"reference","module":"@angular/common","name":"PlatformLocation","line":25,"character":34},{"__symbolic":"reference","name":"BroadcastService"}]}],"getDestinationUrl":[{"__symbolic":"method"}],"loginInteractively":[{"__symbolic":"method"}],"canActivate":[{"__symbolic":"method"}]}},"MsalInterceptor":{"__symbolic":"class","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","name":"BroadcastService"}]}],"intercept":[{"__symbolic":"method"}]}},"MsalModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":9,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":10,"character":12}],"declarations":[],"providers":[{"__symbolic":"reference","name":"MsalGuard"},{"__symbolic":"reference","name":"BroadcastService"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["config","angularConfig"],"defaults":[null,{"__symbolic":"reference","name":"ɵa"}],"value":{"ngModule":{"__symbolic":"reference","name":"MsalModule"},"providers":[{"provide":{"__symbolic":"reference","name":"MSAL_CONFIG"},"useValue":{"__symbolic":"reference","name":"config"}},{"provide":{"__symbolic":"reference","name":"MSAL_CONFIG_ANGULAR"},"useValue":{"__symbolic":"reference","name":"angularConfig"}},{"__symbolic":"reference","name":"MsalService"}]}}}},"ɵa":{"consentScopes":[],"popUp":false,"extraQueryParameters":{},"unprotectedResources":[],"protectedResourceMap":[]},"MsalAngularConfiguration":{"__symbolic":"interface"},"MSAL_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":2,"character":31},"arguments":["MSAL_CONFIG"]},"MSAL_CONFIG_ANGULAR":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":39},"arguments":["MSAL_CONFIG_ANGULAR"]}},"origins":{"BroadcastService":"./src/broadcast.service","MsalService":"./src/msal.service","MsalGuard":"./src/msal-guard.service","MsalInterceptor":"./src/msal.interceptor","MsalModule":"./src/msal.module","ɵa":"./src/msal-angular.configuration","MsalAngularConfiguration":"./src/msal-angular.configuration","MSAL_CONFIG":"./src/constants","MSAL_CONFIG_ANGULAR":"./src/constants"},"importAs":"@azure/msal-angular"}

@@ -326,3 +326,3 @@ (function (global, factory) {

if (_this.msalAngularConfig.unprotectedResources) {
if (!_this.isUnprotectedResource(router.config[i].path) && !_this.isEmpty(router.config[i].path)) {
if (!_this.isEmpty(router.config[i].path) && !_this.isUnprotectedResource(router.config[i].path)) {
_this.msalAngularConfig.unprotectedResources.push(router.config[i].path);

@@ -487,2 +487,47 @@ }

}
/**
* Builds the absolute url for the destination page
* @param path Relative path of requested page
* @returns Full destination url
*/
MsalGuard.prototype.getDestinationUrl = function (path) {
// Absolute base url for the application (default to origin if base element not present)
var baseElements = document.getElementsByTagName("base");
var baseUrl = this.location.normalize(baseElements.length ? baseElements[0].href : window.location.origin);
// Path of page (including hash, if using hash routing)
var pathUrl = this.location.prepareExternalUrl(path);
// Hash location strategy
if (pathUrl.startsWith("#")) {
return baseUrl + "/" + pathUrl;
}
// If using path location strategy, pathUrl will include the relative portion of the base path (e.g. /base/page).
// Since baseUrl also includes /base, can just concatentate baseUrl + path
return "" + baseUrl + path;
};
/**
* Interactively prompt the user to login
* @param url Path of the requested page
*/
MsalGuard.prototype.loginInteractively = function (url) {
return __awaiter(this, void 0, void 0, function () {
var redirectStartPage;
return __generator(this, function (_a) {
if (this.msalAngularConfig.popUp) {
return [2 /*return*/, this.authService.loginPopup({
scopes: this.msalAngularConfig.consentScopes,
extraQueryParameters: this.msalAngularConfig.extraQueryParameters
})
.then(function () { return true; })
.catch(function () { return false; })];
}
redirectStartPage = this.getDestinationUrl(url);
this.authService.loginRedirect({
redirectStartPage: redirectStartPage,
scopes: this.msalAngularConfig.consentScopes,
extraQueryParameters: this.msalAngularConfig.extraQueryParameters
});
return [2 /*return*/];
});
});
};
MsalGuard.prototype.canActivate = function (route, state) {

@@ -498,30 +543,16 @@ var _this = this;

if (!this.authService.getAccount()) {
if (this.msalAngularConfig.popUp) {
return this.authService.loginPopup({
scopes: this.msalAngularConfig.consentScopes,
extraQueryParameters: this.msalAngularConfig.extraQueryParameters
})
.then(function () { return true; })
.catch(function () { return false; });
return this.loginInteractively(state.url);
}
return this.authService.acquireTokenSilent({
scopes: [this.msalConfig.auth.clientId]
})
.then(function () { return true; })
.catch(function (error) {
if (msal.InteractionRequiredAuthError.isInteractionRequiredError(error.errorCode)) {
_this.authService.getLogger().info("Interaction required error in MSAL Guard, prompting for interaction.");
return _this.loginInteractively(state.url);
}
var routePath = "" + window.location.origin + state.url;
this.authService.loginRedirect({
redirectStartPage: routePath,
scopes: this.msalAngularConfig.consentScopes,
extraQueryParameters: this.msalAngularConfig.extraQueryParameters
});
}
else {
return this.authService.acquireTokenSilent({
scopes: [this.msalConfig.auth.clientId]
})
.then(function (result) {
_this.broadcastService.broadcast("msal:loginSuccess", result);
return true;
})
.catch(function (error) {
_this.broadcastService.broadcast("msal:loginFailure", error);
return false;
});
}
_this.authService.getLogger().error("Non-interaction error in MSAL Guard: " + error.errorMessage);
throw error;
});
};

@@ -528,0 +559,0 @@ MsalGuard.ctorParameters = function () { return [

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("msal"),require("@angular/router"),require("msal/lib-commonjs/utils/UrlUtils"),require("@angular/common"),require("msal/lib-commonjs/utils/WindowUtils"),require("@angular/common/http")):"function"==typeof define&&define.amd?define("@azure/msal-angular",["exports","@angular/core","rxjs","rxjs/operators","msal","@angular/router","msal/lib-commonjs/utils/UrlUtils","@angular/common","msal/lib-commonjs/utils/WindowUtils","@angular/common/http"],t):t(((e=e||self).azure=e.azure||{},e.azure["msal-angular"]={}),e.ng.core,e.rxjs,e.rxjs.operators,e.msal,e.ng.router,e.UrlUtils,e.ng.common,e.WindowUtils,e.ng.common.http)}(this,(function(e,t,r,o,n,a,i,s,c,u){"use strict";
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("msal"),require("@angular/router"),require("msal/lib-commonjs/utils/UrlUtils"),require("@angular/common"),require("msal/lib-commonjs/utils/WindowUtils"),require("@angular/common/http")):"function"==typeof define&&define.amd?define("@azure/msal-angular",["exports","@angular/core","rxjs","rxjs/operators","msal","@angular/router","msal/lib-commonjs/utils/UrlUtils","@angular/common","msal/lib-commonjs/utils/WindowUtils","@angular/common/http"],t):t(((e=e||self).azure=e.azure||{},e.azure["msal-angular"]={}),e.ng.core,e.rxjs,e.rxjs.operators,e.msal,e.ng.router,e.UrlUtils,e.ng.common,e.WindowUtils,e.ng.common.http)}(this,(function(e,t,r,o,n,i,a,s,c,u){"use strict";
/*! *****************************************************************************

@@ -15,3 +15,3 @@ Copyright (c) Microsoft Corporation. All rights reserved.

and limitations under the License.
***************************************************************************** */var l=function(e,t){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var p=function(){return(p=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function f(e,t,r,o){var n,a=arguments.length,i=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(a<3?n(i):a>3?n(t,r,i):n(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function g(e,t){return function(r,o){t(r,o,e)}}var h=function(){function e(){this._msalSubject=new r.BehaviorSubject(1),this.msalItem$=this._msalSubject.asObservable()}return e.prototype.broadcast=function(e,t){this._msalSubject.next({type:e,payload:t})},e.prototype.getMSALSubject=function(){return this._msalSubject},e.prototype.getMSALItem=function(){return this.msalItem$},e.prototype.subscribe=function(e,t){return this.msalItem$.pipe(o.filter((function(t){return t.type===e})),o.map((function(e){return e.payload}))).subscribe(t)},e=f([t.Injectable()],e)}(),d=function(){function e(e,t,r){this._error="",this._errorDesc="",this._scopes="",this._error=e,t&&(this._errorDesc=t),r&&(this._scopes=r)}return Object.defineProperty(e.prototype,"error",{get:function(){return this._error},set:function(e){this._error=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errorDesc",{get:function(){return this._errorDesc},set:function(e){this._errorDesc=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scopes",{get:function(){return this._scopes},set:function(e){this._scopes=e},enumerable:!0,configurable:!0}),e}(),m=new t.InjectionToken("MSAL_CONFIG"),y=new t.InjectionToken("MSAL_CONFIG_ANGULAR"),b=function(e){return p(p({},e),{framework:p(p({},e.framework),{isAngular:!0})})},v=function(e){function r(t,r,o,n){var a=e.call(this,b(t))||this;return a.msalConfig=t,a.msalAngularConfig=r,a.router=o,a.broadcastService=n,window.addEventListener("msal:popUpHashChanged",(function(e){a.getLogger().verbose("popUpHashChanged ")})),window.addEventListener("msal:popUpClosed",(function(e){var t=e.detail.split("|"),r=new d(t[0],t[1]);a.getLoginInProgress()?(n.broadcast("msal:loginFailure",r),a.setloginInProgress(!1)):a.getAcquireTokenInProgress()&&(n.broadcast("msal:acquireTokenFailure",r),a.setAcquireTokenInProgress(!1))})),a.router.events.subscribe((function(e){for(var t=0;t<o.config.length;t++)o.config[t].canActivate||a.msalAngularConfig.unprotectedResources&&(a.isUnprotectedResource(o.config[t].path)||a.isEmpty(o.config[t].path)||a.msalAngularConfig.unprotectedResources.push(o.config[t].path))})),a}return function(e,t){function r(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(r,e),r.prototype.isUnprotectedResource=function(e){var t=this.msalConfig.framework&&this.msalConfig.framework.unprotectedResources,r=this.msalAngularConfig.unprotectedResources||[];return(t&&t.length?t:r).some((function(t){return e.indexOf(t)>-1}))},r.prototype.isEmpty=function(e){return void 0===e||!e||0===e.length},r.prototype.getCacheStorage=function(){return this.cacheStorage},r.prototype.loginPopup=function(t){var r=this;return e.prototype.loginPopup.call(this,t).then((function(e){return r.broadcastService.broadcast("msal:loginSuccess",e),e})).catch((function(e){throw r.broadcastService.broadcast("msal:loginFailure",e),r.getLogger().error("Error during login:\n"+e.errorMessage),e}))},r.prototype.acquireTokenSilent=function(t){var r=this;return e.prototype.acquireTokenSilent.call(this,t).then((function(e){return r.broadcastService.broadcast("msal:acquireTokenSuccess",e),e})).catch((function(e){throw r.broadcastService.broadcast("msal:acquireTokenFailure",e),r.getLogger().error("Error when acquiring token for scopes: "+t.scopes+" "+e),e}))},r.prototype.acquireTokenPopup=function(t){var r=this;return e.prototype.acquireTokenPopup.call(this,t).then((function(e){return r.broadcastService.broadcast("msal:acquireTokenSuccess",e),e})).catch((function(e){throw r.broadcastService.broadcast("msal:acquireTokenFailure",e),r.getLogger().error("Error when acquiring token for scopes : "+t.scopes+" "+e),e}))},r.prototype.handleRedirectCallback=function(t,r){var o=this;e.prototype.handleRedirectCallback.call(this,(function(e,n){n?("id_token"===n.tokenType?o.broadcastService.broadcast("msal:loginSuccess",n):o.broadcastService.broadcast("msal:acquireTokenSuccess",n),r?t(n):t(null,n)):e&&("id_token"===n.tokenType?o.broadcastService.broadcast("msal:loginFailure",e):o.broadcastService.broadcast("msal:acquireTokenFailure",e),r?r(e,n.accountState):t(e))}))},r.prototype.clearCacheForScope=function(t){return e.prototype.clearCacheForScope.call(this,t)},r.prototype.getScopesForEndpoint=function(t){if(this.msalConfig.framework&&this.msalConfig.framework.unprotectedResources&&this.getLogger().info("msalConfig.framework.unprotectedResources is deprecated, use msalAngularConfig.unprotectedResources"),this.isUnprotectedResource(t))return null;var r=this.msalConfig.framework&&this.msalConfig.framework.protectedResourceMap;r&&this.getLogger().info("msalConfig.framework.protectedResourceMap is deprecated, use msalAngularConfig.protectedResourceMap");var o=r&&r.size?r:new Map(this.msalAngularConfig.protectedResourceMap),n=Array.from(o.keys()).find((function(e){return t.indexOf(e)>-1}));return n?o.get(n):t.indexOf("http://")>-1||t.indexOf("https://")>-1?i.UrlUtils.getHostFromUri(t)===i.UrlUtils.getHostFromUri(e.prototype.getRedirectUri.call(this))?new Array(this.msalConfig.auth.clientId):null:new Array(this.msalConfig.auth.clientId)},r.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[m]}]},{type:void 0,decorators:[{type:t.Inject,args:[y]}]},{type:a.Router},{type:h}]},r=f([t.Injectable(),g(0,t.Inject(m)),g(1,t.Inject(y))],r)}(n.UserAgentApplication),S=function(){function e(e,t,r,o,n,a,i,s){this.msalConfig=e,this.msalAngularConfig=t,this.authService=r,this.router=o,this.activatedRoute=n,this.location=a,this.platformLocation=i,this.broadcastService=s}return e.prototype.canActivate=function(e,t){var r=this;if(this.authService.getLogger().verbose("location change event from old url to new url"),i.UrlUtils.urlContainsHash(window.location.hash)&&c.WindowUtils.isInIframe())return this.authService.getLogger().warning("redirectUri set to page with MSAL Guard. It is recommended to not set redirectUri to a page that requires authentication."),!1;if(this.authService.getAccount())return this.authService.acquireTokenSilent({scopes:[this.msalConfig.auth.clientId]}).then((function(e){return r.broadcastService.broadcast("msal:loginSuccess",e),!0})).catch((function(e){return r.broadcastService.broadcast("msal:loginFailure",e),!1}));if(this.msalAngularConfig.popUp)return this.authService.loginPopup({scopes:this.msalAngularConfig.consentScopes,extraQueryParameters:this.msalAngularConfig.extraQueryParameters}).then((function(){return!0})).catch((function(){return!1}));var o=""+window.location.origin+t.url;this.authService.loginRedirect({redirectStartPage:o,scopes:this.msalAngularConfig.consentScopes,extraQueryParameters:this.msalAngularConfig.extraQueryParameters})},e.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[m]}]},{type:void 0,decorators:[{type:t.Inject,args:[y]}]},{type:v},{type:a.Router},{type:a.ActivatedRoute},{type:s.Location},{type:s.PlatformLocation},{type:h}]},e=f([t.Injectable(),g(0,t.Inject(m)),g(1,t.Inject(y))],e)}(),j=function(){function e(e,t){this.auth=e,this.broadcastService=t}return e.prototype.intercept=function(e,t){var n,a=this,i=this.auth.getScopesForEndpoint(e.url);return this.auth.getLogger().verbose("Url: "+e.url+" maps to scopes: "+i),i?r.from(this.auth.acquireTokenSilent({scopes:i}).then((function(t){n=t.accessToken;var r="Bearer "+t.accessToken;return e.clone({setHeaders:{Authorization:r}})}))).pipe(o.mergeMap((function(e){return t.handle(e)})),o.tap((function(e){}),(function(e){e instanceof u.HttpErrorResponse&&401===e.status&&(a.auth.clearCacheForScope(n),a.broadcastService.broadcast("msal:notAuthorized",e.message))}))):t.handle(e)},e.ctorParameters=function(){return[{type:v},{type:h}]},e=f([t.Injectable()],e)}(),w={consentScopes:[],popUp:!1,extraQueryParameters:{},unprotectedResources:[],protectedResourceMap:[]},C=function(){function e(){}var r;return r=e,e.forRoot=function(e,t){return void 0===t&&(t=w),{ngModule:r,providers:[{provide:m,useValue:e},{provide:y,useValue:t},v]}},e=r=f([t.NgModule({imports:[s.CommonModule],declarations:[],providers:[S,h]})],e)}();e.BroadcastService=h,e.MSAL_CONFIG=m,e.MSAL_CONFIG_ANGULAR=y,e.MsalGuard=S,e.MsalInterceptor=j,e.MsalModule=C,e.MsalService=v,e.ɵa=w,Object.defineProperty(e,"__esModule",{value:!0})}));
***************************************************************************** */var l=function(e,t){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var p=function(){return(p=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function f(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function h(e,t){return function(r,o){t(r,o,e)}}function g(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))}function d(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,o&&(n=2&i[0]?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]<n[3])){a.label=i[1];break}if(6===i[0]&&a.label<n[1]){a.label=n[1],n=i;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(i);break}n[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{r=n=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var m=function(){function e(){this._msalSubject=new r.BehaviorSubject(1),this.msalItem$=this._msalSubject.asObservable()}return e.prototype.broadcast=function(e,t){this._msalSubject.next({type:e,payload:t})},e.prototype.getMSALSubject=function(){return this._msalSubject},e.prototype.getMSALItem=function(){return this.msalItem$},e.prototype.subscribe=function(e,t){return this.msalItem$.pipe(o.filter((function(t){return t.type===e})),o.map((function(e){return e.payload}))).subscribe(t)},e=f([t.Injectable()],e)}(),y=function(){function e(e,t,r){this._error="",this._errorDesc="",this._scopes="",this._error=e,t&&(this._errorDesc=t),r&&(this._scopes=r)}return Object.defineProperty(e.prototype,"error",{get:function(){return this._error},set:function(e){this._error=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errorDesc",{get:function(){return this._errorDesc},set:function(e){this._errorDesc=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scopes",{get:function(){return this._scopes},set:function(e){this._scopes=e},enumerable:!0,configurable:!0}),e}(),b=new t.InjectionToken("MSAL_CONFIG"),v=new t.InjectionToken("MSAL_CONFIG_ANGULAR"),S=function(e){return p(p({},e),{framework:p(p({},e.framework),{isAngular:!0})})},w=function(e){function r(t,r,o,n){var i=e.call(this,S(t))||this;return i.msalConfig=t,i.msalAngularConfig=r,i.router=o,i.broadcastService=n,window.addEventListener("msal:popUpHashChanged",(function(e){i.getLogger().verbose("popUpHashChanged ")})),window.addEventListener("msal:popUpClosed",(function(e){var t=e.detail.split("|"),r=new y(t[0],t[1]);i.getLoginInProgress()?(n.broadcast("msal:loginFailure",r),i.setloginInProgress(!1)):i.getAcquireTokenInProgress()&&(n.broadcast("msal:acquireTokenFailure",r),i.setAcquireTokenInProgress(!1))})),i.router.events.subscribe((function(e){for(var t=0;t<o.config.length;t++)o.config[t].canActivate||i.msalAngularConfig.unprotectedResources&&(i.isEmpty(o.config[t].path)||i.isUnprotectedResource(o.config[t].path)||i.msalAngularConfig.unprotectedResources.push(o.config[t].path))})),i}return function(e,t){function r(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(r,e),r.prototype.isUnprotectedResource=function(e){var t=this.msalConfig.framework&&this.msalConfig.framework.unprotectedResources,r=this.msalAngularConfig.unprotectedResources||[];return(t&&t.length?t:r).some((function(t){return e.indexOf(t)>-1}))},r.prototype.isEmpty=function(e){return void 0===e||!e||0===e.length},r.prototype.getCacheStorage=function(){return this.cacheStorage},r.prototype.loginPopup=function(t){var r=this;return e.prototype.loginPopup.call(this,t).then((function(e){return r.broadcastService.broadcast("msal:loginSuccess",e),e})).catch((function(e){throw r.broadcastService.broadcast("msal:loginFailure",e),r.getLogger().error("Error during login:\n"+e.errorMessage),e}))},r.prototype.acquireTokenSilent=function(t){var r=this;return e.prototype.acquireTokenSilent.call(this,t).then((function(e){return r.broadcastService.broadcast("msal:acquireTokenSuccess",e),e})).catch((function(e){throw r.broadcastService.broadcast("msal:acquireTokenFailure",e),r.getLogger().error("Error when acquiring token for scopes: "+t.scopes+" "+e),e}))},r.prototype.acquireTokenPopup=function(t){var r=this;return e.prototype.acquireTokenPopup.call(this,t).then((function(e){return r.broadcastService.broadcast("msal:acquireTokenSuccess",e),e})).catch((function(e){throw r.broadcastService.broadcast("msal:acquireTokenFailure",e),r.getLogger().error("Error when acquiring token for scopes : "+t.scopes+" "+e),e}))},r.prototype.handleRedirectCallback=function(t,r){var o=this;e.prototype.handleRedirectCallback.call(this,(function(e,n){n?("id_token"===n.tokenType?o.broadcastService.broadcast("msal:loginSuccess",n):o.broadcastService.broadcast("msal:acquireTokenSuccess",n),r?t(n):t(null,n)):e&&("id_token"===n.tokenType?o.broadcastService.broadcast("msal:loginFailure",e):o.broadcastService.broadcast("msal:acquireTokenFailure",e),r?r(e,n.accountState):t(e))}))},r.prototype.clearCacheForScope=function(t){return e.prototype.clearCacheForScope.call(this,t)},r.prototype.getScopesForEndpoint=function(t){if(this.msalConfig.framework&&this.msalConfig.framework.unprotectedResources&&this.getLogger().info("msalConfig.framework.unprotectedResources is deprecated, use msalAngularConfig.unprotectedResources"),this.isUnprotectedResource(t))return null;var r=this.msalConfig.framework&&this.msalConfig.framework.protectedResourceMap;r&&this.getLogger().info("msalConfig.framework.protectedResourceMap is deprecated, use msalAngularConfig.protectedResourceMap");var o=r&&r.size?r:new Map(this.msalAngularConfig.protectedResourceMap),n=Array.from(o.keys()).find((function(e){return t.indexOf(e)>-1}));return n?o.get(n):t.indexOf("http://")>-1||t.indexOf("https://")>-1?a.UrlUtils.getHostFromUri(t)===a.UrlUtils.getHostFromUri(e.prototype.getRedirectUri.call(this))?new Array(this.msalConfig.auth.clientId):null:new Array(this.msalConfig.auth.clientId)},r.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[b]}]},{type:void 0,decorators:[{type:t.Inject,args:[v]}]},{type:i.Router},{type:m}]},r=f([t.Injectable(),h(0,t.Inject(b)),h(1,t.Inject(v))],r)}(n.UserAgentApplication),j=function(){function e(e,t,r,o,n,i,a,s){this.msalConfig=e,this.msalAngularConfig=t,this.authService=r,this.router=o,this.activatedRoute=n,this.location=i,this.platformLocation=a,this.broadcastService=s}return e.prototype.getDestinationUrl=function(e){var t=document.getElementsByTagName("base"),r=this.location.normalize(t.length?t[0].href:window.location.origin),o=this.location.prepareExternalUrl(e);return o.startsWith("#")?r+"/"+o:""+r+e},e.prototype.loginInteractively=function(e){return g(this,void 0,void 0,(function(){var t;return d(this,(function(r){return this.msalAngularConfig.popUp?[2,this.authService.loginPopup({scopes:this.msalAngularConfig.consentScopes,extraQueryParameters:this.msalAngularConfig.extraQueryParameters}).then((function(){return!0})).catch((function(){return!1}))]:(t=this.getDestinationUrl(e),this.authService.loginRedirect({redirectStartPage:t,scopes:this.msalAngularConfig.consentScopes,extraQueryParameters:this.msalAngularConfig.extraQueryParameters}),[2])}))}))},e.prototype.canActivate=function(e,t){var r=this;return this.authService.getLogger().verbose("location change event from old url to new url"),a.UrlUtils.urlContainsHash(window.location.hash)&&c.WindowUtils.isInIframe()?(this.authService.getLogger().warning("redirectUri set to page with MSAL Guard. It is recommended to not set redirectUri to a page that requires authentication."),!1):this.authService.getAccount()?this.authService.acquireTokenSilent({scopes:[this.msalConfig.auth.clientId]}).then((function(){return!0})).catch((function(e){if(n.InteractionRequiredAuthError.isInteractionRequiredError(e.errorCode))return r.authService.getLogger().info("Interaction required error in MSAL Guard, prompting for interaction."),r.loginInteractively(t.url);throw r.authService.getLogger().error("Non-interaction error in MSAL Guard: "+e.errorMessage),e})):this.loginInteractively(t.url)},e.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[b]}]},{type:void 0,decorators:[{type:t.Inject,args:[v]}]},{type:w},{type:i.Router},{type:i.ActivatedRoute},{type:s.Location},{type:s.PlatformLocation},{type:m}]},e=f([t.Injectable(),h(0,t.Inject(b)),h(1,t.Inject(v))],e)}(),k=function(){function e(e,t){this.auth=e,this.broadcastService=t}return e.prototype.intercept=function(e,t){var n,i=this,a=this.auth.getScopesForEndpoint(e.url);return this.auth.getLogger().verbose("Url: "+e.url+" maps to scopes: "+a),a?r.from(this.auth.acquireTokenSilent({scopes:a}).then((function(t){n=t.accessToken;var r="Bearer "+t.accessToken;return e.clone({setHeaders:{Authorization:r}})}))).pipe(o.mergeMap((function(e){return t.handle(e)})),o.tap((function(e){}),(function(e){e instanceof u.HttpErrorResponse&&401===e.status&&(i.auth.clearCacheForScope(n),i.broadcastService.broadcast("msal:notAuthorized",e.message))}))):t.handle(e)},e.ctorParameters=function(){return[{type:w},{type:m}]},e=f([t.Injectable()],e)}(),A={consentScopes:[],popUp:!1,extraQueryParameters:{},unprotectedResources:[],protectedResourceMap:[]},C=function(){function e(){}var r;return r=e,e.forRoot=function(e,t){return void 0===t&&(t=A),{ngModule:r,providers:[{provide:b,useValue:e},{provide:v,useValue:t},w]}},e=r=f([t.NgModule({imports:[s.CommonModule],declarations:[],providers:[j,m]})],e)}();e.BroadcastService=m,e.MSAL_CONFIG=b,e.MSAL_CONFIG_ANGULAR=v,e.MsalGuard=j,e.MsalInterceptor=k,e.MsalModule=C,e.MsalService=w,e.ɵa=A,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=azure-msal-angular.umd.min.js.map
# Changelog
## 1.0.0-beta.5
* Requires `msal@1.3.0-beta.0`.
* When MSAL Guard fails to silent SSO, prompt for interaction. (#1455)
* MSAL Guard should properly support hash routing and non-root base urls. (#1452)
* Fix isEmpty check for unprotectedResources. (#1454)
* Update handleRedirectCallback in Angular samples to log entire response. (#1428)
* Don't broadcast `msal:login` events from MSAL Guard. (#1435)
* Add guide for [Configuration](./docs/configuration.md).
## 1.0.0-beta.4

@@ -4,0 +14,0 @@

@@ -1,2 +0,2 @@

import { __decorate, __param } from "tslib";
import { __awaiter, __decorate, __param } from "tslib";
import { Inject, Injectable } from "@angular/core";

@@ -7,2 +7,3 @@ import { ActivatedRoute, ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, } from "@angular/router";

import { BroadcastService } from "./broadcast.service";
import { InteractionRequiredAuthError } from "msal";
import { MSAL_CONFIG, MSAL_CONFIG_ANGULAR } from "./constants";

@@ -22,11 +23,27 @@ import { UrlUtils } from "msal/lib-commonjs/utils/UrlUtils";

}
canActivate(route, state) {
this.authService.getLogger().verbose("location change event from old url to new url");
// If a page with MSAL Guard is set as the redirect for acquireTokenSilent,
// short-circuit to prevent redirecting or popups.
if (UrlUtils.urlContainsHash(window.location.hash) && WindowUtils.isInIframe()) {
this.authService.getLogger().warning("redirectUri set to page with MSAL Guard. It is recommended to not set redirectUri to a page that requires authentication.");
return false;
/**
* Builds the absolute url for the destination page
* @param path Relative path of requested page
* @returns Full destination url
*/
getDestinationUrl(path) {
// Absolute base url for the application (default to origin if base element not present)
const baseElements = document.getElementsByTagName("base");
const baseUrl = this.location.normalize(baseElements.length ? baseElements[0].href : window.location.origin);
// Path of page (including hash, if using hash routing)
const pathUrl = this.location.prepareExternalUrl(path);
// Hash location strategy
if (pathUrl.startsWith("#")) {
return `${baseUrl}/${pathUrl}`;
}
if (!this.authService.getAccount()) {
// If using path location strategy, pathUrl will include the relative portion of the base path (e.g. /base/page).
// Since baseUrl also includes /base, can just concatentate baseUrl + path
return `${baseUrl}${path}`;
}
/**
* Interactively prompt the user to login
* @param url Path of the requested page
*/
loginInteractively(url) {
return __awaiter(this, void 0, void 0, function* () {
if (this.msalAngularConfig.popUp) {

@@ -40,22 +57,33 @@ return this.authService.loginPopup({

}
const routePath = `${window.location.origin}${state.url}`;
const redirectStartPage = this.getDestinationUrl(url);
this.authService.loginRedirect({
redirectStartPage: routePath,
redirectStartPage,
scopes: this.msalAngularConfig.consentScopes,
extraQueryParameters: this.msalAngularConfig.extraQueryParameters
});
});
}
canActivate(route, state) {
this.authService.getLogger().verbose("location change event from old url to new url");
// If a page with MSAL Guard is set as the redirect for acquireTokenSilent,
// short-circuit to prevent redirecting or popups.
if (UrlUtils.urlContainsHash(window.location.hash) && WindowUtils.isInIframe()) {
this.authService.getLogger().warning("redirectUri set to page with MSAL Guard. It is recommended to not set redirectUri to a page that requires authentication.");
return false;
}
else {
return this.authService.acquireTokenSilent({
scopes: [this.msalConfig.auth.clientId]
})
.then((result) => {
this.broadcastService.broadcast("msal:loginSuccess", result);
return true;
})
.catch((error) => {
this.broadcastService.broadcast("msal:loginFailure", error);
return false;
});
if (!this.authService.getAccount()) {
return this.loginInteractively(state.url);
}
return this.authService.acquireTokenSilent({
scopes: [this.msalConfig.auth.clientId]
})
.then(() => true)
.catch((error) => {
if (InteractionRequiredAuthError.isInteractionRequiredError(error.errorCode)) {
this.authService.getLogger().info(`Interaction required error in MSAL Guard, prompting for interaction.`);
return this.loginInteractively(state.url);
}
this.authService.getLogger().error(`Non-interaction error in MS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AgICAgICAgICAgICAgICAgICBleHRyYVF1ZXJ5UGFyYW1ldGVyczogdGhpcy5tc2FsQW5ndWxhckNvbmZpZy5leHRyYVF1ZXJ5UGFyYW1ldGVyc1xyXG4gICAgICAgICAgICAgICAgfSlcclxuICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB0cnVlKVxyXG4gICAgICAgICAgICAgICAgICAgIC5jYXRjaCgoKSA9PiBmYWxzZSk7XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgIGNvbnN0IHJvdXRlUGF0aCA9IGAke3dpbmRvdy5sb2NhdGlvbi5vcmlnaW59JHtzdGF0ZS51cmx9YDtcclxuXHJcbiAgICAgICAgICAgIHRoaXMuYXV0aFNlcnZpY2UubG9naW5SZWRpcmVjdCh7XHJcbiAgICAgICAgICAgICAgICByZWRpcmVjdFN0YXJ0UGFnZTogcm91dGVQYXRoLFxyXG4gICAgICAgICAgICAgICAgc2NvcGVzOiB0aGlzLm1zYWxBbmd1bGFyQ29uZmlnLmNvbnNlbnRTY29wZXMsXHJcbiAgICAgICAgICAgICAgICBleHRyYVF1ZXJ5UGFyYW1ldGVyczogdGhpcy5tc2FsQW5ndWxhckNvbmZpZy5leHRyYVF1ZXJ5UGFyYW1ldGVyc1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICByZXR1cm4gdGhpcy5hdXRoU2VydmljZS5hY3F1aXJlVG9rZW5TaWxlbnQoe1xyXG4gICAgICAgICAgICAgICAgc2NvcGVzOiBbdGhpcy5tc2FsQ29uZmlnLmF1dGguY2xpZW50SWRdXHJcbiAgICAgICAgICAgIH0pXHJcbiAgICAgICAgICAgICAgICAudGhlbigocmVzdWx0OiBBdXRoUmVzcG9uc2UpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICB0aGlzLmJyb2FkY2FzdFNlcnZpY2UuYnJvYWRjYXN0KFwibXNhbDpsb2dpblN1Y2Nlc3NcIiwgIH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WFyZCwgcHJvbXB0aW5nIGZvciBpbnRlcmFjdGlvbi5gKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5sb2dpbkludGVyYWN0aXZlbHkoc3RhdGUudXJsKTtcclxuICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICB0aGlzLmF1dGhTZXJ2aWNlLmdldExvZ2dlcigpLmVycm9yKGBOb24taW50ZXJhY3Rpb24gZXJyb3IgaW4gTVNBTCBHdWFyZDogJHtlcnJvci5lcnJvck1lc3NhZ2V9YCk7XHJcbiAgICAgICAgICAgICAgICB0aHJvdyBlcnJvcjtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICB9XHJcblxyXG59XHJcbiJdfQ==

@@ -39,3 +39,3 @@ import { __decorate, __param } from "tslib";

if (this.msalAngularConfig.unprotectedResources) {
if (!this.isUnprotectedResource(router.config[i].path) && !this.isEmpty(router.config[i].path)) {
if (!this.isEmpty(router.config[i].path) && !this.isUnprotectedResource(router.config[i].path)) {
this.msalAngularConfig.unprotectedResources.push(router.config[i].path);

@@ -184,2 +184,2 @@ }

export { ɵ0 };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXNhbC5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGF6dXJlL21zYWwtYW5ndWxhci8iLCJzb3VyY2VzIjpbInNyYy9tc2FsLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE9BQU8sRUFBQyxNQUFNLEVBQUUsVUFBVSxFQUFpQixNQUFNLGVBQWUsQ0FBQztBQUNqRSxPQUFPLEVBQ0gsb0JBQW9CLEVBTXZCLE1BQU0sTUFBTSxDQUFDO0FBQ2QsT0FBTyxFQUNGLE1BQU0sRUFDVixNQUFNLGlCQUFpQixDQUFDO0FBQ3pCLE9BQU8sRUFBQyxnQkFBZ0IsRUFBQyxNQUFNLHFCQUFxQixDQUFDO0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1TQUxFcnJvcihlcnJvclBhcnRzWzBdLCBlcnJvclBhcnRzWzFdKTtcclxuICAgICAgICAgICAgaWYgKHRoaXMuZ2V0TG9naW5JblByb2dyZXNzKCkpIHtcclxuICAgICAgICAgICAgICAgIGJyb2FkY2FzdFNlcnZpY2UuYnJvYWRjYXN0KCdtc2FsOmxvZ2luRmFpbHVyZScsIG1zYWxFcnJvcik7XHJcbiAgICAgICAgICAgICAgICB0aGlzLnNldGxvZ2luSW5Qcm9ncmVzcyhmYWxzZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZWxzZSBpZiAodGhpcy5nZXRBY3F1aXJlVG9rZW5JblByb2dyZXNzKCkpIHtcclxuICAgICAgICAgICAgICAgIGJyb2FkY2FzdFNlcnZpY2UuYnJvYWRjYXN0KCdtc2FsOmFjcXVpcmVUb2tlbkZhaWx1cmUnLCBtc2FsRXJyb3IpO1xyXG4gICAgICAgICAgICAgICAgdGhpcy5zZXRBY3F1aXJlVG9rZW5JblByb2dyZXNzKGZhbHNlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0pO1xyXG5cclxuICAgICAgICB0aGlzLnJvdXRlci5ldmVudHMuc3Vic2NyaWJlKGV2ZW50ID0+IHtcclxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCByb3V0ZXIuY29uZmlnLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXJvdXRlci5jb25maWdbaV0uY2FuQWN0aXZhdGUpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5tc2FsQW5ndWxhckNvbmZpZy51bnByb3RlY3RlZFJlc291cmNlcykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXRoaXMuaXNVbnByb3RlY3RlZFJlc291cmNlKHJvdXRlci5jb25maWdbaV0ucGF0aCkgJiYgIXRoaXMuaXNFbXB0eShyb3V0ZXIuY29uZmlnW2ldLnBhdGgpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm1zYWxBbmd1bGFyQ29uZmlnLnVucHJvdGVjdGVkUmVzb3VyY2VzLnB1c2gocm91dGVyLmNvbmZpZ1tpXS5wYXRoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0pO1xyXG4gICAgfVxyXG5cclxuICAgIHByaXZhdGUgaXNVbnByb3RlY3RlZFJlc291cmNlKHVybDogc3RyaW5nKTogYm9vbGVhbiB7XHJcbiAgICAgICAgY29uc3QgZnJhbWV3b3JrVW5wcm90ZWN0ZWRSZXNvdXJjZXMgPSB0aGlzLm1zYWxDb25maWcuZnJhbWV3b3JrICYmIHRoaXMubXNhbENvbmZpZy5mcmFtZXdvcmsudW5wcm90ZWN0ZWRSZXNvdXJjZXM7XHJcbiAgICAgICAgY29uc3QgY29uZmlnVW5wcm90ZWN0ZWRSZXNvdXJjZXMgPSB0aGlzLm1zYWxBbmd1bGFyQ29uZmlnLnVucHJvdGVjdGVkUmVzb3VyY2VzIHx8IFtdO1xyXG5cclxuICAgICAgICBjb25zdCB1bnByb3RlY3RlZFJlc291cmNlcyA9IGZyYW1ld29ya1VucHJvdGVjdGVkUmVzb3VyY2VzICYmIGZyYW1ld29ya1VucHJvdGVjdGVkUmVzb3VyY2VzLmxlbmd0aCA/IGZyYW1ld29ya1VucHJvdGVjdGVkUmVzb3VyY2VzIDogY29uZmlnVW5wcm90ZWN0ZWRSZXNvdXJjZXM7XHJcblxyXG4gICAgICAgIHJldHVybiB1bnByb3RlY3RlZFJlc291cmNlcy5zb21lKHJlc291cmNlID0+IHVybC5pbmRleE9mKHJlc291cmNlKSA+IC0xKTtcclxuICAgIH1cclxuXHJcbiAgICBwcml2YXRlIGlzRW1wdHkoc3RyOiBzdHJpbmcpOiBib29sZWFuIHtcclxuICAgICAgICByZXR1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DYWxsYmFjaygoYXV0aEVycm9yOiBBdXRoRXJyb3IsIGF1dGhSZXNwb25zZTogQXV0aFJlc3BvbnNlKSA9PiB7XHJcbiAgICAgICAgICAgIGlmIChhdXRoUmVzcG9uc2UpIHtcclxuICAgICAgICAgICAgICAgIGlmIChhdXRoUmVzcG9uc2UudG9rZW5UeXBlID09PSBcImlkX3Rva2VuXCIpIHtcclxuICAgICAgICAgICAgICAgICAgICB0aGlzLmJyb2FkY2FzdFNlcnZpY2UuYnJvYWRjYXN0KFwibXNhbDpsb2dpblN1Y2Nlc3NcIiwgYXV0aFJlc3BvbnNlKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5icm9hZGNhc3RTZXJ2aWNlLmJyb2FkY2FzdChcIm1zYWw6YWNxdWlyZVRva2VuU3VjY2Vzc1wiLCBhdXRoUmVzcG9uc2UpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgIGlmIChlcnJvclJlY2VpdmVkQ2FsbGJhY2spIHtcclxuICAgICAgICAgICAgICAgICAgICAoYXV0aE9yVG9rZW5DYWxsYmFjayBhcyB0b2tlblJlY2VpdmVkQ2FsbGJhY2spKGF1dGhSZXNwb25zZSk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIChhdXRoT3JUb2tlbkNhbGxiYWNrIGFzIGF1dGhSZXNwb25zZUNhbGxiYWNrKShudWxsLCBhdXRoUmVzcG9uc2UpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgfSBlbHNlIGlmIChhdXRoRXJyb3IpIHtcclxuICAgICAgICAgICAgICAgIGlmIChhdXRoUmVzcG9uc2UudG9rZW5UeXBlID09PSBcImlkX3Rva2VuXCIpIHtcclxuICAgICAgICAgICAgICAgICAgICB0aGlzLmJyb2FkY2FzdFNlcnZpY2UuYnJvYWRjYXN0KFwibXNhbDpsb2dpbkZhaWx1cmVcIiwgYXV0aEVycm9yKTtcclxuXHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYnJvYWRjYXN0U2VydmljZS5icm9hZGNhc3QoXCJtc2FsOmFjcXVpcmVUb2tlbkZhaWx1cmVcIiwgYXV0aEVycm9yKTtcclxuICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICBpZiAoZXJyb3JSZWNlaXZlZENhbGxiYWNrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZXJyb3JSZWNlaXZlZENhbGxiYWNrKGF1dGhFcnJvciwgYXV0aFJlc3BvbnNlLmFjY291bnRTdGF0ZSk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIChhdXRoT3JUb2tlbkNhbGxiYWNrIGFzIGF1dGhSZXNwb25zZUNhbGxiYWNrKShhdXRoRXJyb3IpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0pO1xyXG4gICAgfVxyXG5cclxuICAgIHB1YmxpYyBjbGVhckNhY2hlRm9yU2NvcGUoYWNjZXNzVG9rZW46IHN0cmluZykge1xyXG4gICAgICAgIHJldHVybiBzdXBlci5jbGVhckNhY2hlRm9yU2NvcGUoYWNjZXNzVG9rZW4pO1xyXG4gICAgfVxyXG5cclxuICAgIHB1YmxpYyBnZXRTY29wZXNGb3JFbmRwb2ludChlbmRwb2ludDogc3RyaW5nKSA6IEFycmF5PHN0cmluZz4ge1xyXG4gICAgICAgIGlmICh0aGlzLm1zYWxDb25maWcuZnJhbWV3b3JrICYmIHRoaXMubXNhbENvbmZpZy5mcmFtZXdvcmsudW5wcm90ZWN0ZWRSZXNvdXJjZXMpIHtcclxuICAgICAgICAgICAgdGhpcy5nZXRMb2dnZXIoKS5pbmZvKFwibXNhbENvbmZpZy5mcmFtZXdvc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lLmRldGFpbC5zcGxpdCgnfCcpO1xyXG4gICAgICAgICAgICB2YXIgbXNhbEVycm9yID0gbmV3IE1TQUxFcnJvcihlcnJvclBhcnRzWzBdLCBlcnJvclBhcnRzWzFdKTtcclxuICAgICAgICAgICAgaWYgKHRoaXMuZ2V0TG9naW5JblByb2dyZXNzKCkpIHtcclxuICAgICAgICAgICAgICAgIGJyb2FkY2FzdFNlcnZpY2UuYnJvYWRjYXN0KCdtc2FsOmxvZ2luRmFpbHVyZScsIG1zYWxFcnJvcik7XHJcbiAgICAgICAgICAgICAgICB0aGlzLnNldGxvZ2luSW5Qcm9ncmVzcyhmYWxzZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZWxzZSBpZiAodGhpcy5nZXRBY3F1aXJlVG9rZW5JblByb2dyZXNzKCkpIHtcclxuICAgICAgICAgICAgICAgIGJyb2FkY2FzdFNlcnZpY2UuYnJvYWRjYXN0KCdtc2FsOmFjcXVpcmVUb2tlbkZhaWx1cmUnLCBtc2FsRXJyb3IpO1xyXG4gICAgICAgICAgICAgICAgdGhpcy5zZXRBY3F1aXJlVG9rZW5JblByb2dyZXNzKGZhbHNlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0pO1xyXG5cclxuICAgICAgICB0aGlzLnJvdXRlci5ldmVudHMuc3Vic2NyaWJlKGV2ZW50ID0+IHtcclxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCByb3V0ZXIuY29uZmlnLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXJvdXRlci5jb25maWdbaV0uY2FuQWN0aXZhdGUpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5tc2FsQW5ndWxhckNvbmZpZy51bnByb3RlY3RlZFJlc291cmNlcykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXRoaXMuaXNFbXB0eShyb3V0ZXIuY29uZmlnW2ldLnBhdGgpICYmICF0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SZWNlaXZlZENhbGxiYWNrKTogdm9pZCB7XHJcbiAgICAgICAgc3VwZXIuaGFuZGxlUmVkaXJlY3RDYWxsYmFjaygoYXV0aEVycm9yOiBBdXRoRXJyb3IsIGF1dGhSZXNwb25zZTogQXV0aFJlc3BvbnNlKSA9PiB7XHJcbiAgICAgICAgICAgIGlmIChhdXRoUmVzcG9uc2UpIHtcclxuICAgICAgICAgICAgICAgIGlmIChhdXRoUmVzcG9uc2UudG9rZW5UeXBlID09PSBcImlkX3Rva2VuXCIpIHtcclxuICAgICAgICAgICAgICAgICAgICB0aGlzLmJyb2FkY2FzdFNlcnZpY2UuYnJvYWRjYXN0KFwibXNhbDpsb2dpblN1Y2Nlc3NcIiwgYXV0aFJlc3BvbnNlKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5icm9hZGNhc3RTZXJ2aWNlLmJyb2FkY2FzdChcIm1zYWw6YWNxdWlyZVRva2VuU3VjY2Vzc1wiLCBhdXRoUmVzcG9uc2UpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgIGlmIChlcnJvclJlY2VpdmVkQ2FsbGJhY2spIHtcclxuICAgICAgICAgICAgICAgICAgICAoYXV0aE9yVG9rZW5DYWxsYmFjayBhcyB0b2tlblJlY2VpdmVkQ2FsbGJhY2spKGF1dGhSZXNwb25zZSk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIChhdXRoT3JUb2tlbkNhbGxiYWNrIGFzIGF1dGhSZXNwb25zZUNhbGxiYWNrKShudWxsLCBhdXRoUmVzcG9uc2UpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgfSBlbHNlIGlmIChhdXRoRXJyb3IpIHtcclxuICAgICAgICAgICAgICAgIGlmIChhdXRoUmVzcG9uc2UudG9rZW5UeXBlID09PSBcImlkX3Rva2VuXCIpIHtcclxuICAgICAgICAgICAgICAgICAgICB0aGlzLmJyb2FkY2FzdFNlcnZpY2UuYnJvYWRjYXN0KFwibXNhbDpsb2dpbkZhaWx1cmVcIiwgYXV0aEVycm9yKTtcclxuXHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYnJvYWRjYXN0U2VydmljZS5icm9hZGNhc3QoXCJtc2FsOmFjcXVpcmVUb2tlbkZhaWx1cmVcIiwgYXV0aEVycm9yKTtcclxuICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICBpZiAoZXJyb3JSZWNlaXZlZENhbGxiYWNrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgZXJyb3JSZWNlaXZlZENhbGxiYWNrKGF1dGhFcnJvciwgYXV0aFJlc3BvbnNlLmFjY291bnRTdGF0ZSk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIChhdXRoT3JUb2tlbkNhbGxiYWNrIGFzIGF1dGhSZXNwb25zZUNhbGxiYWNrKShhdXRoRXJyb3IpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0pO1xyXG4gICAgfVxyXG5cclxuICAgIHB1YmxpYyBjbGVhckNhY2hlRm9yU2NvcGUoYWNjZXNzVG9rZW46IHN0cmluZykge1xyXG4gICAgICAgIHJldHVybiBzdXBlci5jbGVhckNhY2hlRm9yU2NvcGUoYWNjZXNzVG9rZW4pO1xyXG4gICAgfVxyXG5cclxuICAgIHB1YmxpYyBnZXRTY29wZXNGb3JFbmRwb2ludChlbmRwb2ludDogc3RyaW5nKSA6IEFycmF5PHN0cmluZz4ge1xyXG4gICAgICAgIGlmICh0aGlzLm1zYWxDb25maWcuZnJhbWV3b3JrICYmIHRoaXMubXNhbENvbmZpZy5mcmFtZXdvcmsudW5wcm90ZWN0ZWRSZXNvdXJjZXMpIH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y5nZXRIb3N0RnJvbVVyaShzdXBlci5nZXRSZWRpcmVjdFVyaSgpKSkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBBcnJheTxzdHJpbmc+KHRoaXMubXNhbENvbmZpZy5hdXRoLmNsaWVudElkKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgIC8qXHJcbiAgICAgICAgICAgICAqIGluIGFuZ3VsYXIgbGV2ZWwsIHRoZSB1cmwgZm9yICRodHRwIGludGVyY2VwdG9yIGNhbGwgY291bGQgYmUgcmVsYXRpdmUgdXJsLFxyXG4gICAgICAgICAgICAgKiBpZiBpdCdzIHJlbGF0aXZlIGNhbGwsIHdlJ2xsIHRyZWF0IGl0IGFzIGFwcCBiYWNrZW5kIGNhbGwuXHJcbiAgICAgICAgICAgICAqL1xyXG4gICAgICAgICAgICByZXR1cm4gbmV3IEFycmF5PHN0cmluZz4odGhpcy5tc2FsQ29uZmlnLmF1dGguY2xpZW50SWQpO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgLy8gaWYgbm90IHRoZSBhcHAncyBvd24gYmFja2VuZCBvciBub3QgYSBkb21haW4gbGlzdGVkIGluIHRoZSBlbmRwb2ludHMgc3RydWN0dXJlXHJcbiAgICAgICAgcmV0dXJuIG51bGw7XHJcbiAgICB9XHJcbn1cclxuXHJcbiJdfQ==

@@ -1,2 +0,2 @@

import { __decorate, __param } from "tslib";
import { __awaiter, __decorate, __generator, __param } from "tslib";
import { Inject, Injectable } from "@angular/core";

@@ -7,2 +7,3 @@ import { ActivatedRoute, ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, } from "@angular/router";

import { BroadcastService } from "./broadcast.service";
import { InteractionRequiredAuthError } from "msal";
import { MSAL_CONFIG, MSAL_CONFIG_ANGULAR } from "./constants";

@@ -22,2 +23,47 @@ import { UrlUtils } from "msal/lib-commonjs/utils/UrlUtils";

}
/**
* Builds the absolute url for the destination page
* @param path Relative path of requested page
* @returns Full destination url
*/
MsalGuard.prototype.getDestinationUrl = function (path) {
// Absolute base url for the application (default to origin if base element not present)
var baseElements = document.getElementsByTagName("base");
var baseUrl = this.location.normalize(baseElements.length ? baseElements[0].href : window.location.origin);
// Path of page (including hash, if using hash routing)
var pathUrl = this.location.prepareExternalUrl(path);
// Hash location strategy
if (pathUrl.startsWith("#")) {
return baseUrl + "/" + pathUrl;
}
// If using path location strategy, pathUrl will include the relative portion of the base path (e.g. /base/page).
// Since baseUrl also includes /base, can just concatentate baseUrl + path
return "" + baseUrl + path;
};
/**
* Interactively prompt the user to login
* @param url Path of the requested page
*/
MsalGuard.prototype.loginInteractively = function (url) {
return __awaiter(this, void 0, void 0, function () {
var redirectStartPage;
return __generator(this, function (_a) {
if (this.msalAngularConfig.popUp) {
return [2 /*return*/, this.authService.loginPopup({
scopes: this.msalAngularConfig.consentScopes,
extraQueryParameters: this.msalAngularConfig.extraQueryParameters
})
.then(function () { return true; })
.catch(function () { return false; })];
}
redirectStartPage = this.getDestinationUrl(url);
this.authService.loginRedirect({
redirectStartPage: redirectStartPage,
scopes: this.msalAngularConfig.consentScopes,
extraQueryParameters: this.msalAngularConfig.extraQueryParameters
});
return [2 /*return*/];
});
});
};
MsalGuard.prototype.canActivate = function (route, state) {

@@ -33,30 +79,16 @@ var _this = this;

if (!this.authService.getAccount()) {
if (this.msalAngularConfig.popUp) {
return this.authService.loginPopup({
scopes: this.msalAngularConfig.consentScopes,
extraQueryParameters: this.msalAngularConfig.extraQueryParameters
})
.then(function () { return true; })
.catch(function () { return false; });
return this.loginInteractively(state.url);
}
return this.authService.acquireTokenSilent({
scopes: [this.msalConfig.auth.clientId]
})
.then(function () { return true; })
.catch(function (error) {
if (InteractionRequiredAuthError.isInteractionRequiredError(error.errorCode)) {
_this.authService.getLogger().info("Interaction required error in MSAL Guard, prompting for interaction.");
return _this.loginInteractively(state.url);
}
var routePath = "" + window.location.origin + state.url;
this.authService.loginRedirect({
redirectStartPage: routePath,
scopes: this.msalAngularConfig.consentScopes,
extraQueryParameters: this.msalAngularConfig.extraQueryParameters
});
}
else {
return this.authService.acquireTokenSilent({
scopes: [this.msalConfig.auth.clientId]
})
.then(function (result) {
_this.broadcastService.broadcast("msal:loginSuccess", result);
return true;
})
.catch(function (error) {
_this.broadcastService.broadcast("msal:loginFailure", error);
return false;
});
}
_this.authService.getLogger().error("Non-interaction error in MSAL Guard: " + error.errorMessage);
throw error;
});
};

@@ -81,2 +113,2 @@ MsalGuard.ctorParameters = function () { return [

export { MsalGuard };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXNhbC1ndWFyZC5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGF6dXJlL21zYWwtYW5ndWxhci8iLCJzb3VyY2VzIjpbInNyYy9tc2FsLWd1YXJkLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ25ELE9BQU8sRUFDSCxjQUFjLEVBQ2Qsc0JBQXNCLEVBQUUsV0FBVyxFQUFFLE1BQU0sRUFDM0MsbUJBQW1CLEdBQ3RCLE1BQU0saUJBQWlCLENBQUM7QUFDekIsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQzdDLE9BQU8sRUFBRSxRQUFRLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUM3RCxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUd2RCxPQUFPLEVBQUUsV0FBVyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sYUFBYSxDQUFDO0FBQy9ELE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUM1RCxPQUFPLEVBQUUs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cy5hdXRoU2VydmljZS5nZXRBY2NvdW50KCkpIHtcclxuICAgICAgICAgICAgaWYgKHRoaXMubXNhbEFuZ3VsYXJDb25maWcucG9wVXApIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmF1dGhTZXJ2aWNlLmxvZ2luUG9wdXAoe1xyXG4gICAgICAgICAgICAgICAgICAgIHNjb3BlczogdGhpcy5tc2FsQW5ndWxhckNvbmZpZy5jb25zZW50U2NvcGVzLFxyXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhUXVlcnlQYXJhbWV0ZXJzOiB0aGlzLm1zYWxBbmd1bGFyQ29uZmlnLmV4dHJhUXVlcnlQYXJhbWV0ZXJzXHJcbiAgICAgICAgICAgICAgICB9KVxyXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHRydWUpXHJcbiAgICAgICAgICAgICAgICAgICAgLmNhdGNoKCgpID0+IGZhbHNlKTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgY29uc3Qgcm91dGVQYXRoID0gYCR7d2luZG93LmxvY2F0aW9uLm9yaWdpbn0ke3N0YXRlLnVybH1gO1xyXG5cclxuICAgICAgICAgICAgdGhpcy5hdXRoU2VydmljZS5sb2dpblJlZGlyZWN0KHtcclxuICAgICAgICAgICAgICAgIHJlZGlyZWN0U3RhcnRQYWdlOiByb3V0ZVBhdGgsXHJcbiAgICAgICAgICAgICAgICBzY29wZXM6IHRoaXMubXNhbEFuZ3VsYXJDb25maWcuY29uc2VudFNjb3BlcyxcclxuICAgICAgICAgICAgICAgIGV4dHJhUXVlcnlQYXJhbWV0ZXJzOiB0aGlzLm1zYWxBbmd1bGFyQ29uZmlnLmV4dHJhUXVlcnlQYXJhbWV0ZXJzXHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgIHJldHVybiB0aGlzLmF1dGhTZXJ2aWNlLmFjcXVpcmVUb2tlblNpbGVudCh7XHJcbiAgICAgICAgICAgICAgICBzY29wZXM6IFt0aGlzLm1zYWxDb25maWcuYXV0aC5jbGllbnRJZF1cclxuICAgICAgICAgICAgfSlcclxuICAgICAgICAgICAgICAgIC50aGVuKChyZXN1bHQ6IEF1dGhSZXNwb25zZSkgPT4ge1xyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYnJvYWRjYXN0U2VydmljZS5icm9hZGNhc3QoXCJtc2FsOmxvZ2luU3VjY2Vzc1wiLCAgcmVzdWx0KTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgICAgICAgIH0pXHJcbiAgICAgICAgICAgICAgICAuY2F0Y2goKGVycm9yOiBBdXRoRXJyb3IpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICB0aGlzLmJyb2FkY2FzdFNlcnZpY2UuYnJvYWRjYXN0KFwibXNhbDpsb2dpbkZhaWx1cmVcIiwgZXJyb3IpO1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICB9XHJcblxyXG59XHJcbiJdfQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXNhbC1ndWFyZC5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGF6dXJlL21zYWwtYW5ndWxhci8iLCJzb3VyY2VzIjpbInNyYy9tc2FsLWd1YXJkLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ25ELE9BQU8sRUFDSCxjQUFjLEVBQ2Qsc0JBQXNCLEVBQUUsV0FBVyxFQUFFLE1BQU0sRUFDM0MsbUJBQW1CLEdBQ3RCLE1BQU0saUJBQWlCLENBQUM7QUFDekIsT0FBTyxFQUFFLFd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hFcnJvcikgPT4ge1xyXG4gICAgICAgICAgICAgICAgaWYgKEludGVyYWN0aW9uUmVxdWlyZWRBdXRoRXJyb3IuaXNJbnRlcmFjdGlvblJlcXVpcmVkRXJyb3IoZXJyb3IuZXJyb3JDb2RlKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYXV0aFNlcnZpY2UuZ2V0TG9nZ2VyKCkuaW5mbyhgSW50ZXJhY3Rpb24gcmVxdWlyZWQgZXJyb3IgaW4gTVNBTCBHdWFyZCwgcHJvbXB0aW5nIGZvciBpbnRlcmFjdGlvbi5gKTtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5sb2dpbkludGVyYWN0aXZlbHkoc3RhdGUudXJsKTtcclxuICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICB0aGlzLmF1dGhTZXJ2aWNlLmdldExvZ2dlcigpLmVycm9yKGBOb24taW50ZXJhY3Rpb24gZXJyb3IgaW4gTVNBTCBHdWFyZDogJHtlcnJvci5lcnJvck1lc3NhZ2V9YCk7XHJcbiAgICAgICAgICAgICAgICB0aHJvdyBlcnJvcjtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICB9XHJcblxyXG59XHJcbiJdfQ==

@@ -40,3 +40,3 @@ import { __assign, __decorate, __extends, __param } from "tslib";

if (_this.msalAngularConfig.unprotectedResources) {
if (!_this.isUnprotectedResource(router.config[i].path) && !_this.isEmpty(router.config[i].path)) {
if (!_this.isEmpty(router.config[i].path) && !_this.isUnprotectedResource(router.config[i].path)) {
_this.msalAngularConfig.unprotectedResources.push(router.config[i].path);

@@ -191,2 +191,2 @@ }

export { ɵ0 };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXNhbC5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGF6dXJlL21zYWwtYW5ndWxhci8iLCJzb3VyY2VzIjpbInNyYy9tc2FsLnNlcnZpY2UudHMiX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cbiAgICAgICAgICAgIHRoaXMuZ2V0TG9nZ2VyKCkudmVyYm9zZShcInBvcFVwSGFzaENoYW5nZWQgXCIpO1xyXG4gICAgICAgIH0pO1xyXG5cclxuICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcignbXNhbDpwb3BVcENsb3NlZCcsIChlOiBDdXN0b21FdmVudCkgPT4ge1xyXG4gICAgICAgICAgICB2YXIgZXJyb3JQYXJ0cyA9IGUuZGV0YWlsLnNwbGl0KCd8Jyk7XHJcbiAgICAgICAgICAgIHZhciBtc2FsRXJyb3IgPSBuZXcgTVNBTEVycm9yKGVycm9yUGFydHNbMF0sIGVycm9yUGFydHNbMV0pO1xyXG4gICAgICAgICAgICBpZiAodGhpcy5nZXRMb2dpbkluUHJvZ3Jlc3MoKSkge1xyXG4gICAgICAgICAgICAgICAgYnJvYWRjYXN0U2VydmljZS5icm9hZGNhc3QoJ21zYWw6bG9naW5GYWlsdXJlJywgbXNhbEVycm9yKTtcclxuICAgICAgICAgICAgICAgIHRoaXMuc2V0bG9naW5JblByb2dyZXNzKGZhbHNlKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBlbHNlIGlmICh0aGlzLmdldEFjcXVpcmVUb2tlbkluUHJvZ3Jlc3MoKSkge1xyXG4gICAgICAgICAgICAgICAgYnJvYWRjYXN0U2VydmljZS5icm9hZGNhc3QoJ21zYWw6YWNxdWlyZVRva2VuRmFpbHVyZScsIG1zYWxFcnJvcik7XHJcbiAgICAgICAgICAgICAgICB0aGlzLnNldEFjcXVpcmVUb2tlbkluUHJvZ3Jlc3MoZmFsc2UpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcblxyXG4gICAgICAgIHRoaXMucm91dGVyLmV2ZW50cy5zdWJzY3JpYmUoZXZlbnQgPT4ge1xyXG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHJvdXRlci5jb25maWcubGVuZ3RoOyBpKyspIHtcclxuICAgICAgICAgICAgICAgIGlmICghcm91dGVyLmNvbmZpZ1tpXS5jYW5BY3RpdmF0ZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLm1zYWxBbmd1bGFyQ29uZmlnLnVucHJvdGVjdGVkUmVzb3VyY2VzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdGhpcy5pc1VucHJvdGVjdGVkUmVzb3VyY2Uocm91dGVyLmNvbmZpZ1tpXS5wYXRoKSAmJiAhdGhpcy5pc0VtcHR5KHJvdXRlci5jb25maWdbaV0ucGF0aCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubXNhbEFuZ3VsYXJDb25maWcudW5wcm90ZWN0ZWRSZXNvdXJjZXMucHVzaChyb3V0ZXIuY29uZmlnW2ldLnBhdGgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICB9XHJcblxyXG4gICAgcHJpdmF0ZSBpc1VucHJvdGVjdGVkUmVzb3VyY2UodXJsOiBzdHJpbmcpOiBib29sZWFuIHtcclxuICAgICAgICBjb25zdCBmcmFtZXdvcmtVbnByb3RlY3RlZFJlc291cmNlcyA9IHRoaXMubXNhbENvbmZpZy5mcmFtZXdvcmsgJiYgdGhpcy5tc2FsQ29uZmlnLmZyYW1ld29yay51bnByb3RlY3RlZFJlc291cmNlcztcclxuICAgICAgICBjb25zdCBjb25maWdVbnByb3RlY3RlZFJlc291cmNlcyA9IHRoaXMubXNhbEFuZ3VsYXJDb25maWcudW5wcm90ZWN0ZWRSZXNvdXJjZXMgfHwgW107XHJcblxyXG4gICAgICAgIGNvbnN0IHVucHJvdGVjdGVkUmVzb3VyY2VzID0gZnJhbWV3b3JrVW5wcm90ZWN0ZWRSZXNvdXJjZXMgJiYgZnJhbWV3b3JrVW5wcm90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ICAgICAgICAgICAgICAgICAgKGF1dGhPclRva2VuQ2FsbGJhY2sgYXMgYXV0aFJlc3BvbnNlQ2FsbGJhY2spKG51bGwsIGF1dGhSZXNwb25zZSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGF1dGhFcnJvcikge1xyXG4gICAgICAgICAgICAgICAgaWYgKGF1dGhSZXNwb25zZS50b2tlblR5cGUgPT09IFwiaWRfdG9rZW5cIikge1xyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYnJvYWRjYXN0U2VydmljZS5icm9hZGNhc3QoXCJtc2FsOmxvZ2luRmFpbHVyZVwiLCBhdXRoRXJyb3IpO1xyXG5cclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5icm9hZGNhc3RTZXJ2aWNlLmJyb2FkY2FzdChcIm1zYWw6YWNxdWlyZVRva2VuRmFpbHVyZVwiLCBhdXRoRXJyb3IpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgIGlmIChlcnJvclJlY2VpdmVkQ2FsbGJhY2spIHtcclxuICAgICAgICAgICAgICAgICAgICBlcnJvclJlY2VpdmVkQ2FsbGJhY2soYXV0aEVycm9yLCBhdXRoUmVzcG9uc2UuYWNjb3VudFN0YXRlKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgKGF1dGhPclRva2VuQ2FsbGJhY2sgYXMgYXV0aFJlc3BvbnNlQ2FsbGJhY2spKGF1dGhFcnJvcik7XHJcbiAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICB9XHJcblxyXG4gICAgcHVibGljIGNsZWFyQ2FjaGVGb3JTY29wZShhY2Nlc3NUb2tlbjogc3RyaW5nKSB7XHJcbiAgICAgICAgcmV0dXJuIHN1cGVyLmNsZ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odHRwcywgbmVlZHMgdG8gbWF0Y2ggd2l0aCBhcHAgaG9zdFxyXG4gICAgICAgICAqL1xyXG4gICAgICAgIGlmIChlbmRwb2ludC5pbmRleE9mKFwiaHR0cDovL1wiKSA+IC0xIHx8IGVuZHBvaW50LmluZGV4T2YoXCJodHRwczovL1wiKSA+IC0xKSB7XHJcbiAgICAgICAgICAgIGlmIChVcmxVdGlscy5nZXRIb3N0RnJvbVVyaShlbmRwb2ludCkgPT09IFVybFV0aWxzLmdldEhvc3RGcm9tVXJpKHN1cGVyLmdldFJlZGlyZWN0VXJpKCkpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEFycmF5PHN0cmluZz4odGhpcy5tc2FsQ29uZmlnLmF1dGguY2xpZW50SWQpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgLypcclxuICAgICAgICAgICAgICogaW4gYW5ndWxhciBsZXZlbCwgdGhlIHVybCBmb3IgJGh0dHAgaW50ZXJjZXB0b3IgY2FsbCBjb3VsZCBiZSByZWxhdGl2ZSB1cmwsXHJcbiAgICAgICAgICAgICAqIGlmIGl0J3MgcmVsYXRpdmUgY2FsbCwgd2UnbGwgdHJlYXQgaXQgYXMgYXBwIGJhY2tlbmQgY2FsbC5cclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgIHJldHVybiBuZXcgQXJyYXk8c3RyaW5nPih0aGlzLm1zYWxDb25maWcuYXV0aC5jbGllbnRJZCk7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICAvLyBpZiBub3QgdGhlIGFwcCdzIG93biBiYWNrZW5kIG9yIG5vdCBhIGRvbWFpbiBsaXN0ZWQgaW4gdGhlIGVuZHBvaW50cyBzdHJ1Y3R1cmVcclxuICAgICAgICByZXR1cm4gbnVsbDtcclxuICAgIH1cclxufVxyXG5cclxuIl19
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibX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50cy5zdWJzY3JpYmUoZXZlbnQgPT4ge1xyXG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHJvdXRlci5jb25maWcubGVuZ3RoOyBpKyspIHtcclxuICAgICAgICAgICAgICAgIGlmICghcm91dGVyLmNvbmZpZ1tpXS5jYW5BY3RpdmF0ZSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLm1zYWxBbmd1bGFyQ29uZmlnLnVucHJvdGVjdGVkUmVzb3VyY2VzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdGhpcy5pc0VtcHR5KHJvdXRlci5jb25maWdbaV0ucGF0aCkgJiYgIXRoaXMuaXNVbnByb3RlY3RlZFJlc291cmNlKHJvdXRlci5jb25maWdbaV0ucGF0aCkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubXNhbEFuZ3VsYXJDb25maWcudW5wcm90ZWN0ZWRSZXNvdXJjZXMucHVzaChyb3V0ZXIuY29uZmlnW2ldLnBhdGgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICB9XHJcblxyXG4gICAgcHJpdmF0ZSBpc1VucHJvdGVjdGVkUmVzb3VyY2UodXJsOiBzdHJpbmcpOiBib29sZWFuIHtcclxuICAgICAgICBjb25zdCBmcmFtZXdvcmtVbnByb3RlY3RlZFJlc291cmNlcyA9IHRoaXMubXNhbENvbmZpZy5mcmFtZXdvcmsgJiYgdGhpcy5tc2FsQ29uZmlnLmZyYW1ld29yay51bnByb3RlY3RlZFJlc291cmNlcztcclxuICAgICAgICBjb25zdCBjb25maWdVbnByb3RlY3RlZFJlc291cmNlcyA9IHRoaXMubXNhbEFuZ3VsYXJDb25maWcudW5wcm90ZWN0ZWRSZXNvdXJjZXMgfHwgW107XHJcblxyXG4g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b2tlbkNhbGxiYWNrIGFzIHRva2VuUmVjZWl2ZWRDYWxsYmFjaykoYXV0aFJlc3BvbnNlKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgKGF1dGhPclRva2VuQ2FsbGJhY2sgYXMgYXV0aFJlc3BvbnNlQ2FsbGJhY2spKG51bGwsIGF1dGhSZXNwb25zZSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGF1dGhFcnJvcikge1xyXG4gICAgICAgICAgICAgICAgaWYgKGF1dGhSZXNwb25zZS50b2tlblR5cGUgPT09IFwiaWRfdG9rZW5cIikge1xyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYnJvYWRjYXN0U2VydmljZS5icm9hZGNhc3QoXCJtc2FsOmxvZ2luRmFpbHVyZVwiLCBhdXRoRXJyb3IpO1xyXG5cclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5icm9hZGNhc3RTZXJ2aWNlLmJyb2FkY2FzdChcIm1zYWw6YWNxdWlyZVRva2VuRmFpbHVyZVwiLCBhdXRoRXJyb3IpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgIGlmIChlcnJvclJlY2VpdmVkQ2FsbGJhY2spIHtcclxuICAgICAgICAgICAgICAgICAgICBlcnJvclJlY2VpdmVkQ2FsbGJhY2soYXV0aEVycm9yLCBhdXRoUmVzcG9uc2UuYWNjb3VudFN0YXRlKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgKGF1dGhPclRva2VuQ2FsbGJhY2sgYXMgYXV0aFJlc3BvbnNlQ2FsbGJhY2spKGF1dGhFcnJvcik7XHJcbiAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICB9X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1cmVcclxuICAgICAgICByZXR1cm4gbnVsbDtcclxuICAgIH1cclxufVxyXG5cclxuIl19

@@ -1,6 +0,6 @@

import { __decorate, __param } from 'tslib';
import { __decorate, __param, __awaiter } from 'tslib';
import { Injectable, InjectionToken, Inject, NgModule } from '@angular/core';
import { BehaviorSubject, from } from 'rxjs';
import { filter, map, mergeMap, tap } from 'rxjs/operators';
import { UserAgentApplication } from 'msal';
import { UserAgentApplication, InteractionRequiredAuthError } from 'msal';
import { Router, ActivatedRoute } from '@angular/router';

@@ -102,3 +102,3 @@ import { UrlUtils } from 'msal/lib-commonjs/utils/UrlUtils';

if (this.msalAngularConfig.unprotectedResources) {
if (!this.isUnprotectedResource(router.config[i].path) && !this.isEmpty(router.config[i].path)) {
if (!this.isEmpty(router.config[i].path) && !this.isUnprotectedResource(router.config[i].path)) {
this.msalAngularConfig.unprotectedResources.push(router.config[i].path);

@@ -257,11 +257,27 @@ }

}
canActivate(route, state) {
this.authService.getLogger().verbose("location change event from old url to new url");
// If a page with MSAL Guard is set as the redirect for acquireTokenSilent,
// short-circuit to prevent redirecting or popups.
if (UrlUtils.urlContainsHash(window.location.hash) && WindowUtils.isInIframe()) {
this.authService.getLogger().warning("redirectUri set to page with MSAL Guard. It is recommended to not set redirectUri to a page that requires authentication.");
return false;
/**
* Builds the absolute url for the destination page
* @param path Relative path of requested page
* @returns Full destination url
*/
getDestinationUrl(path) {
// Absolute base url for the application (default to origin if base element not present)
const baseElements = document.getElementsByTagName("base");
const baseUrl = this.location.normalize(baseElements.length ? baseElements[0].href : window.location.origin);
// Path of page (including hash, if using hash routing)
const pathUrl = this.location.prepareExternalUrl(path);
// Hash location strategy
if (pathUrl.startsWith("#")) {
return `${baseUrl}/${pathUrl}`;
}
if (!this.authService.getAccount()) {
// If using path location strategy, pathUrl will include the relative portion of the base path (e.g. /base/page).
// Since baseUrl also includes /base, can just concatentate baseUrl + path
return `${baseUrl}${path}`;
}
/**
* Interactively prompt the user to login
* @param url Path of the requested page
*/
loginInteractively(url) {
return __awaiter(this, void 0, void 0, function* () {
if (this.msalAngularConfig.popUp) {

@@ -275,22 +291,33 @@ return this.authService.loginPopup({

}
const routePath = `${window.location.origin}${state.url}`;
const redirectStartPage = this.getDestinationUrl(url);
this.authService.loginRedirect({
redirectStartPage: routePath,
redirectStartPage,
scopes: this.msalAngularConfig.consentScopes,
extraQueryParameters: this.msalAngularConfig.extraQueryParameters
});
});
}
canActivate(route, state) {
this.authService.getLogger().verbose("location change event from old url to new url");
// If a page with MSAL Guard is set as the redirect for acquireTokenSilent,
// short-circuit to prevent redirecting or popups.
if (UrlUtils.urlContainsHash(window.location.hash) && WindowUtils.isInIframe()) {
this.authService.getLogger().warning("redirectUri set to page with MSAL Guard. It is recommended to not set redirectUri to a page that requires authentication.");
return false;
}
else {
return this.authService.acquireTokenSilent({
scopes: [this.msalConfig.auth.clientId]
})
.then((result) => {
this.broadcastService.broadcast("msal:loginSuccess", result);
return true;
})
.catch((error) => {
this.broadcastService.broadcast("msal:loginFailure", error);
return false;
});
if (!this.authService.getAccount()) {
return this.loginInteractively(state.url);
}
return this.authService.acquireTokenSilent({
scopes: [this.msalConfig.auth.clientId]
})
.then(() => true)
.catch((error) => {
if (InteractionRequiredAuthError.isInteractionRequiredError(error.errorCode)) {
this.authService.getLogger().info(`Interaction required error in MSAL Guard, prompting for interaction.`);
return this.loginInteractively(state.url);
}
this.authService.getLogger().error(`Non-interaction error in MSAL Guard: ${error.errorMessage}`);
throw error;
});
}

@@ -297,0 +324,0 @@ };

@@ -1,6 +0,6 @@

import { __decorate, __assign, __extends, __param } from 'tslib';
import { __decorate, __assign, __extends, __param, __awaiter, __generator } from 'tslib';
import { Injectable, InjectionToken, Inject, NgModule } from '@angular/core';
import { BehaviorSubject, from } from 'rxjs';
import { filter, map, mergeMap, tap } from 'rxjs/operators';
import { UserAgentApplication } from 'msal';
import { UserAgentApplication, InteractionRequiredAuthError } from 'msal';
import { Router, ActivatedRoute } from '@angular/router';

@@ -117,3 +117,3 @@ import { UrlUtils } from 'msal/lib-commonjs/utils/UrlUtils';

if (_this.msalAngularConfig.unprotectedResources) {
if (!_this.isUnprotectedResource(router.config[i].path) && !_this.isEmpty(router.config[i].path)) {
if (!_this.isEmpty(router.config[i].path) && !_this.isUnprotectedResource(router.config[i].path)) {
_this.msalAngularConfig.unprotectedResources.push(router.config[i].path);

@@ -278,2 +278,47 @@ }

}
/**
* Builds the absolute url for the destination page
* @param path Relative path of requested page
* @returns Full destination url
*/
MsalGuard.prototype.getDestinationUrl = function (path) {
// Absolute base url for the application (default to origin if base element not present)
var baseElements = document.getElementsByTagName("base");
var baseUrl = this.location.normalize(baseElements.length ? baseElements[0].href : window.location.origin);
// Path of page (including hash, if using hash routing)
var pathUrl = this.location.prepareExternalUrl(path);
// Hash location strategy
if (pathUrl.startsWith("#")) {
return baseUrl + "/" + pathUrl;
}
// If using path location strategy, pathUrl will include the relative portion of the base path (e.g. /base/page).
// Since baseUrl also includes /base, can just concatentate baseUrl + path
return "" + baseUrl + path;
};
/**
* Interactively prompt the user to login
* @param url Path of the requested page
*/
MsalGuard.prototype.loginInteractively = function (url) {
return __awaiter(this, void 0, void 0, function () {
var redirectStartPage;
return __generator(this, function (_a) {
if (this.msalAngularConfig.popUp) {
return [2 /*return*/, this.authService.loginPopup({
scopes: this.msalAngularConfig.consentScopes,
extraQueryParameters: this.msalAngularConfig.extraQueryParameters
})
.then(function () { return true; })
.catch(function () { return false; })];
}
redirectStartPage = this.getDestinationUrl(url);
this.authService.loginRedirect({
redirectStartPage: redirectStartPage,
scopes: this.msalAngularConfig.consentScopes,
extraQueryParameters: this.msalAngularConfig.extraQueryParameters
});
return [2 /*return*/];
});
});
};
MsalGuard.prototype.canActivate = function (route, state) {

@@ -289,30 +334,16 @@ var _this = this;

if (!this.authService.getAccount()) {
if (this.msalAngularConfig.popUp) {
return this.authService.loginPopup({
scopes: this.msalAngularConfig.consentScopes,
extraQueryParameters: this.msalAngularConfig.extraQueryParameters
})
.then(function () { return true; })
.catch(function () { return false; });
return this.loginInteractively(state.url);
}
return this.authService.acquireTokenSilent({
scopes: [this.msalConfig.auth.clientId]
})
.then(function () { return true; })
.catch(function (error) {
if (InteractionRequiredAuthError.isInteractionRequiredError(error.errorCode)) {
_this.authService.getLogger().info("Interaction required error in MSAL Guard, prompting for interaction.");
return _this.loginInteractively(state.url);
}
var routePath = "" + window.location.origin + state.url;
this.authService.loginRedirect({
redirectStartPage: routePath,
scopes: this.msalAngularConfig.consentScopes,
extraQueryParameters: this.msalAngularConfig.extraQueryParameters
});
}
else {
return this.authService.acquireTokenSilent({
scopes: [this.msalConfig.auth.clientId]
})
.then(function (result) {
_this.broadcastService.broadcast("msal:loginSuccess", result);
return true;
})
.catch(function (error) {
_this.broadcastService.broadcast("msal:loginFailure", error);
return false;
});
}
_this.authService.getLogger().error("Non-interaction error in MSAL Guard: " + error.errorMessage);
throw error;
});
};

@@ -319,0 +350,0 @@ MsalGuard.ctorParameters = function () { return [

@@ -13,3 +13,3 @@ {

},
"version": "1.0.0-beta.4",
"version": "1.0.0-beta.5",
"keywords": [

@@ -30,3 +30,3 @@ "implicit",

"@angular/core": ">= 6.0.0",
"msal": "^1.2.2-beta.2",
"msal": "^1.3.0-beta.0",
"rxjs": "^6.0.0",

@@ -33,0 +33,0 @@ "tslib": "^1.10.0"

# Microsoft Authentication Library for Angular
The MSAL for Angular library is a wrapper of the core MSAL.js library which enables Angular (6+) applications to authenticate enterprise users using Microsoft Azure Active Directory (AAD), Microsoft account users (MSA), users using social identity providers like Facebook, Google, LinkedIn etc. and get access to [Microsoft Cloud](https://www.microsoft.com/enterprise) OR [Microsoft Graph](https://graph.microsoft.io).
| [Getting Started](https://docs.microsoft.com/azure/active-directory/develop/tutorial-v2-angular)| [AAD Docs](https://aka.ms/aaddevv2) | [Library Reference](https://azuread.github.io/microsoft-authentication-library-for-js/ref/msal-angular/) | [Support](README.md#community-help-and-support) | [Samples](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples)
| --- | --- | --- | --- | --- |
[![Build Status](https://travis-ci.org/AzureAD/microsoft-authentication-library-for-js.png?branch=dev)](https://travis-ci.org/AzureAD/microsoft-authentication-library-for-js)
MSAL for Angular enables client-side Angular web applications, running in a web browser, to authenticate users using [Azure AD](https://docs.microsoft.com/azure/active-directory/develop/v2-overview) work and school accounts (AAD), Microsoft personal accounts (MSA) and social identity providers like Facebook, Google, LinkedIn, Microsoft accounts, etc. through [Azure AD B2C](https://docs.microsoft.com/azure/active-directory-b2c/active-directory-b2c-overview#identity-providers) service. It also enables your app to get tokens to access [Microsoft Cloud](https://www.microsoft.com/enterprise) services such as [Microsoft Graph](https://graph.microsoft.io).
## Important Note about the MSAL Angular Preview
![npm (scoped)](https://img.shields.io/npm/v/@azure/msal-angular)![npm](https://img.shields.io/npm/dw/@azure/msal-angular)
Please note that during the preview we may make changes to the API, internal cache format, and other mechanisms of this library, which you will be required to take along with bug fixes or feature improvements. This may impact your application. For instance, a change to the cache format may impact your users, such as requiring them to sign in again. An API change may require you to update your code. When we provide the General Availability release we will require you to update to the General Availability version within six months, as applications written using a preview version of library may no longer work.
This is an early preview library and we are tracking certain [known issues and requests](https://github.com/AzureAD/microsoft-authentication-library-for-js/issues?q=is%3Aopen+is%3Aissue+label%3Aangular) which we plan on addressing. Please watch the [Roadmap](https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki#roadmap) for details.
## Installation

@@ -19,9 +16,24 @@

## Guides
- [Quickstart](https://docs.microsoft.com/azure/active-directory/develop/quickstart-v2-angular)
- [Upgrade Guide (0.x-1.x)](./docs/0.x-1.x-upgrade-guide.md)
- [Configuration](./docs/configuration.md)
## Samples
* [Angular Quickstart](https://github.com/Azure-Samples/active-directory-javascript-singlepageapp-angular)
* [B2C Angular SPA](https://github.com/Azure-Samples/active-directory-b2c-javascript-angular-spa)
* [Angular v6](../../samples/angular6-sample-app)
* [Angular v7](../../samples/angular7-sample-app)
* [Angular v8](../../samples/angular8-sample-app)
* [Angular v9](../../samples/angular9-sample-app)
## Usage
#### Prerequisite
### Prerequisites
Before using MSAL.js, [register an application in Azure AD](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app) to get your clientId.
Before using MSAL.js, [register an application in Azure AD](https://docs.microsoft.com/azure/active-directory/develop/quickstart-register-app) to get your `clientId`.
#### 1. Include and initialize the MSAL module in your app module.
### 1. Include and initialize the MSAL module in your app module.

@@ -48,15 +60,24 @@ Import MsalModule into app.module.ts. To initialize MSAL module you are required to pass the clientId of your application which you can get from the application registration.

```js
{ path: 'product', component: ProductComponent, canActivate : [MsalGuard],
{
path: 'product',
component: ProductComponent,
canActivate: [MsalGuard],
children: [
{ path: 'detail/:id', component: ProductDetailComponent }
{
path: 'detail/:id',
component: ProductDetailComponent
}
]
},
{ path: 'myProfile' ,component: MsGraphComponent, canActivate : [MsalGuard] },
}, {
path: 'myProfile',
component: MsGraphComponent,
canActivate: [MsalGuard]
},
```
When user visits these routes, the library prompts the user to authenticate.
When a user visits these routes, the library will prompt the user to authenticate.
#### 3. Get tokens for Web API calls
### 3. Get tokens for Web API calls
MSAL Angular allows you to add an Http interceptor (`MsalInterceptor`) in your app.module.ts as follows. MsalInterceptor will obtain tokens and add them to all your Http requests in API calls except the API endpoints listed as `unprotectedResources`.
MSAL Angular allows you to add an Http interceptor (`MsalInterceptor`) in your `app.module.ts` as follows. MsalInterceptor will obtain tokens and add them to all your Http requests in API calls except the API endpoints listed as `unprotectedResources`.

@@ -75,7 +96,7 @@ ```js

#### 4. Subscribe to event callbacks
### 4. Subscribe to event callbacks
MSAL wrapper provides below callbacks for various operations. For all callbacks, you need to inject BroadcastService as a dependency in your component/service.
1. loginPopup()/loginRedirect using api or using routes.
1. Login-related events (`loginPopup`/`loginRedirect`)

@@ -92,3 +113,3 @@ ```js

2. acquireTokenSilent()/acquireTokenPopup()/acquireTokenRedirect()
2. Token-related events (`acquireTokenSilent()`/`acquireTokenPopup()`/`acquireTokenRedirect()`)

@@ -105,3 +126,3 @@ ```js

3. It is extremely important to unsubscribe. Implement ngOnDestroy() in your component and unsubscribe.
3. It is extremely important to unsubscribe. Implement `ngOnDestroy()` in your component and unsubscribe.

@@ -111,8 +132,7 @@ ```js

this.subscription= this.broadcastService.subscribe("msal:acquireTokenFailure", (payload) => {
});
this.subscription = this.broadcastService.subscribe("msal:acquireTokenFailure", (payload) => {});
ngOnDestroy() {
this.broadcastService.getMSALSubject().next(1);
if(this.subscription) {
if (this.subscription) {
this.subscription.unsubscribe();

@@ -123,5 +143,5 @@ }

## MSAL Angular public API
## MSAL Angular Public API
#### Login and AcquireToken APIs
### Login and AcquireToken APIs

@@ -133,3 +153,3 @@ The wrapper exposes APIs for login, logout, acquiring access token and more.

3. `logOut()`
4. `acquireTokenSilent()` - This will try to acquire the token silently. If the scope is not already consented then user will get a callback at `msal:acquireTokenFailure` event. User can call either `acquireTokenPopup()` or `acquireTokenRedirect(`) there to acquire the token interactively.
4. `acquireTokenSilent()`
5. `acquireTokenPopup()`

@@ -142,85 +162,5 @@ 6. `acquireTokenRedirect()`

#### Config options for MSAL initialization
Besides the required clientID, you can optionally pass the following config options to MSAL module during initialization. For example:
```js
@NgModule({
imports: [
MsalModule.forRoot({
auth: {
clientId: 'clientid',
authority: "https://login.microsoftonline.com/common/",
validateAuthority: true,
redirectUri: "http://localhost:4200/",
postLogoutRedirectUri: "http://localhost:4200/",
navigateToLoginRequestUrl: true,
},
cache: {
cacheLocation : "localStorage",
storeAuthStateInCookie: true, // set to true for IE 11
},
framework: {
unprotectedResources: ["https://www.microsoft.com/en-us/"],
protectedResourceMap: new Map(protectedResourceMap)
},
system: {
logger: new Logger(loggerCallback, options)
}
}, {
popUp: !isIE,
consentScopes: [ "user.read", "openid", "profile", "api://a88bb933-319c-41b5-9f04-eff36d985612/access_as_user"],
extraQueryParameters: {}
})
]
})
export class AppModule {}
```
- **redirectUri** : The redirect URI of your app, where authentication responses can be sent and received by your app. It must exactly match one of the redirect URIs you registered in the portal, except that it must be URL encoded.
Defaults to `window.location.href`.
- **authority** : A URL indicating a directory that MSAL can use to obtain tokens.
- - In Azure AD, it is of the form https://&lt;instance>/&lt;tenant&gt;, where &lt;instance&gt; is the directory host (e.g. https://login.microsoftonline.com) and &lt;tenant&gt; is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)
- - In Azure B2C, it is of the form https://&lt;instance&gt;/tfp/&lt;tenantId&gt;/&lt;policyName&gt;/
- - Default value is: "https://login.microsoftonline.com/common"
- **validateAuthority** : Validate the issuer of tokens. Default is true.
- **cacheLocation** : Sets browser storage to either `localStorage` or `sessionStorage`. Defaults to `sessionStorage`.
- **storeAuthStateInCookie** : Stores auth state in a browser cookie instead of local storage. Needs to be set to true when a user is on IE11, which may clear local storage contents when redirecting between websites in different zones. Defaults is `false`.
- **postLogoutRedirectUri** : Redirects the user to postLogoutRedirectUri after logout. Defaults is 'redirectUri'.
- **loadFrameTimeout** : The number of milliseconds of inactivity before a token renewal response from AAD should be considered timed out. Default is 6 seconds.
- **navigateToLoginRequestUrl** :Ability to turn off default navigation to start page after login. Default is true. This is used only for redirect flows.
- **popup** : Show login popup or redirect. Default:Redirect
- **consentScopes** : Allows the client to express the desired scopes that should be consented. Scopes can be from multiple resources/endpoints. Passing scope here will
only consent it and no access token will be acquired till the time client actually calls the API. This is optional if you are using MSAL for only login(Authentication).
- **unprotectedResources** : Array of URI's. Msal will not attach a token to outgoing requests that have these uri. Defaults to 'null'.
- **protectedResourceMap** : Mapping of resources to scopes {"https://graph.microsoft.com/v1.0/me", ["user.read", "mail.send"]}. Used internally by the MSAL for automatically attaching tokens in webApi calls.
This is required only for CORS calls.
export const protectedResourceMap:[string, string[]][]=[ ['https://buildtodoservice.azurewebsites.net/api/todolist',['api://a88bb933-319c-41b5-9f04-eff36d985612/access_as_user']] , ['https://graph.microsoft.com/v1.0/me', ['user.read']] ];
- **level** : Configurable log level. Default value is Info. Passed in options object as the second argument to `Logger`.
- **logger** : Callback instance that can be provided by the developer to consume and publish logs in a custom manner. Callback method must follow this signature.
`loggerCallback(logLevel, message, piiEnabled) { }`
- **piiLoggingEnabled** : PII stands for Personal Identifiable Information. By default, MSAL does not capture or log any PII. By turning on PII, the app takes responsibility for safely handling highly-sensitive data and complying with any regulatory requirements. Passed in options object as the second argument to `Logger`.
This flag is to enable/disable logging of PII data. PII logs are never written to default outputs like Console, Logcat or NSLog. Default is set to false.
- **correlationId** : Unique identifier used to map the request with the response. Defaults to RFC4122 version 4 guid (128 bits). Passed in options object as the second argument to `Logger`.
## Advanced Topics
#### Logging
### Logging

@@ -256,3 +196,3 @@ The logger definition has the following properties. Please see the config section for more details on their use:

#### Multi-Tenant
### Multi-Tenant

@@ -263,3 +203,3 @@ By default, you have multi-tenant support since MSAL sets the tenant in the authority to 'common' if it is not specified in the config. This allows any Microsoft account to authenticate to your application. If you are not interested in multi-tenant behavior, you will need to set the `authority` config property as shown above.

#### Security
### Security

@@ -269,3 +209,3 @@ Tokens are accessible from Javascript since MSAL is using HTML5 storage. Default storage option is sessionStorage, which keeps the tokens per session. You should ask user to login again for important operations on your app.

#### CORS API usage
### CORS API usage

@@ -296,3 +236,3 @@ MSAL will get access tokens using a hidden Iframe for given CORS API endpoints in the config. To make CORS API call, you need to specify your CORS API endpoints as a map in the config.

#### Internet Explorer support
### Internet Explorer support

@@ -324,15 +264,8 @@ This library supports Internet Explorer 11 with the following configuration:

## Samples
You can find a quickstart and detailed sample under the [sample directory](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/samples).
## Community Help and Support
- [FAQs](https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/FAQs) for access to our frequently asked questions
- [Stack Overflow](http://stackoverflow.com/questions/tagged/msal) using tag "msal".
We highly recommend you ask your questions on Stack Overflow first and browse existing issues to see if someone has asked your question before.
- [GitHub Issues](../../issues) for reporting a bug or feature requests
- [User Voice page](https://feedback.azure.com/forums/169401-azure-active-directory) to provide recommendations and/or feedback

@@ -354,7 +287,7 @@

npm run ngcompile
npm run build
npm run test
## Security Library
## Versioning

@@ -365,3 +298,3 @@ This library controls how users sign-in and access services. We recommend you always take the latest version of our library in your app when possible. We use [semantic versioning](http://semver.org) so you can control the risk associated with updating your app. As an example, always downloading the latest minor version number (e.g. x._y_.x) ensures you get the latest security and feature enhanements but our API surface remains the same. You can always see the latest version and release notes under the Releases tab of GitHub.

If you find a security issue with our libraries or services please report it to [secure@microsoft.com](mailto:secure@microsoft.com) with as much detail as possible. Your submission may be eligible for a bounty through the [Microsoft Bounty](http://aka.ms/bugbounty) program. Please do not post security issues to GitHub Issues or any other public site. We will contact you shortly upon receiving the information. We encourage you to get notifications of when security incidents occur by visiting [this page](https://technet.microsoft.com/en-us/security/dd252948) and subscribing to Security Advisory Alerts.
If you find a security issue with our libraries or services please report it to [secure@microsoft.com](mailto:secure@microsoft.com) with as much detail as possible. Your submission may be eligible for a bounty through the [Microsoft Bounty](http://aka.ms/bugbounty) program. Please do not post security issues to GitHub Issues or any other public site. We will contact you shortly upon receiving the information. We encourage you to get notifications of when security incidents occur by visiting [this page](https://technet.microsoft.com/security/dd252948) and subscribing to Security Advisory Alerts.

@@ -368,0 +301,0 @@ ## License

@@ -17,3 +17,14 @@ import { ActivatedRoute, ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from "@angular/router";

constructor(msalConfig: Configuration, msalAngularConfig: MsalAngularConfiguration, authService: MsalService, router: Router, activatedRoute: ActivatedRoute, location: Location, platformLocation: PlatformLocation, broadcastService: BroadcastService);
/**
* Builds the absolute url for the destination page
* @param path Relative path of requested page
* @returns Full destination url
*/
getDestinationUrl(path: string): string;
/**
* Interactively prompt the user to login
* @param url Path of the requested page
*/
loginInteractively(url: string): Promise<boolean>;
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean | Promise<boolean>;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc