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