piral-adal 1.0.0-pre.2087 → 1.0.1-beta.5640
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/LICENSE +1 -1
- package/README.md +31 -6
- package/esm/create.d.ts +7 -0
- package/esm/create.js +14 -0
- package/esm/create.js.map +1 -0
- package/esm/index.d.ts +3 -0
- package/esm/index.js +4 -0
- package/esm/index.js.map +1 -0
- package/esm/setup.d.ts +104 -0
- package/esm/setup.js +60 -0
- package/esm/setup.js.map +1 -0
- package/esm/types.d.ts +10 -0
- package/esm/types.js +2 -0
- package/esm/types.js.map +1 -0
- package/lib/create.d.ts +2 -2
- package/lib/create.js +2 -2
- package/lib/create.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/setup.d.ts +20 -0
- package/lib/setup.js +23 -28
- package/lib/setup.js.map +1 -1
- package/lib/types.d.ts +2 -2
- package/package.json +29 -8
- package/piral-adal.min.js +1 -0
- package/src/create.test.ts +4 -4
- package/src/create.ts +2 -2
- package/src/setup.ts +22 -4
- package/src/types.ts +2 -2
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
[](https://piral.io)
|
|
2
2
|
|
|
3
|
-
# [Piral ADAL](https://piral.io) · [](https://github.com/smapiot/piral/blob/
|
|
3
|
+
# [Piral ADAL](https://piral.io) · [](https://github.com/smapiot/piral/blob/main/LICENSE) [](https://www.npmjs.com/package/piral-adal) [](https://jestjs.io) [](https://gitter.im/piral-io/community)
|
|
4
4
|
|
|
5
5
|
This is a plugin that only has a peer dependency to `piral-core`. What `piral-adal` brings to the table is a direct integration with Azure Active Directory on basis of the MSAL library that can be used with `piral` or `piral-core`.
|
|
6
6
|
|
|
@@ -8,6 +8,12 @@ The set includes the `getAccessToken` API to retrieve the current user's access
|
|
|
8
8
|
|
|
9
9
|
By default, these Pilet API extensions are not integrated in `piral`, so you'd need to add them to your Piral instance.
|
|
10
10
|
|
|
11
|
+
## Why and When
|
|
12
|
+
|
|
13
|
+
If you are using authorization with an Microsoft Account or an Active Directory then `piral-adal` might be a useful plugin. It uses the `msal` library under the hood and exposes token functionality in common HTTP mechanisms (e.g., using `fetch` or a library such as `axios`). Pilets can get the currently available token via the pilet API.
|
|
14
|
+
|
|
15
|
+
Alternatives: Use a plugin that is specific to your method of authentication (e.g., `piral-auth` for generic user management, `piral-oidc` for generic OpenID Connect, `piral-oauth2` for generic OAuth 2, etc.) or just a library.
|
|
16
|
+
|
|
11
17
|
## Documentation
|
|
12
18
|
|
|
13
19
|
The following functions are brought to the Pilet API.
|
|
@@ -33,7 +39,7 @@ export async function setup(piral: PiletApi) {
|
|
|
33
39
|
}
|
|
34
40
|
```
|
|
35
41
|
|
|
36
|
-
Note that this value may change if the Piral instance supports an "on the fly" login (i.e., a login without redirect
|
|
42
|
+
Note that this value may change if the Piral instance supports an "on the fly" login (i.e., a login without redirect/reloading of the page).
|
|
37
43
|
|
|
38
44
|
:::
|
|
39
45
|
|
|
@@ -65,21 +71,25 @@ The separation into `setupAdalClient` and `createAdalApi` was done to simplify t
|
|
|
65
71
|
|
|
66
72
|
Normally, you would want to have different modules here. As an example consider the following code:
|
|
67
73
|
|
|
68
|
-
```
|
|
74
|
+
```jsx
|
|
69
75
|
// module adal.ts
|
|
70
76
|
import { setupAdalClient } from 'piral-adal';
|
|
71
77
|
|
|
72
78
|
export const client = setupAdalClient({ ... });
|
|
73
79
|
|
|
74
|
-
// app.
|
|
80
|
+
// app.tsx
|
|
81
|
+
import * as React from 'react';
|
|
75
82
|
import { createAdalApi } from 'piral-adal';
|
|
83
|
+
import { createInstance } from 'piral-core';
|
|
76
84
|
import { client } from './adal';
|
|
85
|
+
import { render } from 'react-dom';
|
|
77
86
|
|
|
78
87
|
export function render() {
|
|
79
|
-
|
|
88
|
+
const instance = createInstance({
|
|
80
89
|
// ...
|
|
81
90
|
plugins: [createAdalApi(client)],
|
|
82
91
|
});
|
|
92
|
+
render(<Piral instance={instance} />, document.querySelector('#app'));
|
|
83
93
|
}
|
|
84
94
|
|
|
85
95
|
// index.ts
|
|
@@ -96,6 +106,21 @@ if (location.pathname !== '/auth') {
|
|
|
96
106
|
|
|
97
107
|
This way we evaluate the current path and act accordingly. Note that the actually used path may be different for your application.
|
|
98
108
|
|
|
109
|
+
By default, the `redirectUri` is chosen to be `{location.origin}/auth`, i.e., if your site is running on `https://example.com` then the redirect would go against `https://example.com/auth`. You can set the `redirectUri` (as well as `postLogoutRedirectUri` for the logout case) in the client setup:
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
// module adal.ts
|
|
113
|
+
import { setupAdalClient } from 'piral-adal';
|
|
114
|
+
|
|
115
|
+
export const client = setupAdalClient({
|
|
116
|
+
clientId: '...',
|
|
117
|
+
redirectUri: 'https://example.com/logged-in',
|
|
118
|
+
postLogoutRedirectUri: 'https://example.com/logged-out',
|
|
119
|
+
});
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
All auth options from the MSAL library are supported. For an overview, [see the MSAL wiki page](https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options).
|
|
123
|
+
|
|
99
124
|
:::
|
|
100
125
|
|
|
101
126
|
## License
|
package/esm/create.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PiralPlugin } from 'piral-core';
|
|
2
|
+
import { AdalClient } from './setup';
|
|
3
|
+
import { PiletAdalApi } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Creates new Pilet API extensions for the integration of MSAL.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createAdalApi(client: AdalClient): PiralPlugin<PiletAdalApi>;
|
package/esm/create.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates new Pilet API extensions for the integration of MSAL.
|
|
3
|
+
*/
|
|
4
|
+
export function createAdalApi(client) {
|
|
5
|
+
return (context) => {
|
|
6
|
+
context.on('before-fetch', client.extendHeaders);
|
|
7
|
+
return {
|
|
8
|
+
getAccessToken() {
|
|
9
|
+
return client.token();
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAkB;IAC9C,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,OAAO,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;QAEjD,OAAO;YACL,cAAc;gBACZ,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;YACxB,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/esm/index.d.ts
ADDED
package/esm/index.js
ADDED
package/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
package/esm/setup.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Account } from 'msal';
|
|
2
|
+
/**
|
|
3
|
+
* Available configuration options for the ADAL plugin.
|
|
4
|
+
*/
|
|
5
|
+
export interface AdalConfig {
|
|
6
|
+
/**
|
|
7
|
+
* The id of the client. Required for the setup of MSAL.
|
|
8
|
+
*/
|
|
9
|
+
clientId: string;
|
|
10
|
+
/**
|
|
11
|
+
* The isser of the token. Should be an URL containing the tenant.
|
|
12
|
+
* By default set to Microsoft's default tenant.
|
|
13
|
+
*/
|
|
14
|
+
authority?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The redirect Uri to use. By default the origin with /auth
|
|
17
|
+
* is used.
|
|
18
|
+
*/
|
|
19
|
+
redirectUri?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The scopes to be used. By default uses only the 'User.Read' scope.
|
|
22
|
+
*/
|
|
23
|
+
scopes?: Array<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Restricts token sharing such that other integrations, e.g., with
|
|
26
|
+
* fetch would need to be done manually.
|
|
27
|
+
* Otherwise, the client is responsive to the `before-fetch` event.
|
|
28
|
+
*/
|
|
29
|
+
restrict?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Determines the cache location.
|
|
32
|
+
*/
|
|
33
|
+
cacheLocation?: 'localStorage' | 'sessionStorage';
|
|
34
|
+
/**
|
|
35
|
+
* If true MSAL will store the auth request state required for validation
|
|
36
|
+
* of the auth flows in the browser cookies.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
storeAuthStateInCookie?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Determines the system specific options. Usually not needed.
|
|
42
|
+
* For more details see the MSAL.js documentation.
|
|
43
|
+
*/
|
|
44
|
+
system?: any;
|
|
45
|
+
/**
|
|
46
|
+
* Determines the framework specific options. Usually not needed.
|
|
47
|
+
* For more details see the MSAL.js documentation.
|
|
48
|
+
*/
|
|
49
|
+
framework?: any;
|
|
50
|
+
/**
|
|
51
|
+
* Determines whether or not the authority should be validated.
|
|
52
|
+
*/
|
|
53
|
+
validateAuthority?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Additional metadata to hand over.
|
|
56
|
+
*/
|
|
57
|
+
authorityMetadata?: string;
|
|
58
|
+
/**
|
|
59
|
+
* A list of known authorities to respect.
|
|
60
|
+
*/
|
|
61
|
+
knownAuthorities?: Array<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Optionally decides where to redirect to in the logout case.
|
|
64
|
+
*/
|
|
65
|
+
postLogoutRedirectUri?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Determines if the URL for the login request should be navigated to.
|
|
68
|
+
*/
|
|
69
|
+
navigateToLoginRequestUrl?: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface AdalRequest {
|
|
72
|
+
/**
|
|
73
|
+
* Sets the headers of the request.
|
|
74
|
+
* @param headers Headers or a promise to headers.
|
|
75
|
+
*/
|
|
76
|
+
setHeaders(headers: any): void;
|
|
77
|
+
}
|
|
78
|
+
export interface AdalClient {
|
|
79
|
+
/**
|
|
80
|
+
* Performs a login.
|
|
81
|
+
*/
|
|
82
|
+
login(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Performs a logout.
|
|
85
|
+
*/
|
|
86
|
+
logout(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Retrieves the current account.
|
|
89
|
+
*/
|
|
90
|
+
account(): Account;
|
|
91
|
+
/**
|
|
92
|
+
* Gets a token.
|
|
93
|
+
*/
|
|
94
|
+
token(): Promise<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Extends the headers of the provided request.
|
|
97
|
+
*/
|
|
98
|
+
extendHeaders(req: AdalRequest): void;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Sets up a new client wrapping the MSAL API.
|
|
102
|
+
* @param config The configuration for the client.
|
|
103
|
+
*/
|
|
104
|
+
export declare function setupAdalClient(config: AdalConfig): AdalClient;
|
package/esm/setup.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { UserAgentApplication } from 'msal';
|
|
3
|
+
function retrieveToken(msalInstance, auth) {
|
|
4
|
+
if (msalInstance.getAccount()) {
|
|
5
|
+
return msalInstance
|
|
6
|
+
.acquireTokenSilent(auth)
|
|
7
|
+
.then((response) => response.accessToken)
|
|
8
|
+
.catch((err) => {
|
|
9
|
+
if (err.name === 'InteractionRequiredAuthError') {
|
|
10
|
+
return msalInstance
|
|
11
|
+
.acquireTokenPopup(auth)
|
|
12
|
+
.then((response) => response.accessToken)
|
|
13
|
+
.catch((err) => Promise.reject(err && err.message));
|
|
14
|
+
}
|
|
15
|
+
console.error(err);
|
|
16
|
+
return Promise.reject('Could not fetch token');
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return Promise.reject('Not logged in');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Sets up a new client wrapping the MSAL API.
|
|
23
|
+
* @param config The configuration for the client.
|
|
24
|
+
*/
|
|
25
|
+
export function setupAdalClient(config) {
|
|
26
|
+
const { redirectUri = `${location.origin}/auth`, restrict = false, scopes = ['User.Read'], storeAuthStateInCookie, cacheLocation = 'sessionStorage', framework, system } = config, remainingOptions = __rest(config, ["redirectUri", "restrict", "scopes", "storeAuthStateInCookie", "cacheLocation", "framework", "system"]);
|
|
27
|
+
const msalInstance = new UserAgentApplication({
|
|
28
|
+
auth: Object.assign({ redirectUri }, remainingOptions),
|
|
29
|
+
cache: {
|
|
30
|
+
storeAuthStateInCookie,
|
|
31
|
+
cacheLocation,
|
|
32
|
+
},
|
|
33
|
+
system,
|
|
34
|
+
framework,
|
|
35
|
+
});
|
|
36
|
+
const tokenRequest = { scopes };
|
|
37
|
+
msalInstance.handleRedirectCallback(() => { });
|
|
38
|
+
return {
|
|
39
|
+
login() {
|
|
40
|
+
msalInstance.loginRedirect(tokenRequest);
|
|
41
|
+
},
|
|
42
|
+
logout() {
|
|
43
|
+
msalInstance.logout();
|
|
44
|
+
},
|
|
45
|
+
account() {
|
|
46
|
+
return msalInstance.getAccount();
|
|
47
|
+
},
|
|
48
|
+
extendHeaders(req) {
|
|
49
|
+
if (!restrict) {
|
|
50
|
+
req.setHeaders(retrieveToken(msalInstance, tokenRequest).then((token) => token && {
|
|
51
|
+
Authorization: `Bearer ${token}`,
|
|
52
|
+
}, () => undefined));
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
token() {
|
|
56
|
+
return retrieveToken(msalInstance, tokenRequest);
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=setup.js.map
|
package/esm/setup.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAqC,MAAM,MAAM,CAAC;AAE/E,SAAS,aAAa,CAAC,YAAkC,EAAE,IAA8B;IACvF,IAAI,YAAY,CAAC,UAAU,EAAE,EAAE;QAC7B,OAAO,YAAY;aAChB,kBAAkB,CAAC,IAAI,CAAC;aACxB,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;aACxC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,IAAI,GAAG,CAAC,IAAI,KAAK,8BAA8B,EAAE;gBAC/C,OAAO,YAAY;qBAChB,iBAAiB,CAAC,IAAI,CAAC;qBACvB,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;qBACxC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;aACvD;YAED,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,OAAO,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;KACN;IAED,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;AACzC,CAAC;AAuGD;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAAkB;IAChD,MAAM,EACJ,WAAW,GAAG,GAAG,QAAQ,CAAC,MAAM,OAAO,EACvC,QAAQ,GAAG,KAAK,EAChB,MAAM,GAAG,CAAC,WAAW,CAAC,EACtB,sBAAsB,EACtB,aAAa,GAAG,gBAAgB,EAChC,SAAS,EACT,MAAM,KAEJ,MAAM,EADL,gBAAgB,UACjB,MAAM,EATJ,uGASL,CAAS,CAAC;IACX,MAAM,YAAY,GAAG,IAAI,oBAAoB,CAAC;QAC5C,IAAI,kBACF,WAAW,IACR,gBAAgB,CACpB;QACD,KAAK,EAAE;YACL,sBAAsB;YACtB,aAAa;SACd;QACD,MAAM;QACN,SAAS;KACV,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,EAAE,MAAM,EAAE,CAAC;IAChC,YAAY,CAAC,sBAAsB,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC9C,OAAO;QACL,KAAK;YACH,YAAY,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM;YACJ,YAAY,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC;QACD,OAAO;YACL,OAAO,YAAY,CAAC,UAAU,EAAE,CAAC;QACnC,CAAC;QACD,aAAa,CAAC,GAAG;YACf,IAAI,CAAC,QAAQ,EAAE;gBACb,GAAG,CAAC,UAAU,CACZ,aAAa,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,IAAI,CAC5C,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,IAAI;oBACP,aAAa,EAAE,UAAU,KAAK,EAAE;iBACjC,EACH,GAAG,EAAE,CAAC,SAAS,CAChB,CACF,CAAC;aACH;QACH,CAAC;QACD,KAAK;YACH,OAAO,aAAa,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QACnD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/esm/types.d.ts
ADDED
package/esm/types.js
ADDED
package/esm/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/lib/create.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PiralPlugin } from 'piral-core';
|
|
2
2
|
import { AdalClient } from './setup';
|
|
3
|
-
import {
|
|
3
|
+
import { PiletAdalApi } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* Creates new Pilet API extensions for the integration of MSAL.
|
|
6
6
|
*/
|
|
7
|
-
export declare function createAdalApi(client: AdalClient): PiralPlugin<
|
|
7
|
+
export declare function createAdalApi(client: AdalClient): PiralPlugin<PiletAdalApi>;
|
package/lib/create.js
CHANGED
|
@@ -5,10 +5,10 @@ exports.createAdalApi = void 0;
|
|
|
5
5
|
* Creates new Pilet API extensions for the integration of MSAL.
|
|
6
6
|
*/
|
|
7
7
|
function createAdalApi(client) {
|
|
8
|
-
return
|
|
8
|
+
return (context) => {
|
|
9
9
|
context.on('before-fetch', client.extendHeaders);
|
|
10
10
|
return {
|
|
11
|
-
getAccessToken
|
|
11
|
+
getAccessToken() {
|
|
12
12
|
return client.token();
|
|
13
13
|
},
|
|
14
14
|
};
|
package/lib/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,SAAgB,aAAa,CAAC,MAAkB;IAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,SAAgB,aAAa,CAAC,MAAkB;IAC9C,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,OAAO,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;QAEjD,OAAO;YACL,cAAc;gBACZ,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;YACxB,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAVD,sCAUC"}
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./create"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./setup"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./types"), exports);
|
package/lib/setup.d.ts
CHANGED
|
@@ -47,6 +47,26 @@ export interface AdalConfig {
|
|
|
47
47
|
* For more details see the MSAL.js documentation.
|
|
48
48
|
*/
|
|
49
49
|
framework?: any;
|
|
50
|
+
/**
|
|
51
|
+
* Determines whether or not the authority should be validated.
|
|
52
|
+
*/
|
|
53
|
+
validateAuthority?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Additional metadata to hand over.
|
|
56
|
+
*/
|
|
57
|
+
authorityMetadata?: string;
|
|
58
|
+
/**
|
|
59
|
+
* A list of known authorities to respect.
|
|
60
|
+
*/
|
|
61
|
+
knownAuthorities?: Array<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Optionally decides where to redirect to in the logout case.
|
|
64
|
+
*/
|
|
65
|
+
postLogoutRedirectUri?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Determines if the URL for the login request should be navigated to.
|
|
68
|
+
*/
|
|
69
|
+
navigateToLoginRequestUrl?: boolean;
|
|
50
70
|
}
|
|
51
71
|
export interface AdalRequest {
|
|
52
72
|
/**
|
package/lib/setup.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupAdalClient = void 0;
|
|
4
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const msal_1 = require("msal");
|
|
5
6
|
function retrieveToken(msalInstance, auth) {
|
|
6
7
|
if (msalInstance.getAccount()) {
|
|
7
8
|
return msalInstance
|
|
8
9
|
.acquireTokenSilent(auth)
|
|
9
|
-
.then(
|
|
10
|
-
.catch(
|
|
10
|
+
.then((response) => response.accessToken)
|
|
11
|
+
.catch((err) => {
|
|
11
12
|
if (err.name === 'InteractionRequiredAuthError') {
|
|
12
13
|
return msalInstance
|
|
13
14
|
.acquireTokenPopup(auth)
|
|
14
|
-
.then(
|
|
15
|
-
.catch(
|
|
15
|
+
.then((response) => response.accessToken)
|
|
16
|
+
.catch((err) => Promise.reject(err && err.message));
|
|
16
17
|
}
|
|
17
18
|
console.error(err);
|
|
18
19
|
return Promise.reject('Could not fetch token');
|
|
@@ -25,42 +26,36 @@ function retrieveToken(msalInstance, auth) {
|
|
|
25
26
|
* @param config The configuration for the client.
|
|
26
27
|
*/
|
|
27
28
|
function setupAdalClient(config) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
auth: {
|
|
31
|
-
clientId: clientId,
|
|
32
|
-
redirectUri: redirectUri,
|
|
33
|
-
authority: authority,
|
|
34
|
-
},
|
|
29
|
+
const { redirectUri = `${location.origin}/auth`, restrict = false, scopes = ['User.Read'], storeAuthStateInCookie, cacheLocation = 'sessionStorage', framework, system } = config, remainingOptions = tslib_1.__rest(config, ["redirectUri", "restrict", "scopes", "storeAuthStateInCookie", "cacheLocation", "framework", "system"]);
|
|
30
|
+
const msalInstance = new msal_1.UserAgentApplication({
|
|
31
|
+
auth: Object.assign({ redirectUri }, remainingOptions),
|
|
35
32
|
cache: {
|
|
36
|
-
storeAuthStateInCookie
|
|
37
|
-
cacheLocation
|
|
33
|
+
storeAuthStateInCookie,
|
|
34
|
+
cacheLocation,
|
|
38
35
|
},
|
|
39
|
-
system
|
|
40
|
-
framework
|
|
36
|
+
system,
|
|
37
|
+
framework,
|
|
41
38
|
});
|
|
42
|
-
|
|
43
|
-
msalInstance.handleRedirectCallback(
|
|
39
|
+
const tokenRequest = { scopes };
|
|
40
|
+
msalInstance.handleRedirectCallback(() => { });
|
|
44
41
|
return {
|
|
45
|
-
login
|
|
42
|
+
login() {
|
|
46
43
|
msalInstance.loginRedirect(tokenRequest);
|
|
47
44
|
},
|
|
48
|
-
logout
|
|
45
|
+
logout() {
|
|
49
46
|
msalInstance.logout();
|
|
50
47
|
},
|
|
51
|
-
account
|
|
48
|
+
account() {
|
|
52
49
|
return msalInstance.getAccount();
|
|
53
50
|
},
|
|
54
|
-
extendHeaders
|
|
51
|
+
extendHeaders(req) {
|
|
55
52
|
if (!restrict) {
|
|
56
|
-
req.setHeaders(retrieveToken(msalInstance, tokenRequest).then(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
}, function () { return undefined; }));
|
|
53
|
+
req.setHeaders(retrieveToken(msalInstance, tokenRequest).then((token) => token && {
|
|
54
|
+
Authorization: `Bearer ${token}`,
|
|
55
|
+
}, () => undefined));
|
|
61
56
|
}
|
|
62
57
|
},
|
|
63
|
-
token
|
|
58
|
+
token() {
|
|
64
59
|
return retrieveToken(msalInstance, tokenRequest);
|
|
65
60
|
},
|
|
66
61
|
};
|
package/lib/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";;;;AAAA,+BAA+E;AAE/E,SAAS,aAAa,CAAC,YAAkC,EAAE,IAA8B;IACvF,IAAI,YAAY,CAAC,UAAU,EAAE,EAAE;QAC7B,OAAO,YAAY;aAChB,kBAAkB,CAAC,IAAI,CAAC;aACxB,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;aACxC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,IAAI,GAAG,CAAC,IAAI,KAAK,8BAA8B,EAAE;gBAC/C,OAAO,YAAY;qBAChB,iBAAiB,CAAC,IAAI,CAAC;qBACvB,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;qBACxC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;aACvD;YAED,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,OAAO,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;KACN;IAED,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;AACzC,CAAC;AAuGD;;;GAGG;AACH,SAAgB,eAAe,CAAC,MAAkB;IAChD,MAAM,EACJ,WAAW,GAAG,GAAG,QAAQ,CAAC,MAAM,OAAO,EACvC,QAAQ,GAAG,KAAK,EAChB,MAAM,GAAG,CAAC,WAAW,CAAC,EACtB,sBAAsB,EACtB,aAAa,GAAG,gBAAgB,EAChC,SAAS,EACT,MAAM,KAEJ,MAAM,EADL,gBAAgB,kBACjB,MAAM,EATJ,uGASL,CAAS,CAAC;IACX,MAAM,YAAY,GAAG,IAAI,2BAAoB,CAAC;QAC5C,IAAI,kBACF,WAAW,IACR,gBAAgB,CACpB;QACD,KAAK,EAAE;YACL,sBAAsB;YACtB,aAAa;SACd;QACD,MAAM;QACN,SAAS;KACV,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,EAAE,MAAM,EAAE,CAAC;IAChC,YAAY,CAAC,sBAAsB,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC9C,OAAO;QACL,KAAK;YACH,YAAY,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM;YACJ,YAAY,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC;QACD,OAAO;YACL,OAAO,YAAY,CAAC,UAAU,EAAE,CAAC;QACnC,CAAC;QACD,aAAa,CAAC,GAAG;YACf,IAAI,CAAC,QAAQ,EAAE;gBACb,GAAG,CAAC,UAAU,CACZ,aAAa,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,IAAI,CAC5C,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,IAAI;oBACP,aAAa,EAAE,UAAU,KAAK,EAAE;iBACjC,EACH,GAAG,EAAE,CAAC,SAAS,CAChB,CACF,CAAC;aACH;QACH,CAAC;QACD,KAAK;YACH,OAAO,aAAa,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QACnD,CAAC;KACF,CAAC;AACJ,CAAC;AApDD,0CAoDC"}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare module 'piral-core/lib/types/custom' {
|
|
2
|
-
interface PiletCustomApi extends
|
|
2
|
+
interface PiletCustomApi extends PiletAdalApi {
|
|
3
3
|
}
|
|
4
4
|
}
|
|
5
|
-
export interface
|
|
5
|
+
export interface PiletAdalApi {
|
|
6
6
|
/**
|
|
7
7
|
* Gets the currently valid access token, if any.
|
|
8
8
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-adal",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1-beta.5640",
|
|
4
4
|
"description": "Plugin to integrate AAD authentication in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -20,12 +20,32 @@
|
|
|
20
20
|
"author": "smapiot",
|
|
21
21
|
"homepage": "https://piral.io",
|
|
22
22
|
"license": "MIT",
|
|
23
|
+
"module": "esm/index.js",
|
|
23
24
|
"main": "lib/index.js",
|
|
24
25
|
"typings": "lib/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"import": "./esm/index.js",
|
|
29
|
+
"require": "./lib/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./esm/*": {
|
|
32
|
+
"import": "./esm/*"
|
|
33
|
+
},
|
|
34
|
+
"./lib/*": {
|
|
35
|
+
"require": "./lib/*"
|
|
36
|
+
},
|
|
37
|
+
"./_/*": {
|
|
38
|
+
"import": "./esm/*.js",
|
|
39
|
+
"require": "./lib/*.js"
|
|
40
|
+
},
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
25
43
|
"sideEffects": false,
|
|
26
44
|
"files": [
|
|
45
|
+
"esm",
|
|
27
46
|
"lib",
|
|
28
|
-
"src"
|
|
47
|
+
"src",
|
|
48
|
+
"piral-adal.min.js"
|
|
29
49
|
],
|
|
30
50
|
"repository": {
|
|
31
51
|
"type": "git",
|
|
@@ -35,7 +55,11 @@
|
|
|
35
55
|
"url": "https://github.com/smapiot/piral/issues"
|
|
36
56
|
},
|
|
37
57
|
"scripts": {
|
|
38
|
-
"
|
|
58
|
+
"cleanup": "rimraf esm lib piral-adal.min.js",
|
|
59
|
+
"build": "yarn build:bundle && yarn build:commonjs && yarn build:esnext",
|
|
60
|
+
"build:bundle": "esbuild src/index.ts --outfile=piral-adal.min.js --bundle --external:piral-core --minify",
|
|
61
|
+
"build:commonjs": "tsc --project tsconfig.json --outDir lib --module commonjs",
|
|
62
|
+
"build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
|
|
39
63
|
"typedoc": "typedoc --json ../../../docs/types/piral-adal.json src --exclude \"src/**/*.test.*\"",
|
|
40
64
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
41
65
|
},
|
|
@@ -43,10 +67,7 @@
|
|
|
43
67
|
"msal": "^1.1.1"
|
|
44
68
|
},
|
|
45
69
|
"devDependencies": {
|
|
46
|
-
"piral-core": "
|
|
47
|
-
},
|
|
48
|
-
"peerDependencies": {
|
|
49
|
-
"piral-core": "1.x"
|
|
70
|
+
"piral-core": "1.0.1-beta.5640"
|
|
50
71
|
},
|
|
51
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "fa0a72b28fd0a20afec7ef491ec19e93c090fc72"
|
|
52
73
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var rt=Object.defineProperty;var ge=Object.getOwnPropertySymbols;var Ue=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable;var Le=(o,e,t)=>e in o?rt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Me=(o,e)=>{for(var t in e||(e={}))Ue.call(e,t)&&Le(o,t,e[t]);if(ge)for(var t of ge(e))xe.call(e,t)&&Le(o,t,e[t]);return o};var He=(o,e)=>{var t={};for(var r in o)Ue.call(o,r)&&e.indexOf(r)<0&&(t[r]=o[r]);if(o!=null&&ge)for(var r of ge(o))e.indexOf(r)<0&&xe.call(o,r)&&(t[r]=o[r]);return t};function Et(o){return e=>(e.on("before-fetch",o.extendHeaders),{getAccessToken(){return o.token()}})}var we=function(o,e){return we=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},we(o,e)};function O(o,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");we(o,e);function t(){this.constructor=o}o.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var S=function(){return S=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},S.apply(this,arguments)};function G(o,e,t,r){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function s(h){try{u(r.next(h))}catch(y){a(y)}}function c(h){try{u(r.throw(h))}catch(y){a(y)}}function u(h){h.done?i(h.value):n(h.value).then(s,c)}u((r=r.apply(o,e||[])).next())})}function W(o,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,n,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(h){return c([u,h])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(t=0)),t;)try{if(r=1,n&&(i=u[0]&2?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){t.label=u[1];break}if(u[0]===6&&t.label<i[1]){t.label=i[1],i=u;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(u);break}i[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(o,t)}catch(h){u=[6,h],n=0}finally{r=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function x(){for(var o=0,e=0,t=arguments.length;e<t;e++)o+=arguments[e].length;for(var r=Array(o),n=0,e=0;e<t;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r}var I=function(){function o(){}return o.createNewGuid=function(){var e=window.crypto;if(e&&e.getRandomValues){var t=new Uint8Array(16);return e.getRandomValues(t),t[6]|=64,t[6]&=79,t[8]|=128,t[8]&=191,o.decimalToHex(t[0])+o.decimalToHex(t[1])+o.decimalToHex(t[2])+o.decimalToHex(t[3])+"-"+o.decimalToHex(t[4])+o.decimalToHex(t[5])+"-"+o.decimalToHex(t[6])+o.decimalToHex(t[7])+"-"+o.decimalToHex(t[8])+o.decimalToHex(t[9])+"-"+o.decimalToHex(t[10])+o.decimalToHex(t[11])+o.decimalToHex(t[12])+o.decimalToHex(t[13])+o.decimalToHex(t[14])+o.decimalToHex(t[15])}else{for(var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",n="0123456789abcdef",i=0,a="",s=0;s<36;s++)r[s]!=="-"&&r[s]!=="4"&&(i=Math.random()*16|0),r[s]==="x"?a+=n[i]:r[s]==="y"?(i&=3,i|=8,a+=n[i]):a+=r[s];return a}},o.isGuid=function(e){var t=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;return t.test(e)},o.decimalToHex=function(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t},o.base64Encode=function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(r,n){return String.fromCharCode(Number("0x"+n))}))},o.base64Decode=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Invalid base64 string")}return decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""))},o.deserialize=function(e){var t,r=/\+/g,n=/([^&=]+)=([^&]*)/g,i=function(s){return decodeURIComponent(s.replace(r," "))},a={};for(t=n.exec(e);t;)a[i(t[1])]=i(t[2]),t=n.exec(e);return a},o}();var l=function(){function o(){}return Object.defineProperty(o,"libraryName",{get:function(){return"Msal.js"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"claims",{get:function(){return"claims"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"clientId",{get:function(){return"clientId"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"adalIdToken",{get:function(){return"adal.idtoken"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"cachePrefix",{get:function(){return"msal"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"scopes",{get:function(){return"scopes"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"no_account",{get:function(){return"NO_ACCOUNT"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"upn",{get:function(){return"upn"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"domain_hint",{get:function(){return"domain_hint"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"prompt_select_account",{get:function(){return"&prompt=select_account"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"prompt_none",{get:function(){return"&prompt=none"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"prompt",{get:function(){return"prompt"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"response_mode_fragment",{get:function(){return"&response_mode=fragment"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"resourceDelimiter",{get:function(){return"|"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"cacheDelimiter",{get:function(){return"."},enumerable:!1,configurable:!0}),Object.defineProperty(o,"popUpWidth",{get:function(){return this._popUpWidth},set:function(e){this._popUpWidth=e},enumerable:!1,configurable:!0}),Object.defineProperty(o,"popUpHeight",{get:function(){return this._popUpHeight},set:function(e){this._popUpHeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(o,"login",{get:function(){return"LOGIN"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"renewToken",{get:function(){return"RENEW_TOKEN"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"unknown",{get:function(){return"UNKNOWN"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"ADFS",{get:function(){return"adfs"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"homeAccountIdentifier",{get:function(){return"homeAccountIdentifier"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"common",{get:function(){return"common"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"openidScope",{get:function(){return"openid"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"profileScope",{get:function(){return"profile"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"oidcScopes",{get:function(){return[this.openidScope,this.profileScope]},enumerable:!1,configurable:!0}),Object.defineProperty(o,"interactionTypeRedirect",{get:function(){return"redirectInteraction"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"interactionTypePopup",{get:function(){return"popupInteraction"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"interactionTypeSilent",{get:function(){return"silentInteraction"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"inProgress",{get:function(){return"inProgress"},enumerable:!1,configurable:!0}),o._popUpWidth=483,o._popUpHeight=600,o}();var De="sessionStorage",p;(function(o){o.SCOPE="scope",o.STATE="state",o.ERROR="error",o.ERROR_DESCRIPTION="error_description",o.ACCESS_TOKEN="access_token",o.ID_TOKEN="id_token",o.EXPIRES_IN="expires_in",o.SESSION_STATE="session_state",o.CLIENT_INFO="client_info"})(p||(p={}));var Q={id_token:"id_token",token:"token",id_token_token:"id_token token"},b;(function(o){o.AUTHORITY="authority",o.ACQUIRE_TOKEN_ACCOUNT="acquireTokenAccount",o.SESSION_STATE="session.state",o.STATE_LOGIN="state.login",o.STATE_ACQ_TOKEN="state.acquireToken",o.STATE_RENEW="state.renew",o.NONCE_IDTOKEN="nonce.idtoken",o.LOGIN_REQUEST="login.request",o.RENEW_STATUS="token.renew.status",o.URL_HASH="urlHash",o.INTERACTION_STATUS="interaction.status",o.REDIRECT_REQUEST="redirect_request"})(b||(b={}));var H;(function(o){o.IDTOKEN="idtoken",o.CLIENT_INFO="client.info"})(H||(H={}));var P;(function(o){o.LOGIN_ERROR="login.error",o.ERROR="error",o.ERROR_DESC="error.description"})(P||(P={}));var ot="https://login.microsoftonline.com/common/",Fe=ot+"/discovery/instance?api-version=1.1&authorization_endpoint=",Ce=".well-known/openid-configuration",C;(function(o){o.ACCOUNT="account",o.SID="sid",o.LOGIN_HINT="login_hint",o.ORGANIZATIONS="organizations",o.CONSUMERS="consumers",o.ID_TOKEN="id_token",o.ACCOUNT_ID="accountIdentifier",o.HOMEACCOUNT_ID="homeAccountIdentifier"})(C||(C={}));var Ke=[C.SID,C.LOGIN_HINT],se={GET:"GET",POST:"POST"},oe={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none"},Ae={ID_TOKEN_FRAME:"msalIdTokenFrame",TOKEN_FRAME:"msalRenewFrame"};var me={unexpectedError:{code:"unexpected_error",desc:"Unexpected error in authentication."},noWindowObjectError:{code:"no_window_object",desc:"No window object available. Details:"}},D=function(o){O(e,o);function e(t,r){var n=o.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n.errorCode=t,n.errorMessage=r,n.name="AuthError",n}return e.createUnexpectedError=function(t){return new e(me.unexpectedError.code,me.unexpectedError.desc+": "+t)},e.createNoWindowObjectError=function(t){return new e(me.noWindowObjectError.code,me.noWindowObjectError.desc+" "+t)},e}(Error);var m=function(){function o(){}return o.isEmpty=function(e){return typeof e=="undefined"||!e||e.length===0},o.validateAndParseJsonCacheKey=function(e){try{var t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}},o}();var d={endpointResolutionError:{code:"endpoints_resolution_error",desc:"Error: could not resolve endpoints. Please check network and try again."},popUpWindowError:{code:"popup_window_error",desc:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser."},tokenRenewalError:{code:"token_renewal_error",desc:"Token renewal operation failed due to timeout."},invalidIdToken:{code:"invalid_id_token",desc:"Invalid ID token format."},invalidStateError:{code:"invalid_state_error",desc:"Invalid state."},nonceMismatchError:{code:"nonce_mismatch_error",desc:"Nonce is not matching, Nonce received: "},loginProgressError:{code:"login_progress_error",desc:"Login_In_Progress: Error during login call - login is already in progress."},acquireTokenProgressError:{code:"acquiretoken_progress_error",desc:"AcquireToken_In_Progress: Error during login call - login is already in progress."},userCancelledError:{code:"user_cancelled",desc:"User cancelled the flow."},callbackError:{code:"callback_error",desc:"Error occurred in token received callback function."},userLoginRequiredError:{code:"user_login_error",desc:"User login is required. For silent calls, request must contain either sid or login_hint"},userDoesNotExistError:{code:"user_non_existent",desc:"User object does not exist. Please call a login API."},clientInfoDecodingError:{code:"client_info_decoding_error",desc:"The client info could not be parsed/decoded correctly. Please review the trace to determine the root cause."},clientInfoNotPopulatedError:{code:"client_info_not_populated_error",desc:"The service did not populate client_info in the response, Please verify with the service team"},nullOrEmptyIdToken:{code:"null_or_empty_id_token",desc:"The idToken is null or empty. Please review the trace to determine the root cause."},idTokenNotParsed:{code:"id_token_parsing_error",desc:"ID token cannot be parsed. Please review stack trace to determine root cause."},tokenEncodingError:{code:"token_encoding_error",desc:"The token to be decoded is not encoded correctly."},invalidInteractionType:{code:"invalid_interaction_type",desc:"The interaction type passed to the handler was incorrect or unknown"},cacheParseError:{code:"cannot_parse_cache",desc:"The cached token key is not a valid JSON and cannot be parsed"},blockTokenRequestsInHiddenIframe:{code:"block_token_requests",desc:"Token calls are blocked in hidden iframes"}},E=function(o){O(e,o);function e(t,r){var n=o.call(this,t,r)||this;return n.name="ClientAuthError",Object.setPrototypeOf(n,e.prototype),n}return e.createEndpointResolutionError=function(t){var r=d.endpointResolutionError.desc;return t&&!m.isEmpty(t)&&(r+=" Details: "+t),new e(d.endpointResolutionError.code,r)},e.createPopupWindowError=function(t){var r=d.popUpWindowError.desc;return t&&!m.isEmpty(t)&&(r+=" Details: "+t),new e(d.popUpWindowError.code,r)},e.createTokenRenewalTimeoutError=function(){return new e(d.tokenRenewalError.code,d.tokenRenewalError.desc)},e.createInvalidIdTokenError=function(t){return new e(d.invalidIdToken.code,d.invalidIdToken.desc+" Given token: "+t)},e.createInvalidStateError=function(t,r){return new e(d.invalidStateError.code,d.invalidStateError.desc+" "+t+", state expected : "+r+".")},e.createNonceMismatchError=function(t,r){return new e(d.nonceMismatchError.code,d.nonceMismatchError.desc+" "+t+", nonce expected : "+r+".")},e.createLoginInProgressError=function(){return new e(d.loginProgressError.code,d.loginProgressError.desc)},e.createAcquireTokenInProgressError=function(){return new e(d.acquireTokenProgressError.code,d.acquireTokenProgressError.desc)},e.createUserCancelledError=function(){return new e(d.userCancelledError.code,d.userCancelledError.desc)},e.createErrorInCallbackFunction=function(t){return new e(d.callbackError.code,d.callbackError.desc+" "+t+".")},e.createUserLoginRequiredError=function(){return new e(d.userLoginRequiredError.code,d.userLoginRequiredError.desc)},e.createUserDoesNotExistError=function(){return new e(d.userDoesNotExistError.code,d.userDoesNotExistError.desc)},e.createClientInfoDecodingError=function(t){return new e(d.clientInfoDecodingError.code,d.clientInfoDecodingError.desc+" Failed with error: "+t)},e.createClientInfoNotPopulatedError=function(t){return new e(d.clientInfoNotPopulatedError.code,d.clientInfoNotPopulatedError.desc+" Failed with error: "+t)},e.createIdTokenNullOrEmptyError=function(t){return new e(d.nullOrEmptyIdToken.code,d.nullOrEmptyIdToken.desc+" Raw ID Token Value: "+t)},e.createIdTokenParsingError=function(t){return new e(d.idTokenNotParsed.code,d.idTokenNotParsed.desc+" Failed with error: "+t)},e.createTokenEncodingError=function(t){return new e(d.tokenEncodingError.code,d.tokenEncodingError.desc+" Attempted to decode: "+t)},e.createInvalidInteractionTypeError=function(){return new e(d.invalidInteractionType.code,d.invalidInteractionType.desc)},e.createCacheParseError=function(t){var r="invalid key: "+t+", "+d.cacheParseError.desc;return new e(d.cacheParseError.code,r)},e.createBlockTokenRequestsInHiddenIframeError=function(){return new e(d.blockTokenRequestsInHiddenIframe.code,d.blockTokenRequestsInHiddenIframe.desc)},e}(D);var v={configurationNotSet:{code:"no_config_set",desc:"Configuration has not been set. Please call the UserAgentApplication constructor with a valid Configuration object."},storageNotSupported:{code:"storage_not_supported",desc:"The value for the cacheLocation is not supported."},noRedirectCallbacksSet:{code:"no_redirect_callbacks",desc:"No redirect callbacks have been set. Please call handleRedirectCallback() with the appropriate function arguments before continuing. More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."},invalidCallbackObject:{code:"invalid_callback_object",desc:"The object passed for the callback was invalid. More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."},scopesRequired:{code:"scopes_required",desc:"Scopes are required to obtain an access token."},emptyScopes:{code:"empty_input_scopes_error",desc:"Scopes cannot be passed as empty array."},nonArrayScopes:{code:"nonarray_input_scopes_error",desc:"Scopes cannot be passed as non-array."},invalidPrompt:{code:"invalid_prompt_value",desc:"Supported prompt values are 'login', 'select_account', 'consent' and 'none'"},invalidAuthorityType:{code:"invalid_authority_type",desc:"The given authority is not a valid type of authority supported by MSAL. Please see here for valid authorities: <insert URL here>."},authorityUriInsecure:{code:"authority_uri_insecure",desc:"Authority URIs must use https."},authorityUriInvalidPath:{code:"authority_uri_invalid_path",desc:"Given authority URI is invalid."},unsupportedAuthorityValidation:{code:"unsupported_authority_validation",desc:"The authority validation is not supported for this authority type."},untrustedAuthority:{code:"untrusted_authority",desc:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter or set validateAuthority=false."},b2cAuthorityUriInvalidPath:{code:"b2c_authority_uri_invalid_path",desc:"The given URI for the B2C authority is invalid."},b2cKnownAuthoritiesNotSet:{code:"b2c_known_authorities_not_set",desc:"Must set known authorities when validateAuthority is set to True and using B2C"},claimsRequestParsingError:{code:"claims_request_parsing_error",desc:"Could not parse the given claims request object."},emptyRequestError:{code:"empty_request_error",desc:"Request object is required."},invalidCorrelationIdError:{code:"invalid_guid_sent_as_correlationId",desc:"Please set the correlationId as a valid guid"},telemetryConfigError:{code:"telemetry_config_error",desc:"Telemetry config is not configured with required values"},ssoSilentError:{code:"sso_silent_error",desc:"request must contain either sid or login_hint"},invalidAuthorityMetadataError:{code:"authority_metadata_error",desc:"Invalid authorityMetadata. Must be a JSON object containing authorization_endpoint, end_session_endpoint, and issuer fields."}},_=function(o){O(e,o);function e(t,r){var n=o.call(this,t,r)||this;return n.name="ClientConfigurationError",Object.setPrototypeOf(n,e.prototype),n}return e.createNoSetConfigurationError=function(){return new e(v.configurationNotSet.code,""+v.configurationNotSet.desc)},e.createStorageNotSupportedError=function(t){return new e(v.storageNotSupported.code,v.storageNotSupported.desc+" Given location: "+t)},e.createRedirectCallbacksNotSetError=function(){return new e(v.noRedirectCallbacksSet.code,v.noRedirectCallbacksSet.desc)},e.createInvalidCallbackObjectError=function(t){return new e(v.invalidCallbackObject.code,v.invalidCallbackObject.desc+" Given value for callback function: "+t)},e.createEmptyScopesArrayError=function(t){return new e(v.emptyScopes.code,v.emptyScopes.desc+" Given value: "+t+".")},e.createScopesNonArrayError=function(t){return new e(v.nonArrayScopes.code,v.nonArrayScopes.desc+" Given value: "+t+".")},e.createScopesRequiredError=function(t){return new e(v.scopesRequired.code,v.scopesRequired.desc+" Given value: "+t)},e.createInvalidPromptError=function(t){return new e(v.invalidPrompt.code,v.invalidPrompt.desc+" Given value: "+t)},e.createClaimsRequestParsingError=function(t){return new e(v.claimsRequestParsingError.code,v.claimsRequestParsingError.desc+" Given value: "+t)},e.createEmptyRequestError=function(){var t=v.emptyRequestError,r=t.code,n=t.desc;return new e(r,n)},e.createInvalidCorrelationIdError=function(){return new e(v.invalidCorrelationIdError.code,v.invalidCorrelationIdError.desc)},e.createKnownAuthoritiesNotSetError=function(){return new e(v.b2cKnownAuthoritiesNotSet.code,v.b2cKnownAuthoritiesNotSet.desc)},e.createInvalidAuthorityTypeError=function(){return new e(v.invalidAuthorityType.code,v.invalidAuthorityType.desc)},e.createUntrustedAuthorityError=function(t){return new e(v.untrustedAuthority.code,v.untrustedAuthority.desc+" Provided Authority: "+t)},e.createTelemetryConfigError=function(t){var r=v.telemetryConfigError,n=r.code,i=r.desc,a={applicationName:"string",applicationVersion:"string",telemetryEmitter:"function"},s=Object.keys(a).reduce(function(c,u){return t[u]?c:c.concat([u+" ("+a[u]+")"])},[]);return new e(n,i+" mising values: "+s.join(","))},e.createSsoSilentError=function(){return new e(v.ssoSilentError.code,v.ssoSilentError.desc)},e.createInvalidAuthorityMetadataError=function(){return new e(v.invalidAuthorityMetadataError.code,v.invalidAuthorityMetadataError.desc)},e}(E);var N=function(){function o(){}return o.isIntersectingScopes=function(e,t){for(var r=this.trimAndConvertArrayToLowerCase(x(e)),n=this.trimAndConvertArrayToLowerCase(x(t)),i=0;i<n.length;i++)if(r.indexOf(n[i].toLowerCase())>-1)return!0;return!1},o.containsScope=function(e,t){var r=this.trimAndConvertArrayToLowerCase(x(e)),n=this.trimAndConvertArrayToLowerCase(x(t));return n.every(function(i){return r.indexOf(i.toString().toLowerCase())>=0})},o.trimAndConvertToLowerCase=function(e){return e.trim().toLowerCase()},o.trimAndConvertArrayToLowerCase=function(e){var t=this;return e.map(function(r){return t.trimAndConvertToLowerCase(r)})},o.trimScopes=function(e){return e.map(function(t){return t.trim()})},o.removeElement=function(e,t){var r=this.trimAndConvertToLowerCase(t);return e.filter(function(n){return n!==r})},o.parseScope=function(e){var t="";if(e)for(var r=0;r<e.length;++r)t+=r!==e.length-1?e[r]+" ":e[r];return t},o.validateInputScope=function(e,t){if(!e){if(t)throw _.createScopesRequiredError(e);return}if(!Array.isArray(e))throw _.createScopesNonArrayError(e);if(e.length<1&&t)throw _.createEmptyScopesArrayError(e.toString())},o.getScopeFromState=function(e){if(e){var t=e.indexOf(l.resourceDelimiter);if(t>-1&&t+1<e.length)return e.substring(t+1)}return""},o.appendScopes=function(e,t){if(e){var r=t?this.trimAndConvertArrayToLowerCase(x(t)):null,n=this.trimAndConvertArrayToLowerCase(x(e));return r?x(n,r):n}return null},o.onlyContainsOidcScopes=function(e){var t=e.length,r=0;return e.indexOf(l.openidScope)>-1&&(r+=1),e.indexOf(l.profileScope)>-1&&(r+=1),t>0&&t===r},o.containsAnyOidcScopes=function(e){var t=e.indexOf(l.openidScope)>-1,r=e.indexOf(l.profileScope)>-1;return t||r},o.onlyContainsClientId=function(e,t){return!!e&&e.indexOf(t)>-1&&e.length===1},o.appendDefaultScopes=function(e){var t=e;return t.indexOf(l.openidScope)===-1&&t.push(l.openidScope),t.indexOf(l.profileScope)===-1&&t.push(l.profileScope),t},o.removeDefaultScopes=function(e){return e.filter(function(t){return t!==l.openidScope&&t!==l.profileScope})},o.translateClientIdIfSingleScope=function(e,t){return this.onlyContainsClientId(e,t)?l.oidcScopes:e},o}();var f=function(){function o(){}return o.createNavigateUrl=function(e){var t=this.createNavigationUrlString(e),r=e.authorityInstance.AuthorizationEndpoint;r.indexOf("?")<0?r+="?":r+="&";var n=""+r+t.join("&");return n},o.createNavigationUrlString=function(e){var t=N.appendDefaultScopes(e.scopes),r=[];return r.push("response_type="+e.responseType),r.push("scope="+encodeURIComponent(N.parseScope(t))),r.push("client_id="+encodeURIComponent(e.clientId)),r.push("redirect_uri="+encodeURIComponent(e.redirectUri)),r.push("state="+encodeURIComponent(e.state)),r.push("nonce="+encodeURIComponent(e.nonce)),r.push("client_info=1"),r.push("x-client-SKU="+e.xClientSku),r.push("x-client-Ver="+e.xClientVer),e.promptValue&&r.push("prompt="+encodeURIComponent(e.promptValue)),e.claimsValue&&r.push("claims="+encodeURIComponent(e.claimsValue)),e.queryParameters&&r.push(e.queryParameters),e.extraQueryParameters&&r.push(e.extraQueryParameters),r.push("client-request-id="+encodeURIComponent(e.correlationId)),r},o.getCurrentUrl=function(){return window.location.href.split("?")[0].split("#")[0]},o.removeHashFromUrl=function(e){return e.split("#")[0]},o.replaceTenantPath=function(e,t){var r=e.toLowerCase(),n=this.GetUrlComponents(r),i=n.PathSegments;return t&&i.length!==0&&(i[0]===l.common||i[0]===C.ORGANIZATIONS||i[0]===C.CONSUMERS)&&(i[0]=t),this.constructAuthorityUriFromObject(n,i)},o.constructAuthorityUriFromObject=function(e,t){return this.CanonicalizeUri(e.Protocol+"//"+e.HostNameAndPort+"/"+t.join("/"))},o.isCommonAuthority=function(e){var t=this.CanonicalizeUri(e),r=this.GetUrlComponents(t).PathSegments;return r.length!==0&&r[0]===l.common},o.isOrganizationsAuthority=function(e){var t=this.CanonicalizeUri(e),r=this.GetUrlComponents(t).PathSegments;return r.length!==0&&r[0]===C.ORGANIZATIONS},o.isConsumersAuthority=function(e){var t=this.CanonicalizeUri(e),r=this.GetUrlComponents(t).PathSegments;return r.length!==0&&r[0]===C.CONSUMERS},o.GetUrlComponents=function(e){if(!e)throw"Url required";var t=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),r=e.match(t);if(!r||r.length<6)throw"Valid url required";var n={Protocol:r[1],HostNameAndPort:r[4],AbsolutePath:r[5]},i=n.AbsolutePath.split("/");return i=i.filter(function(a){return a&&a.length>0}),n.PathSegments=i,r[6]&&(n.Search=r[6]),r[8]&&(n.Hash=r[8]),n},o.CanonicalizeUri=function(e){if(e){var t=e.toLowerCase();return o.endsWith(t,"/")||(t+="/"),t}return e},o.endsWith=function(e,t){return!e||!t?!1:e.indexOf(t,e.length-t.length)!==-1},o.urlRemoveQueryStringParameter=function(e,t){if(m.isEmpty(e))return e;var r=e,n=new RegExp("(\\&"+t+"=)[^&]+");return r=e.replace(n,""),n=new RegExp("("+t+"=)[^&]+&"),r=e.replace(n,""),n=new RegExp("("+t+"=)[^&]+"),r=e.replace(n,""),r},o.getHashFromUrl=function(e){var t=e.indexOf("#"),r=e.indexOf("#/");return r>-1?e.substring(r+2):t>-1?e.substring(t+1):e},o.urlContainsHash=function(e){var t=o.deserializeHash(e);return t.hasOwnProperty(p.ERROR_DESCRIPTION)||t.hasOwnProperty(p.ERROR)||t.hasOwnProperty(p.ACCESS_TOKEN)||t.hasOwnProperty(p.ID_TOKEN)},o.deserializeHash=function(e){var t=o.getHashFromUrl(e);return I.deserialize(t)},o.getHostFromUri=function(e){var t=String(e).replace(/^(https?:)\/\//,"");return t=t.split("/")[0],t},o}();var je=function(){function o(e,t,r,n,i){this.authority=f.CanonicalizeUri(e),this.clientId=t,this.scopes=r,this.homeAccountIdentifier=I.base64Encode(n)+"."+I.base64Encode(i)}return o}();var qe=function(){function o(e,t,r,n){this.accessToken=e,this.idToken=t,this.expiresIn=r,this.homeAccountIdentifier=n}return o}();var ne="1.4.16";var X=function(){function o(e,t,r,n,i,a,s){this.authorityInstance=e,this.clientId=t,this.nonce=I.createNewGuid(),this.scopes=i?x(i):l.oidcScopes,this.scopes=N.trimScopes(this.scopes),this.state=a,this.correlationId=s,this.xClientSku="MSAL.JS",this.xClientVer=ne,this.responseType=r,this.redirectUri=n}return Object.defineProperty(o.prototype,"authority",{get:function(){return this.authorityInstance?this.authorityInstance.CanonicalAuthority:null},enumerable:!1,configurable:!0}),o.prototype.populateQueryParams=function(e,t,r,n){var i={};t&&(t.prompt&&(this.promptValue=t.prompt),t.claimsRequest&&(this.claimsValue=t.claimsRequest),o.isSSOParam(t)&&(i=this.constructUnifiedCacheQueryParameter(t,null))),r&&(i=this.constructUnifiedCacheQueryParameter(null,r)),i=this.addHintParameters(e,i);var a=t?t.extraQueryParameters:null;this.queryParameters=o.generateQueryParametersString(i),this.extraQueryParameters=o.generateQueryParametersString(a,n)},o.prototype.constructUnifiedCacheQueryParameter=function(e,t){var r,n,i={};if(e)if(e.account){var a=e.account;a.sid?(r=C.SID,n=a.sid):a.userName&&(r=C.LOGIN_HINT,n=a.userName)}else e.sid?(r=C.SID,n=e.sid):e.loginHint&&(r=C.LOGIN_HINT,n=e.loginHint);else t&&t.hasOwnProperty(l.upn)&&(r=C.ID_TOKEN,n=t.upn);return i=this.addSSOParameter(r,n),i},o.prototype.addHintParameters=function(e,t){var r=t;if(e&&!r[C.SID]){var n=!r[C.LOGIN_HINT]&&e.sid&&this.promptValue===oe.NONE;if(n)r=this.addSSOParameter(C.SID,e.sid,r);else{var i=!r[C.LOGIN_HINT]&&e.userName&&!m.isEmpty(e.userName);i&&(r=this.addSSOParameter(C.LOGIN_HINT,e.userName,r))}}return r},o.prototype.addSSOParameter=function(e,t,r){var n=r||{};if(!t)return n;switch(e){case C.SID:{n[C.SID]=t;break}case C.ID_TOKEN:{n[C.LOGIN_HINT]=t;break}case C.LOGIN_HINT:{n[C.LOGIN_HINT]=t;break}}return n},o.generateQueryParametersString=function(e,t){var r=null;return e&&Object.keys(e).forEach(function(n){n===l.domain_hint&&(t||e[C.SID])||(r?r+="&"+n+"="+encodeURIComponent(e[n]):r=n+"="+encodeURIComponent(e[n]))}),r},o.isSSOParam=function(e){return!!(e&&(e.account||e.sid||e.loginHint))},o.determineResponseType=function(e,t){return N.onlyContainsOidcScopes(t)?Q.id_token:e?this.responseTypeForMatchingAccounts(t):Q.id_token_token},o.responseTypeForMatchingAccounts=function(e){return N.containsAnyOidcScopes(e)?Q.id_token_token:Q.token},o}();var ve=function(){function o(){}return o.prototype.sendRequestAsync=function(e,t,r){var n=this;return new Promise(function(i,a){var s=new XMLHttpRequest;if(s.open(t,e,!0),s.onload=function(){(s.status<200||s.status>=300)&&a(n.handleError(s.responseText));var c;try{c=JSON.parse(s.responseText)}catch{a(n.handleError(s.responseText))}var u={statusCode:s.status,body:c};i(u)},s.onerror=function(){a(s.status)},t===se.GET)s.send();else throw"not implemented"})},o.prototype.handleError=function(e){var t;try{if(t=JSON.parse(e),t.error)return t.error;throw e}catch{return e}},o}();var ce=function(){function o(){}return o.setTrustedAuthoritiesFromConfig=function(e,t){e&&!this.getTrustedHostList().length&&t.forEach(function(r){o.TrustedHostList.push(r.toLowerCase())})},o.getAliases=function(e,t,r){return G(this,void 0,void 0,function(){var n,i,a,s;return W(this,function(c){return n=new ve,i=se.GET,a=""+Fe+e+"oauth2/v2.0/authorize",s=t.createAndStartHttpEvent(r,i,a,"getAliases"),[2,n.sendRequestAsync(a,i,!0).then(function(u){return s.httpResponseStatus=u.statusCode,t.stopEvent(s),u.body.metadata}).catch(function(u){throw s.serverErrorCode=u,t.stopEvent(s),u})]})})},o.setTrustedAuthoritiesFromNetwork=function(e,t,r){return G(this,void 0,void 0,function(){var n,i;return W(this,function(a){switch(a.label){case 0:return[4,this.getAliases(e,t,r)];case 1:return n=a.sent(),n.forEach(function(s){var c=s.aliases;c.forEach(function(u){o.TrustedHostList.push(u.toLowerCase())})}),i=f.GetUrlComponents(e).HostNameAndPort,o.getTrustedHostList().length&&!o.IsInTrustedHostList(i)&&o.TrustedHostList.push(i.toLowerCase()),[2]}})})},o.getTrustedHostList=function(){return this.TrustedHostList},o.IsInTrustedHostList=function(e){return this.TrustedHostList.indexOf(e.toLowerCase())>-1},o.TrustedHostList=[],o}();var ee;(function(o){o[o.Default=0]="Default",o[o.Adfs=1]="Adfs"})(ee||(ee={}));var ye=function(){function o(e,t,r){this.IsValidationEnabled=t,this.CanonicalAuthority=e,this.validateAsUri(),this.tenantDiscoveryResponse=r}return o.isAdfs=function(e){var t=f.GetUrlComponents(e),r=t.PathSegments;return r.length&&r[0].toLowerCase()===l.ADFS},Object.defineProperty(o.prototype,"AuthorityType",{get:function(){return o.isAdfs(this.canonicalAuthority)?ee.Adfs:ee.Default},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"Tenant",{get:function(){return this.CanonicalAuthorityUrlComponents.PathSegments[0]},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"AuthorizationEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.AuthorizationEndpoint.replace(/{tenant}|{tenantid}/g,this.Tenant)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"EndSessionEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.EndSessionEndpoint.replace(/{tenant}|{tenantid}/g,this.Tenant)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"SelfSignedJwtAudience",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.Issuer.replace(/{tenant}|{tenantid}/g,this.Tenant)},enumerable:!1,configurable:!0}),o.prototype.validateResolved=function(){if(!this.hasCachedMetadata())throw"Please call ResolveEndpointsAsync first"},Object.defineProperty(o.prototype,"CanonicalAuthority",{get:function(){return this.canonicalAuthority},set:function(e){this.canonicalAuthority=f.CanonicalizeUri(e),this.canonicalAuthorityUrlComponents=null},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"CanonicalAuthorityUrlComponents",{get:function(){return this.canonicalAuthorityUrlComponents||(this.canonicalAuthorityUrlComponents=f.GetUrlComponents(this.CanonicalAuthority)),this.canonicalAuthorityUrlComponents},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"DefaultOpenIdConfigurationEndpoint",{get:function(){return this.AuthorityType===ee.Adfs?""+this.CanonicalAuthority+Ce:this.CanonicalAuthority+"v2.0/"+Ce},enumerable:!1,configurable:!0}),o.prototype.validateAsUri=function(){var e;try{e=this.CanonicalAuthorityUrlComponents}catch{throw v.invalidAuthorityType}if(!e.Protocol||e.Protocol.toLowerCase()!=="https:")throw v.authorityUriInsecure;if(!e.PathSegments||e.PathSegments.length<1)throw v.authorityUriInvalidPath},o.prototype.DiscoverEndpoints=function(e,t,r){var n=new ve,i=se.GET,a=t.createAndStartHttpEvent(r,i,e,"openIdConfigurationEndpoint");return n.sendRequestAsync(e,i,!0).then(function(s){return a.httpResponseStatus=s.statusCode,t.stopEvent(a),{AuthorizationEndpoint:s.body.authorization_endpoint,EndSessionEndpoint:s.body.end_session_endpoint,Issuer:s.body.issuer}}).catch(function(s){throw a.serverErrorCode=s,t.stopEvent(a),s})},o.prototype.resolveEndpointsAsync=function(e,t){return G(this,void 0,void 0,function(){var r,n,i;return W(this,function(a){switch(a.label){case 0:return this.IsValidationEnabled?(r=this.canonicalAuthorityUrlComponents.HostNameAndPort,ce.getTrustedHostList().length!==0?[3,2]:[4,ce.setTrustedAuthoritiesFromNetwork(this.canonicalAuthority,e,t)]):[3,3];case 1:a.sent(),a.label=2;case 2:if(!ce.IsInTrustedHostList(r))throw _.createUntrustedAuthorityError(r);a.label=3;case 3:return n=this.GetOpenIdConfigurationEndpoint(),i=this,[4,this.DiscoverEndpoints(n,e,t)];case 4:return i.tenantDiscoveryResponse=a.sent(),[2,this.tenantDiscoveryResponse]}})})},o.prototype.hasCachedMetadata=function(){return!!(this.tenantDiscoveryResponse&&this.tenantDiscoveryResponse.AuthorizationEndpoint&&this.tenantDiscoveryResponse.EndSessionEndpoint&&this.tenantDiscoveryResponse.Issuer)},o.prototype.GetOpenIdConfigurationEndpoint=function(){return this.DefaultOpenIdConfigurationEndpoint},o}();var ie=function(){function o(e,t){if(!e||m.isEmpty(e)){this.uid="",this.utid="";return}try{var r=I.base64Decode(e),n=JSON.parse(r);n&&(n.hasOwnProperty("uid")&&(this.uid=t?o.stripPolicyFromUid(n.uid,t):n.uid),n.hasOwnProperty("utid")&&(this.utid=n.utid))}catch(i){throw E.createClientInfoDecodingError(i)}}return Object.defineProperty(o.prototype,"uid",{get:function(){return this._uid?this._uid:""},set:function(e){this._uid=e},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"utid",{get:function(){return this._utid?this._utid:""},set:function(e){this._utid=e},enumerable:!1,configurable:!0}),o.createClientInfoFromIdToken=function(e,t){var r={uid:e.subject,utid:""};return new o(I.base64Encode(JSON.stringify(r)),t)},o.stripPolicyFromUid=function(e,t){var r=e.split("-"),n=t.split("/").reverse(),i="";return m.isEmpty(n[0])?n.length>1&&(i=n[1]):i=n[0],r[r.length-1]===i?r.slice(0,r.length-1).join("-"):e},o.prototype.encodeClientInfo=function(){var e=JSON.stringify({uid:this.uid,utid:this.utid});return I.base64Encode(e)},o}();var Y=function(){function o(){}return o.parseExpiresIn=function(e){var t=e||"3599";return parseInt(t,10)},o.now=function(){return Math.round(new Date().getTime()/1e3)},o.relativeNowMs=function(){return window.performance.now()},o}();var ue=function(){function o(){}return o.decodeJwt=function(e){if(m.isEmpty(e))return null;var t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/,r=t.exec(e);if(!r||r.length<4)return null;var n={header:r[1],JWSPayload:r[2],JWSSig:r[3]};return n},o.validateExpirationIsWithinOffset=function(e,t){var r=t||300;return e&&e>Y.now()+r},o.extractIdToken=function(e){var t=this.decodeJwt(e);if(!t)return null;try{var r=t.JWSPayload,n=I.base64Decode(r);return n?JSON.parse(n):null}catch{}return null},o}();var $=function(){function o(e){if(m.isEmpty(e))throw E.createIdTokenNullOrEmptyError(e);try{this.rawIdToken=e,this.claims=ue.extractIdToken(e),this.claims&&(this.claims.hasOwnProperty("iss")&&(this.issuer=this.claims.iss),this.claims.hasOwnProperty("oid")&&(this.objectId=this.claims.oid),this.claims.hasOwnProperty("sub")&&(this.subject=this.claims.sub),this.claims.hasOwnProperty("tid")&&(this.tenantId=this.claims.tid),this.claims.hasOwnProperty("ver")&&(this.version=this.claims.ver),this.claims.hasOwnProperty("preferred_username")?this.preferredName=this.claims.preferred_username:this.claims.hasOwnProperty("upn")&&(this.preferredName=this.claims.upn),this.claims.hasOwnProperty("name")&&(this.name=this.claims.name),this.claims.hasOwnProperty("nonce")&&(this.nonce=this.claims.nonce),this.claims.hasOwnProperty("exp")&&(this.expiration=this.claims.exp),this.claims.hasOwnProperty("home_oid")&&(this.homeObjectId=this.claims.home_oid),this.claims.hasOwnProperty("sid")&&(this.sid=this.claims.sid),this.claims.hasOwnProperty("cloud_instance_host_name")&&(this.cloudInstance=this.claims.cloud_instance_host_name))}catch(t){throw E.createIdTokenParsingError(t)}}return o}();var Ge=function(){function o(e,t){this.key=e,this.value=t}return o}();var _e=function(){function o(e){if(!window)throw D.createNoWindowObjectError("Browser storage class could not find window object");var t=typeof window[e]!="undefined"&&window[e]!==null;if(!t)throw _.createStorageNotSupportedError(e);this.cacheLocation=e}return o.prototype.setItem=function(e,t,r){window[this.cacheLocation].setItem(e,t),r&&this.setItemCookie(e,t)},o.prototype.getItem=function(e,t){return t&&this.getItemCookie(e)?this.getItemCookie(e):window[this.cacheLocation].getItem(e)},o.prototype.removeItem=function(e){return window[this.cacheLocation].removeItem(e)},o.prototype.clear=function(){return window[this.cacheLocation].clear()},o.prototype.setItemCookie=function(e,t,r){var n=encodeURIComponent(e)+"="+encodeURIComponent(t)+";path=/;";if(r){var i=this.getCookieExpirationTime(r);n+="expires="+i+";"}document.cookie=n},o.prototype.getItemCookie=function(e){for(var t=encodeURIComponent(e)+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var i=r[n];i.charAt(0)===" ";)i=i.substring(1);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}return""},o.prototype.clearItemCookie=function(e){this.setItemCookie(e,"",-1)},o.prototype.getCookieExpirationTime=function(e){var t=new Date,r=new Date(t.getTime()+e*24*60*60*1e3);return r.toUTCString()},o}();var F=function(){function o(){}return o.validateRequest=function(e,t,r,n){if(!t&&!e)throw _.createEmptyRequestError();var i,a;e&&(i=t?N.appendScopes(e.scopes,e.extraScopesToConsent):e.scopes,N.validateInputScope(i,!t),i=N.translateClientIdIfSingleScope(i,r),this.validatePromptParameter(e.prompt),a=this.validateEQParameters(e.extraQueryParameters,e.claimsRequest),this.validateClaimsRequest(e.claimsRequest));var s=this.validateAndGenerateState(e&&e.state,n),c=this.validateAndGenerateCorrelationId(e&&e.correlationId),u=S(S({},e),{extraQueryParameters:a,scopes:i,state:s,correlationId:c});return u},o.validatePromptParameter=function(e){if(e&&[oe.LOGIN,oe.SELECT_ACCOUNT,oe.CONSENT,oe.NONE].indexOf(e)<0)throw _.createInvalidPromptError(e)},o.validateEQParameters=function(e,t){var r=S({},e);return r?(t&&delete r[l.claims],Ke.forEach(function(n){r[n]&&delete r[n]}),r):null},o.validateClaimsRequest=function(e){if(!!e)try{JSON.parse(e)}catch(t){throw _.createClaimsRequestParsingError(t)}},o.validateAndGenerateState=function(e,t){return m.isEmpty(e)?o.generateLibraryState(t):""+o.generateLibraryState(t)+l.resourceDelimiter+e},o.generateLibraryState=function(e){var t={id:I.createNewGuid(),ts:Y.now(),method:e},r=JSON.stringify(t);return I.base64Encode(r)},o.parseLibraryState=function(e){var t=decodeURIComponent(e).split(l.resourceDelimiter)[0];if(I.isGuid(t))return{id:t,ts:Y.now(),method:l.interactionTypeRedirect};try{var r=I.base64Decode(t),n=JSON.parse(r);return n}catch{throw E.createInvalidStateError(e,null)}},o.validateAndGenerateCorrelationId=function(e){if(e&&!I.isGuid(e))throw _.createInvalidCorrelationIdError();return I.isGuid(e)?e:I.createNewGuid()},o.createRequestSignature=function(e){return""+e.scopes.join(" ").toLowerCase()+l.resourceDelimiter+e.authority},o}();var A=function(o){O(e,o);function e(t,r,n){var i=o.call(this,r)||this;return i.temporaryCache=new _e(De),i.clientId=t,i.rollbackEnabled=!0,i.migrateCacheEntries(n),i}return e.prototype.migrateCacheEntries=function(t){var r=this,n=l.cachePrefix+"."+H.IDTOKEN,i=l.cachePrefix+"."+H.CLIENT_INFO,a=l.cachePrefix+"."+P.ERROR,s=l.cachePrefix+"."+P.ERROR_DESC,c=o.prototype.getItem.call(this,n),u;if(c)try{u=new $(c)}catch{return}if(u&&u.claims&&u.claims.aud===this.clientId){var h=o.prototype.getItem.call(this,i),y=o.prototype.getItem.call(this,a),T=o.prototype.getItem.call(this,s),w=[c,h,y,T],k=[H.IDTOKEN,H.CLIENT_INFO,P.ERROR,P.ERROR_DESC];k.forEach(function(U,V){return r.duplicateCacheEntry(U,w[V],t)})}},e.prototype.duplicateCacheEntry=function(t,r,n){r&&this.setItem(t,r,n)},e.prototype.generateCacheKey=function(t,r){try{return JSON.parse(t),t}catch{return t.indexOf(""+l.cachePrefix)===0||t.indexOf(l.adalIdToken)===0?t:r?l.cachePrefix+"."+this.clientId+"."+t:l.cachePrefix+"."+t}},e.prototype.matchKeyForType=function(t,r,n,i){var a=m.validateAndParseJsonCacheKey(t);if(!a)return null;var s=t.match(r)&&t.match(n),c=!1;switch(i){case p.ACCESS_TOKEN:c=!!t.match(l.scopes);break;case p.ID_TOKEN:c=!t.match(l.scopes);break}return s&&c?a:null},e.prototype.setItem=function(t,r,n){o.prototype.setItem.call(this,this.generateCacheKey(t,!0),r,n),this.rollbackEnabled&&!n&&o.prototype.setItem.call(this,this.generateCacheKey(t,!1),r,n)},e.prototype.getItem=function(t,r){return o.prototype.getItem.call(this,this.generateCacheKey(t,!0),r)},e.prototype.removeItem=function(t){this.temporaryCache.removeItem(this.generateCacheKey(t,!0)),o.prototype.removeItem.call(this,this.generateCacheKey(t,!0)),this.rollbackEnabled&&o.prototype.removeItem.call(this,this.generateCacheKey(t,!1))},e.prototype.setTemporaryItem=function(t,r,n){this.temporaryCache.setItem(this.generateCacheKey(t,!0),r,n)},e.prototype.getTemporaryItem=function(t,r){return this.temporaryCache.getItem(this.generateCacheKey(t,!0),r)},e.prototype.resetCacheItems=function(){var t=window[this.cacheLocation],r;for(r in t)t.hasOwnProperty(r)&&r.indexOf(l.cachePrefix)!==-1&&o.prototype.removeItem.call(this,r)},e.prototype.resetTempCacheItems=function(t){var r=this,n=t&&F.parseLibraryState(t).id,i=this.tokenRenewalInProgress(t),a=window[this.cacheLocation];n&&!i&&Object.keys(a).forEach(function(s){s.indexOf(n)!==-1&&(r.removeItem(s),o.prototype.clearItemCookie.call(r,s))}),this.setInteractionInProgress(!1),this.removeItem(b.REDIRECT_REQUEST)},e.prototype.setItemCookie=function(t,r,n){o.prototype.setItemCookie.call(this,this.generateCacheKey(t,!0),r,n),this.rollbackEnabled&&o.prototype.setItemCookie.call(this,this.generateCacheKey(t,!1),r,n)},e.prototype.clearItemCookie=function(t){o.prototype.clearItemCookie.call(this,this.generateCacheKey(t,!0)),this.rollbackEnabled&&o.prototype.clearItemCookie.call(this,this.generateCacheKey(t,!1))},e.prototype.getItemCookie=function(t){return o.prototype.getItemCookie.call(this,this.generateCacheKey(t,!0))},e.prototype.getAllTokensByType=function(t,r,n){var i=this,a=Object.keys(window[this.cacheLocation]).reduce(function(s,c){var u=i.matchKeyForType(c,t,r,n);if(u){var h=i.getItem(c);if(h)try{var y=new Ge(u,JSON.parse(h));return s.concat([y])}catch{return s}}return s},[]);return a},e.prototype.getAllAccessTokens=function(t,r){return this.getAllTokensByType(t,r,p.ACCESS_TOKEN)},e.prototype.getAllIdTokens=function(t,r){return this.getAllTokensByType(t,r,p.ID_TOKEN)},e.prototype.getAllTokens=function(t,r){var n=this.getAllAccessTokens(t,r),i=this.getAllIdTokens(t,r);return x(n,i)},e.prototype.isInteractionInProgress=function(t){var r=this.getInteractionInProgress();return t?r===this.clientId:!!r},e.prototype.getInteractionInProgress=function(){return this.getTemporaryItem(this.generateCacheKey(b.INTERACTION_STATUS,!1))},e.prototype.setInteractionInProgress=function(t){if(t){if(this.isInteractionInProgress(!1))throw E.createAcquireTokenInProgressError();this.setTemporaryItem(this.generateCacheKey(b.INTERACTION_STATUS,!1),this.clientId)}else!t&&this.isInteractionInProgress(!0)&&this.removeItem(this.generateCacheKey(b.INTERACTION_STATUS,!1))},e.prototype.tokenRenewalInProgress=function(t){var r=this.getItem(e.generateTemporaryCacheKey(b.RENEW_STATUS,t));return!!(r&&r===l.inProgress)},e.prototype.clearMsalCookie=function(t){var r=this;if(t)this.clearItemCookie(e.generateTemporaryCacheKey(b.NONCE_IDTOKEN,t)),this.clearItemCookie(e.generateTemporaryCacheKey(b.STATE_LOGIN,t)),this.clearItemCookie(e.generateTemporaryCacheKey(b.LOGIN_REQUEST,t)),this.clearItemCookie(e.generateTemporaryCacheKey(b.STATE_ACQ_TOKEN,t));else{var n=document.cookie.split(";");n.forEach(function(i){var a=i.trim().split("=")[0];a.indexOf(l.cachePrefix)>-1&&o.prototype.clearItemCookie.call(r,a)})}},e.generateAcquireTokenAccountKey=function(t,r){var n=F.parseLibraryState(r).id;return""+b.ACQUIRE_TOKEN_ACCOUNT+l.resourceDelimiter+t+l.resourceDelimiter+n},e.generateAuthorityKey=function(t){return e.generateTemporaryCacheKey(b.AUTHORITY,t)},e.generateTemporaryCacheKey=function(t,r){var n=F.parseLibraryState(r).id;return""+t+l.resourceDelimiter+n},e}(_e);var ae=function(){function o(e,t,r,n,i,a,s){this.accountIdentifier=e,this.homeAccountIdentifier=t,this.userName=r,this.name=n,this.idToken=i,this.idTokenClaims=i,this.sid=a,this.environment=s}return o.createAccount=function(e,t){var r=e.objectId||e.subject,n=t?t.uid:"",i=t?t.utid:"",a;return m.isEmpty(n)||(a=m.isEmpty(i)?I.base64Encode(n):I.base64Encode(n)+"."+I.base64Encode(i)),new o(r,a,e.preferredName,e.name,e.claims,e.sid,e.issuer)},o.compareAccounts=function(e,t){return!e||!t?!1:!!(e.homeAccountIdentifier&&t.homeAccountIdentifier&&e.homeAccountIdentifier===t.homeAccountIdentifier)},o}();var L=function(){function o(){}return o.isInIframe=function(){return window.parent!==window},o.isInPopup=function(){return!!(window.opener&&window.opener!==window)},o.generateFrameName=function(e,t){return""+e+l.resourceDelimiter+t},o.monitorIframeForHash=function(e,t,r,n){return new Promise(function(i,a){var s=Y.relativeNowMs(),c=s+t;n.verbose("monitorWindowForIframe polling started");var u=setInterval(function(){if(Y.relativeNowMs()>c){n.error("monitorIframeForHash unable to find hash in url, timing out"),n.errorPii("monitorIframeForHash polling timed out for url: "+r),clearInterval(u),a(E.createTokenRenewalTimeoutError());return}var h;try{h=e.location.href}catch{}h&&f.urlContainsHash(h)&&(n.verbose("monitorIframeForHash found url in hash"),clearInterval(u),i(e.location.hash))},o.POLLING_INTERVAL_MS)})},o.monitorPopupForHash=function(e,t,r,n){return new Promise(function(i,a){var s=t/o.POLLING_INTERVAL_MS,c=0;n.verbose("monitorWindowForHash polling started");var u=setInterval(function(){if(e.closed){n.error("monitorWindowForHash window closed"),clearInterval(u),a(E.createUserCancelledError());return}var h;try{h=e.location.href}catch{}if(!(!h||h==="about:blank"))if(c++,h&&f.urlContainsHash(h)){n.verbose("monitorPopupForHash found url in hash"),clearInterval(u);var y=e.location.hash;o.clearUrlFragment(e),i(y)}else c>s&&(n.error("monitorPopupForHash unable to find hash in url, timing out"),n.errorPii("monitorPopupForHash polling timed out for url: "+r),clearInterval(u),a(E.createTokenRenewalTimeoutError()))},o.POLLING_INTERVAL_MS)})},o.loadFrame=function(e,t,r,n){var i=this;return n.infoPii("LoadFrame: "+t),new Promise(function(a,s){setTimeout(function(){var c=i.loadFrameSync(e,t,n);if(!c){s("Unable to load iframe with name: "+t);return}a(c)},r)})},o.loadFrameSync=function(e,t,r){var n=o.addHiddenIFrame(t,r);if(n)(n.src===""||n.src==="about:blank")&&(n.src=e,r.infoPii("Frame Name : "+t+" Navigated to: "+e));else return null;return n},o.addHiddenIFrame=function(e,t){if(typeof e=="undefined")return null;t.info("Add msal iframe to document"),t.infoPii("Add msal frame to document:"+e);var r=document.getElementById(e);if(r)t.verbose("Add msal iframe already exists");else{t.verbose("Add msal iframe does not exist");var n=document.createElement("iframe");n.setAttribute("id",e),n.setAttribute("aria-hidden","true"),n.style.visibility="hidden",n.style.position="absolute",n.style.width=n.style.height="0",n.style.border="0",n.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),r=document.getElementsByTagName("body")[0].appendChild(n)}return r},o.removeHiddenIframe=function(e){document.body===e.parentNode&&document.body.removeChild(e)},o.getIframeWithHash=function(e){var t=document.getElementsByTagName("iframe"),r=Array.apply(null,Array(t.length)).map(function(n,i){return t.item(i)});return r.filter(function(n){try{return n.contentWindow.location.hash===e}catch{return!1}})[0]},o.getPopups=function(){return window.openedWindows||(window.openedWindows=[]),window.openedWindows},o.getPopUpWithHash=function(e){return o.getPopups().filter(function(t){try{return t.location.hash===e}catch{return!1}})[0]},o.trackPopup=function(e){o.getPopups().push(e)},o.closePopups=function(){o.getPopups().forEach(function(e){return e.close()})},o.blockReloadInHiddenIframes=function(){if(f.urlContainsHash(window.location.hash)&&o.isInIframe())throw E.createBlockTokenRequestsInHiddenIframeError()},o.checkIfBackButtonIsPressed=function(e){var t=e.getItem(b.REDIRECT_REQUEST);if(t&&!f.urlContainsHash(window.location.hash)){var r=t.split(l.resourceDelimiter);r.shift();var n=r.length>0?r.join(l.resourceDelimiter):null;e.resetTempCacheItems(n)}},o.clearUrlFragment=function(e){e.location.hash="",typeof e.history.replaceState=="function"&&e.history.replaceState(null,null,""+e.location.pathname+e.location.search)},o.POLLING_INTERVAL_MS=50,o}();var Ee=function(){function o(){}return o.setResponseIdToken=function(e,t){if(e){if(!t)return e}else return null;var r=Number(t.expiration);return r&&!e.expiresOn&&(e.expiresOn=new Date(r*1e3)),S(S({},e),{idToken:t,idTokenClaims:t.claims,uniqueId:t.objectId||t.subject,tenantId:t.tenantId})},o.buildAuthResponse=function(e,t,r,n,i,a){switch(r.responseType){case Q.id_token:var s=S(S({},t),{tokenType:p.ID_TOKEN,account:n,scopes:i,accountState:a});return s=o.setResponseIdToken(s,e),s.idToken?s:null;case Q.id_token_token:var c=o.setResponseIdToken(t,e);return c&&c.accessToken&&c.idToken?c:null;case Q.token:var u=o.setResponseIdToken(t,e);return u;default:return null}},o}();var z=function(){function o(){}return o.saveMetadataFromNetwork=function(e,t,r){return G(this,void 0,void 0,function(){var n;return W(this,function(i){switch(i.label){case 0:return[4,e.resolveEndpointsAsync(t,r)];case 1:return n=i.sent(),this.metadataMap.set(e.CanonicalAuthority,n),[2,n]}})})},o.getMetadata=function(e){return this.metadataMap.get(e)},o.saveMetadataFromConfig=function(e,t){try{if(t){var r=JSON.parse(t);if(!r.authorization_endpoint||!r.end_session_endpoint||!r.issuer)throw _.createInvalidAuthorityMetadataError();this.metadataMap.set(e,{AuthorizationEndpoint:r.authorization_endpoint,EndSessionEndpoint:r.end_session_endpoint,Issuer:r.issuer})}}catch{throw _.createInvalidAuthorityMetadataError()}},o.CreateInstance=function(e,t,r){return m.isEmpty(e)?null:(r&&this.saveMetadataFromConfig(e,r),new ye(e,t,this.metadataMap.get(e)))},o.metadataMap=new Map,o}();var M;(function(o){o[o.Error=0]="Error",o[o.Warning=1]="Warning",o[o.Info=2]="Info",o[o.Verbose=3]="Verbose"})(M||(M={}));var We=function(){function o(e,t){t===void 0&&(t={}),this.level=M.Info;var r=t.correlationId,n=r===void 0?"":r,i=t.level,a=i===void 0?M.Info:i,s=t.piiLoggingEnabled,c=s===void 0?!1:s;this.localCallback=e,this.correlationId=n,this.level=a,this.piiLoggingEnabled=c}return o.prototype.logMessage=function(e,t,r){if(!(e>this.level||!this.piiLoggingEnabled&&r)){var n=new Date().toUTCString(),i;m.isEmpty(this.correlationId)?i=n+":"+ne+"-"+M[e]+(r?"-pii":"")+" "+t:i=n+":"+this.correlationId+"-"+ne+"-"+M[e]+(r?"-pii":"")+" "+t,this.executeCallback(e,i,r)}},o.prototype.executeCallback=function(e,t,r){this.localCallback&&this.localCallback(e,t,r)},o.prototype.error=function(e){this.logMessage(M.Error,e,!1)},o.prototype.errorPii=function(e){this.logMessage(M.Error,e,!0)},o.prototype.warning=function(e){this.logMessage(M.Warning,e,!1)},o.prototype.warningPii=function(e){this.logMessage(M.Warning,e,!0)},o.prototype.info=function(e){this.logMessage(M.Info,e,!1)},o.prototype.infoPii=function(e){this.logMessage(M.Info,e,!0)},o.prototype.verbose=function(e){this.logMessage(M.Verbose,e,!1)},o.prototype.verbosePii=function(e){this.logMessage(M.Verbose,e,!0)},o.prototype.isPiiLoggingEnabled=function(){return this.piiLoggingEnabled},o}();var nt=6e3,it=300,at=500,st={clientId:"",authority:null,validateAuthority:!0,authorityMetadata:"",knownAuthorities:[],redirectUri:function(){return f.getCurrentUrl()},postLogoutRedirectUri:function(){return f.getCurrentUrl()},navigateToLoginRequestUrl:!0},ct={cacheLocation:"sessionStorage",storeAuthStateInCookie:!1},ut={logger:new We(null),loadFrameTimeout:nt,tokenRenewalOffsetSeconds:it,navigateFrameWait:at},lt={isAngular:!1,unprotectedResources:new Array,protectedResourceMap:new Map};function Be(o){var e=o.auth,t=o.cache,r=t===void 0?{}:t,n=o.system,i=n===void 0?{}:n,a=o.framework,s=a===void 0?{}:a,c={auth:S(S({},st),e),cache:S(S({},ct),r),system:S(S({},ut),i),framework:S(S({},lt),s)};return c}var ke={serverUnavailable:{code:"server_unavailable",desc:"Server is temporarily unavailable."},unknownServerError:{code:"unknown_server_error"}},Te=function(o){O(e,o);function e(t,r){var n=o.call(this,t,r)||this;return n.name="ServerError",Object.setPrototypeOf(n,e.prototype),n}return e.createServerUnavailableError=function(){return new e(ke.serverUnavailable.code,ke.serverUnavailable.desc)},e.createUnknownServerError=function(t){return new e(ke.unknownServerError.code,t)},e}(D);var le={interactionRequired:{code:"interaction_required"},consentRequired:{code:"consent_required"},loginRequired:{code:"login_required"}},be=function(o){O(e,o);function e(t,r){var n=o.call(this,t,r)||this;return n.name="InteractionRequiredAuthError",Object.setPrototypeOf(n,e.prototype),n}return e.isInteractionRequiredError=function(t){var r=[le.interactionRequired.code,le.consentRequired.code,le.loginRequired.code];return t&&r.indexOf(t)>-1},e.createLoginRequiredAuthError=function(t){return new e(le.loginRequired.code,t)},e.createInteractionRequiredAuthError=function(t){return new e(le.interactionRequired.code,t)},e.createConsentRequiredAuthError=function(t){return new e(le.consentRequired.code,t)},e}(Te);function pe(o){return{uniqueId:"",tenantId:"",tokenType:"",idToken:null,idTokenClaims:null,accessToken:"",scopes:null,expiresOn:null,account:null,accountState:o,fromCache:!1}}var Ve="msal.",Re="event_name",Qe="start_time",Oe="elapsed_time",J={MsalCorrelationIdConstStrKey:"Microsoft.MSAL.correlation_id",ApiTelemIdConstStrKey:"msal.api_telem_id",ApiIdConstStrKey:"msal.api_id",BrokerAppConstStrKey:"Microsoft_MSAL_broker_app",CacheEventCountConstStrKey:"Microsoft_MSAL_cache_event_count",HttpEventCountTelemetryBatchKey:"Microsoft_MSAL_http_event_count",IdpConstStrKey:"Microsoft_MSAL_idp",IsSilentTelemetryBatchKey:"",IsSuccessfulConstStrKey:"Microsoft_MSAL_is_successful",ResponseTimeConstStrKey:"Microsoft_MSAL_response_time",TenantIdConstStrKey:"Microsoft_MSAL_tenant_id",UiEventCountTelemetryBatchKey:"Microsoft_MSAL_ui_event_count"},ze="<tenant>";var de=function(o){var e=f.GetUrlComponents(o);if(ye.isAdfs(o))return o;var t=e.PathSegments;if(t&&t.length>=2){var r=t[1]==="tfp"?2:1;r<t.length&&(t[r]=ze)}return e.Protocol+"//"+e.HostNameAndPort+"/"+t.join("/")},Ie=function(o){return I.base64Encode(o)},g=function(o){return""+Ve+(o||"")},Je=function(){return!!(typeof window!="undefined"&&"performance"in window&&window.performance.mark&&window.performance.measure)},Ye=function(o,e,t){Je()&&(window.performance.mark(t),window.performance.measure(o,e,t),window.performance.clearMeasures(o),window.performance.clearMarks(e),window.performance.clearMarks(t))},Xe=function(o){Je()&&window.performance.mark(o)};var ht=function(){function o(e,t,r){var n;this.eventId=I.createNewGuid(),this.label=r,this.event=(n={},n[g(Re)]=e,n[g(Oe)]=-1,n[""+J.MsalCorrelationIdConstStrKey]=t,n)}return o.prototype.setElapsedTime=function(e){this.event[g(Oe)]=e},o.prototype.stop=function(){this.setElapsedTime(+Date.now()-+this.startTimestamp),Ye(this.displayName,this.perfStartMark,this.perfEndMark)},o.prototype.start=function(){this.startTimestamp=Date.now(),this.event[g(Qe)]=this.startTimestamp,Xe(this.perfStartMark)},Object.defineProperty(o.prototype,"telemetryCorrelationId",{get:function(){return this.event[""+J.MsalCorrelationIdConstStrKey]},set:function(e){this.event[""+J.MsalCorrelationIdConstStrKey]=e},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"eventName",{get:function(){return this.event[g(Re)]},enumerable:!1,configurable:!0}),o.prototype.get=function(){return S(S({},this.event),{eventId:this.eventId})},Object.defineProperty(o.prototype,"key",{get:function(){return this.telemetryCorrelationId+"_"+this.eventId+"-"+this.eventName},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"displayName",{get:function(){return"Msal-"+this.label+"-"+this.telemetryCorrelationId},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"perfStartMark",{get:function(){return"start-"+this.key},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"perfEndMark",{get:function(){return"end-"+this.key},enumerable:!1,configurable:!0}),o}(),he=ht;var pt=function(o){O(e,o);function e(t,r,n,i){var a=o.call(this,g("default_event"),r,"DefaultEvent")||this;return a.event[g("client_id")]=n,a.event[g("sdk_plaform")]=t.sdk,a.event[g("sdk_version")]=t.sdkVersion,a.event[g("application_name")]=t.applicationName,a.event[g("application_version")]=t.applicationVersion,a.event[g("effective_connection_speed")]=t.networkInformation&&t.networkInformation.connectionSpeed,a.event[""+J.UiEventCountTelemetryBatchKey]=a.getEventCount(g("ui_event"),i),a.event[""+J.HttpEventCountTelemetryBatchKey]=a.getEventCount(g("http_event"),i),a.event[""+J.CacheEventCountConstStrKey]=a.getEventCount(g("cache_event"),i),a}return e.prototype.getEventCount=function(t,r){return r[t]?r[t]:0},e}(he),$e=pt;var te,Z={AUTHORITY:g("authority"),AUTHORITY_TYPE:g("authority_type"),PROMPT:g("ui_behavior"),TENANT_ID:g("tenant_id"),USER_ID:g("user_id"),WAS_SUCESSFUL:g("was_successful"),API_ERROR_CODE:g("api_error_code"),LOGIN_HINT:g("login_hint")},re;(function(o){o[o.AcquireTokenRedirect=2001]="AcquireTokenRedirect",o[o.AcquireTokenSilent=2002]="AcquireTokenSilent",o[o.AcquireTokenPopup=2003]="AcquireTokenPopup",o[o.LoginRedirect=2004]="LoginRedirect",o[o.LoginPopup=2005]="LoginPopup",o[o.Logout=2006]="Logout"})(re||(re={}));var K;(function(o){o.AcquireTokenRedirect="AcquireTokenRedirect",o.AcquireTokenSilent="AcquireTokenSilent",o.AcquireTokenPopup="AcquireTokenPopup",o.LoginRedirect="LoginRedirect",o.LoginPopup="LoginPopup",o.Logout="Logout"})(K||(K={}));var dt=(te={},te[K.AcquireTokenSilent]=re.AcquireTokenSilent,te[K.AcquireTokenPopup]=re.AcquireTokenPopup,te[K.AcquireTokenRedirect]=re.AcquireTokenRedirect,te[K.LoginPopup]=re.LoginPopup,te[K.LoginRedirect]=re.LoginRedirect,te[K.Logout]=re.Logout,te),ft=function(o){O(e,o);function e(t,r,n){var i=o.call(this,g("api_event"),t,n)||this;return n&&(i.apiCode=dt[n],i.apiEventIdentifier=n),i.piiEnabled=r,i}return Object.defineProperty(e.prototype,"apiEventIdentifier",{set:function(t){this.event[J.ApiTelemIdConstStrKey]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apiCode",{set:function(t){this.event[J.ApiIdConstStrKey]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"authority",{set:function(t){this.event[Z.AUTHORITY]=de(t).toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apiErrorCode",{set:function(t){this.event[Z.API_ERROR_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tenantId",{set:function(t){this.event[Z.TENANT_ID]=this.piiEnabled&&t?Ie(t):null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"accountId",{set:function(t){this.event[Z.USER_ID]=this.piiEnabled&&t?Ie(t):null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wasSuccessful",{get:function(){return this.event[Z.WAS_SUCESSFUL]===!0},set:function(t){this.event[Z.WAS_SUCESSFUL]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loginHint",{set:function(t){this.event[Z.LOGIN_HINT]=this.piiEnabled&&t?Ie(t):null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"authorityType",{set:function(t){this.event[Z.AUTHORITY_TYPE]=t.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"promptType",{set:function(t){this.event[Z.PROMPT]=t.toLowerCase()},enumerable:!1,configurable:!0}),e}(he),Ze=ft;var B={HTTP_PATH:g("http_path"),USER_AGENT:g("user_agent"),QUERY_PARAMETERS:g("query_parameters"),API_VERSION:g("api_version"),RESPONSE_CODE:g("response_code"),O_AUTH_ERROR_CODE:g("oauth_error_code"),HTTP_METHOD:g("http_method"),REQUEST_ID_HEADER:g("request_id_header"),SPE_INFO:g("spe_info"),SERVER_ERROR_CODE:g("server_error_code"),SERVER_SUB_ERROR_CODE:g("server_sub_error_code"),URL:g("url")},gt=function(o){O(e,o);function e(t,r){return o.call(this,g("http_event"),t,r)||this}return Object.defineProperty(e.prototype,"url",{set:function(t){var r=de(t);this.event[B.URL]=r&&r.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"httpPath",{set:function(t){this.event[B.HTTP_PATH]=de(t).toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userAgent",{set:function(t){this.event[B.USER_AGENT]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"queryParams",{set:function(t){this.event[B.QUERY_PARAMETERS]=X.generateQueryParametersString(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apiVersion",{set:function(t){this.event[B.API_VERSION]=t.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"httpResponseStatus",{set:function(t){this.event[B.RESPONSE_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"oAuthErrorCode",{set:function(t){this.event[B.O_AUTH_ERROR_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"httpMethod",{set:function(t){this.event[B.HTTP_METHOD]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"requestIdHeader",{set:function(t){this.event[B.REQUEST_ID_HEADER]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speInfo",{set:function(t){this.event[B.SPE_INFO]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"serverErrorCode",{set:function(t){this.event[B.SERVER_ERROR_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"serverSubErrorCode",{set:function(t){this.event[B.SERVER_SUB_ERROR_CODE]=t},enumerable:!1,configurable:!0}),e}(he),et=gt;var mt=function(){function o(e,t,r){this.completedEvents={},this.inProgressEvents={},this.eventCountByCorrelationId={},this.onlySendFailureTelemetry=!1,this.telemetryPlatform=S({sdk:l.libraryName,sdkVersion:ne,networkInformation:{connectionSpeed:typeof navigator!="undefined"&&navigator.connection&&navigator.connection.effectiveType}},e.platform),this.clientId=e.clientId,this.onlySendFailureTelemetry=e.onlySendFailureTelemetry,this.telemetryEmitter=t,this.logger=r}return o.getTelemetrymanagerStub=function(e,t){var r="UnSetStub",n="0.0",i=function(){},a={applicationName:r,applicationVersion:n},s={platform:a,clientId:e};return new this(s,i,t)},o.prototype.startEvent=function(e){this.logger.verbose("Telemetry Event started: "+e.key),!!this.telemetryEmitter&&(e.start(),this.inProgressEvents[e.key]=e)},o.prototype.stopEvent=function(e){if(this.logger.verbose("Telemetry Event stopped: "+e.key),!(!this.telemetryEmitter||!this.inProgressEvents[e.key])){e.stop(),this.incrementEventCount(e);var t=this.completedEvents[e.telemetryCorrelationId];this.completedEvents[e.telemetryCorrelationId]=x(t||[],[e]),delete this.inProgressEvents[e.key]}},o.prototype.flush=function(e){var t=this;if(this.logger.verbose("Flushing telemetry events: "+e),!(!this.telemetryEmitter||!this.completedEvents[e])){var r=this.getOrphanedEvents(e);r.forEach(function(c){return t.incrementEventCount(c)});var n=x(this.completedEvents[e],r);delete this.completedEvents[e];var i=this.eventCountByCorrelationId[e];if(delete this.eventCountByCorrelationId[e],!(!n||!n.length)){var a=new $e(this.telemetryPlatform,e,this.clientId,i),s=x(n,[a]);this.telemetryEmitter(s.map(function(c){return c.get()}))}}},o.prototype.createAndStartApiEvent=function(e,t){var r=new Ze(e,this.logger.isPiiLoggingEnabled(),t);return this.startEvent(r),r},o.prototype.stopAndFlushApiEvent=function(e,t,r,n){t.wasSuccessful=r,n&&(t.apiErrorCode=n),this.stopEvent(t),this.flush(e)},o.prototype.createAndStartHttpEvent=function(e,t,r,n){var i=new et(e,n);return i.url=r,i.httpMethod=t,this.startEvent(i),i},o.prototype.incrementEventCount=function(e){var t,r=e.eventName,n=this.eventCountByCorrelationId[e.telemetryCorrelationId];n?n[r]=n[r]?n[r]+1:1:this.eventCountByCorrelationId[e.telemetryCorrelationId]=(t={},t[r]=1,t)},o.prototype.getOrphanedEvents=function(e){var t=this;return Object.keys(this.inProgressEvents).reduce(function(r,n){if(n.indexOf(e)!==-1){var i=t.inProgressEvents[n];return delete t.inProgressEvents[n],x(r,[i])}return r},[])},o}(),Pe=mt;var Se=function(){function o(){}return o.filterTokenCacheItemsByScope=function(e,t){return e.filter(function(r){var n=r.key.scopes.split(" "),i=N.removeDefaultScopes(t);return i.length===0?N.containsScope(n,t):N.containsScope(n,i)})},o.filterTokenCacheItemsByAuthority=function(e,t){return e.filter(function(r){return f.CanonicalizeUri(r.key.authority)===t})},o.filterTokenCacheItemsByDomain=function(e,t){return e.filter(function(r){var n=f.GetUrlComponents(r.key.authority).HostNameAndPort;return n===t})},o}();var vt="https://login.microsoftonline.com/common",Ne=function(){function o(e){this.authResponseCallback=null,this.tokenReceivedCallback=null,this.errorReceivedCallback=null,this.config=Be(e),this.logger=this.config.system.logger,this.clientId=this.config.auth.clientId,this.inCookie=this.config.cache.storeAuthStateInCookie,this.telemetryManager=this.getTelemetryManagerFromConfig(this.config.system.telemetry,this.clientId),ce.setTrustedAuthoritiesFromConfig(this.config.auth.validateAuthority,this.config.auth.knownAuthorities),z.saveMetadataFromConfig(this.config.auth.authority,this.config.auth.authorityMetadata),this.authority=this.config.auth.authority||vt,this.cacheStorage=new A(this.clientId,this.config.cache.cacheLocation,this.inCookie),window.activeRenewals||(window.activeRenewals={}),window.renewStates||(window.renewStates=[]),window.callbackMappedToRenewStates||(window.callbackMappedToRenewStates={}),window.promiseMappedToRenewStates||(window.promiseMappedToRenewStates={}),window.msal=this;var t=window.location.hash,r=f.urlContainsHash(t);if(L.checkIfBackButtonIsPressed(this.cacheStorage),r&&this.cacheStorage.isInteractionInProgress(!0)){var n=this.getResponseState(t);n.method===l.interactionTypeRedirect&&this.handleRedirectAuthenticationResponse(t)}}return Object.defineProperty(o.prototype,"authority",{get:function(){return this.authorityInstance.CanonicalAuthority},set:function(e){this.authorityInstance=z.CreateInstance(e,this.config.auth.validateAuthority)},enumerable:!1,configurable:!0}),o.prototype.getAuthorityInstance=function(){return this.authorityInstance},o.prototype.handleRedirectCallback=function(e,t){if(!e)throw _.createInvalidCallbackObjectError(e);t?(this.tokenReceivedCallback=e,this.errorReceivedCallback=t,this.logger.warning("This overload for callback is deprecated - please change the format of the callbacks to a single callback as shown: (err: AuthError, response: AuthResponse).")):this.authResponseCallback=e,this.redirectError?this.authErrorHandler(l.interactionTypeRedirect,this.redirectError,this.redirectResponse):this.redirectResponse&&this.authResponseHandler(l.interactionTypeRedirect,this.redirectResponse)},o.prototype.urlContainsHash=function(e){return this.logger.verbose("UrlContainsHash has been called"),f.urlContainsHash(e)},o.prototype.authResponseHandler=function(e,t,r){if(this.logger.verbose("AuthResponseHandler has been called"),this.cacheStorage.setInteractionInProgress(!1),e===l.interactionTypeRedirect)this.logger.verbose("Interaction type is redirect"),this.errorReceivedCallback?(this.logger.verbose("Two callbacks were provided to handleRedirectCallback, calling success callback with response"),this.tokenReceivedCallback(t)):this.authResponseCallback&&(this.logger.verbose("One callback was provided to handleRedirectCallback, calling authResponseCallback with response"),this.authResponseCallback(null,t));else if(e===l.interactionTypePopup)this.logger.verbose("Interaction type is popup, resolving"),r(t);else throw E.createInvalidInteractionTypeError()},o.prototype.authErrorHandler=function(e,t,r,n){if(this.logger.verbose("AuthErrorHandler has been called"),this.cacheStorage.setInteractionInProgress(!1),e===l.interactionTypeRedirect)if(this.logger.verbose("Interaction type is redirect"),this.errorReceivedCallback)this.logger.verbose("Two callbacks were provided to handleRedirectCallback, calling error callback"),this.errorReceivedCallback(t,r.accountState);else if(this.authResponseCallback)this.logger.verbose("One callback was provided to handleRedirectCallback, calling authResponseCallback with error"),this.authResponseCallback(t,r);else throw this.logger.verbose("handleRedirectCallback has not been called and no callbacks are registered, throwing error"),t;else if(e===l.interactionTypePopup)this.logger.verbose("Interaction type is popup, rejecting"),n(t);else throw E.createInvalidInteractionTypeError()},o.prototype.loginRedirect=function(e){this.logger.verbose("LoginRedirect has been called");var t=F.validateRequest(e,!0,this.clientId,l.interactionTypeRedirect);this.acquireTokenInteractive(l.interactionTypeRedirect,!0,t,null,null)},o.prototype.acquireTokenRedirect=function(e){this.logger.verbose("AcquireTokenRedirect has been called");var t=F.validateRequest(e,!1,this.clientId,l.interactionTypeRedirect);this.acquireTokenInteractive(l.interactionTypeRedirect,!1,t,null,null)},o.prototype.loginPopup=function(e){var t=this;this.logger.verbose("LoginPopup has been called");var r=F.validateRequest(e,!0,this.clientId,l.interactionTypePopup),n=this.telemetryManager.createAndStartApiEvent(r.correlationId,K.LoginPopup);return new Promise(function(i,a){t.acquireTokenInteractive(l.interactionTypePopup,!0,r,i,a)}).then(function(i){return t.logger.verbose("Successfully logged in"),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!0),i}).catch(function(i){throw t.cacheStorage.resetTempCacheItems(r.state),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!1,i.errorCode),i})},o.prototype.acquireTokenPopup=function(e){var t=this;this.logger.verbose("AcquireTokenPopup has been called");var r=F.validateRequest(e,!1,this.clientId,l.interactionTypePopup),n=this.telemetryManager.createAndStartApiEvent(r.correlationId,K.AcquireTokenPopup);return new Promise(function(i,a){t.acquireTokenInteractive(l.interactionTypePopup,!1,r,i,a)}).then(function(i){return t.logger.verbose("Successfully acquired token"),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!0),i}).catch(function(i){throw t.cacheStorage.resetTempCacheItems(r.state),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!1,i.errorCode),i})},o.prototype.acquireTokenInteractive=function(e,t,r,n,i){var a=this;this.logger.verbose("AcquireTokenInteractive has been called"),L.blockReloadInHiddenIframes();try{this.cacheStorage.setInteractionInProgress(!0)}catch{var s=t?E.createLoginInProgressError():E.createAcquireTokenInProgressError(),c=pe(this.getAccountState(r.state));this.cacheStorage.resetTempCacheItems(r.state),this.authErrorHandler(e,s,c,i);return}e===l.interactionTypeRedirect&&this.cacheStorage.setItem(b.REDIRECT_REQUEST,""+l.inProgress+l.resourceDelimiter+r.state);var u;if(r&&r.account&&!t?(u=r.account,this.logger.verbose("Account set from request")):(u=this.getAccount(),this.logger.verbose("Account set from MSAL Cache")),!u&&!X.isSSOParam(r))if(t){var h=this.extractADALIdToken();if(h&&!r.scopes){this.logger.info("ADAL's idToken exists. Extracting login information from ADAL's idToken");var y=this.buildIDTokenRequest(r);this.silentLogin=!0,this.acquireTokenSilent(y).then(function(T){a.silentLogin=!1,a.logger.info("Unified cache call is successful"),a.authResponseHandler(e,T,n)},function(T){a.silentLogin=!1,a.logger.error("Error occurred during unified cache ATS: "+T),a.acquireTokenHelper(null,e,t,r,n,i)})}else this.logger.verbose("Login call but no token found, proceed to login"),this.acquireTokenHelper(null,e,t,r,n,i)}else{this.logger.verbose("AcquireToken call, no context or account given"),this.logger.info("User login is required");var c=pe(this.getAccountState(r.state));this.cacheStorage.resetTempCacheItems(r.state),this.authErrorHandler(e,E.createUserLoginRequiredError(),c,i);return}else this.logger.verbose("User session exists, login not required"),this.acquireTokenHelper(u,e,t,r,n,i)},o.prototype.acquireTokenHelper=function(e,t,r,n,i,a){return G(this,void 0,void 0,function(){var s,c,u,h,y,T,w,k,U,V,j;return W(this,function(R){switch(R.label){case 0:this.logger.verbose("AcquireTokenHelper has been called"),this.logger.verbose("Interaction type: "+t+". isLoginCall: "+r),s=n.scopes?n.scopes.join(" ").toLowerCase():l.oidcScopes.join(" "),this.logger.verbosePii("Request signature: "+s),u=n&&n.authority?z.CreateInstance(n.authority,this.config.auth.validateAuthority,n.authorityMetadata):this.authorityInstance,R.label=1;case 1:return R.trys.push([1,11,,12]),u.hasCachedMetadata()?[3,3]:(this.logger.verbose("No cached metadata for authority"),[4,z.saveMetadataFromNetwork(u,this.telemetryManager,n.correlationId)]);case 2:return R.sent(),[3,4];case 3:this.logger.verbose("Cached metadata found for authority"),R.label=4;case 4:if(y=r?Q.id_token:this.getTokenType(e,n.scopes),T=n.redirectStartPage||window.location.href,c=new X(u,this.clientId,y,this.getRedirectUri(n&&n.redirectUri),n.scopes,n.state,n.correlationId),this.logger.verbose("Finished building server authentication request"),this.updateCacheEntries(c,e,r,T),this.logger.verbose("Updating cache entries"),c.populateQueryParams(e,n),this.logger.verbose("Query parameters populated from account"),w=f.createNavigateUrl(c)+l.response_mode_fragment,t===l.interactionTypeRedirect)r?this.logger.verbose("Interaction type redirect but login call is true. State not cached"):(this.cacheStorage.setItem(A.generateTemporaryCacheKey(b.STATE_ACQ_TOKEN,n.state),c.state,this.inCookie),this.logger.verbose("State cached for redirect"),this.logger.verbosePii("State cached: "+c.state));else if(t===l.interactionTypePopup)window.renewStates.push(c.state),window.requestType=r?l.login:l.renewToken,this.logger.verbose("State saved to window"),this.logger.verbosePii("State saved: "+c.state),this.registerCallback(c.state,s,i,a);else throw this.logger.verbose("Invalid interaction error. State not cached"),E.createInvalidInteractionTypeError();if(t!==l.interactionTypePopup)return[3,9];this.logger.verbose("Interaction type is popup. Generating popup window");try{h=this.openPopup(w,"msal",l.popUpWidth,l.popUpHeight),L.trackPopup(h)}catch{if(this.logger.info(d.popUpWindowError.code+":"+d.popUpWindowError.desc),this.cacheStorage.setItem(P.ERROR,d.popUpWindowError.code),this.cacheStorage.setItem(P.ERROR_DESC,d.popUpWindowError.desc),a)return a(E.createPopupWindowError()),[2]}if(!h)return[3,8];R.label=5;case 5:return R.trys.push([5,7,,8]),[4,L.monitorPopupForHash(h,this.config.system.loadFrameTimeout,w,this.logger)];case 6:return k=R.sent(),this.handleAuthenticationResponse(k),this.cacheStorage.setInteractionInProgress(!1),this.logger.info("Closing popup window"),this.config.framework.isAngular&&this.broadcast("msal:popUpHashChanged",k),L.closePopups(),[3,8];case 7:return U=R.sent(),a&&a(U),this.config.framework.isAngular?this.broadcast("msal:popUpClosed",U.errorCode+l.resourceDelimiter+U.errorMessage):(this.cacheStorage.setInteractionInProgress(!1),h.close()),[3,8];case 8:return[3,10];case 9:n.onRedirectNavigate?(this.logger.verbose("Invoking onRedirectNavigate callback"),V=n.onRedirectNavigate(w),V!==!1?(this.logger.verbose("onRedirectNavigate did not return false, navigating"),this.navigateWindow(w)):this.logger.verbose("onRedirectNavigate returned false, stopping navigation")):(this.logger.verbose("Navigating window to urlNavigate"),this.navigateWindow(w)),R.label=10;case 10:return[3,12];case 11:return j=R.sent(),this.logger.error(j),this.cacheStorage.resetTempCacheItems(n.state),this.authErrorHandler(t,E.createEndpointResolutionError(j.toString),pe(n.state),a),h&&h.close(),[3,12];case 12:return[2]}})})},o.prototype.ssoSilent=function(e){if(this.logger.verbose("ssoSilent has been called"),!e)throw _.createEmptyRequestError();if(!e.sid&&!e.loginHint)throw _.createSsoSilentError();return this.acquireTokenSilent(S(S({},e),{scopes:l.oidcScopes}))},o.prototype.acquireTokenSilent=function(e){var t=this;this.logger.verbose("AcquireTokenSilent has been called");var r=F.validateRequest(e,!1,this.clientId,l.interactionTypeSilent),n=this.telemetryManager.createAndStartApiEvent(r.correlationId,K.AcquireTokenSilent),i=F.createRequestSignature(r);return new Promise(function(a,s){return G(t,void 0,void 0,function(){var c,u,h,y,T,w,k,U,V,j,R;return W(this,function(q){switch(q.label){case 0:if(L.blockReloadInHiddenIframes(),c=r.scopes.join(" ").toLowerCase(),this.logger.verbosePii("Serialized scopes: "+c),r.account?(u=r.account,this.logger.verbose("Account set from request")):(u=this.getAccount(),this.logger.verbose("Account set from MSAL Cache")),h=this.cacheStorage.getItem(l.adalIdToken),!u&&!(r.sid||r.loginHint)&&m.isEmpty(h))return this.logger.info("User login is required"),[2,s(E.createUserLoginRequiredError())];if(y=this.getTokenType(u,r.scopes),this.logger.verbose("Response type: "+y),T=new X(z.CreateInstance(r.authority,this.config.auth.validateAuthority,r.authorityMetadata),this.clientId,y,this.getRedirectUri(r.redirectUri),r.scopes,r.state,r.correlationId),this.logger.verbose("Finished building server authentication request"),X.isSSOParam(r)||u?(T.populateQueryParams(u,r,null,!0),this.logger.verbose("Query parameters populated from existing SSO or account")):!u&&!m.isEmpty(h)?(w=ue.extractIdToken(h),this.logger.verbose("ADAL's idToken exists. Extracting login information from ADAL's idToken to populate query parameters"),T.populateQueryParams(u,null,w,!0)):this.logger.verbose("No additional query parameters added"),k=r.claimsRequest||T.claimsValue,!k&&!r.forceRefresh)try{V=this.getCachedToken(T,u)}catch(fe){U=fe}return V?(this.logger.verbose("Token found in cache lookup"),this.logger.verbosePii("Scopes found: "+JSON.stringify(V.scopes)),a(V),[2,null]):[3,1];case 1:return U?(this.logger.infoPii(U.errorCode+":"+U.errorMessage),s(U),[2,null]):[3,2];case 2:j=void 0,k?j="Skipped cache lookup since claims were given":r.forceRefresh?j="Skipped cache lookup since request.forceRefresh option was set to true":j="No valid token found in cache lookup",this.logger.verbose(j),T.authorityInstance||(T.authorityInstance=r.authority?z.CreateInstance(r.authority,this.config.auth.validateAuthority,r.authorityMetadata):this.authorityInstance),this.logger.verbosePii("Authority instance: "+T.authority),q.label=3;case 3:return q.trys.push([3,7,,8]),T.authorityInstance.hasCachedMetadata()?[3,5]:(this.logger.verbose("No cached metadata for authority"),[4,z.saveMetadataFromNetwork(T.authorityInstance,this.telemetryManager,r.correlationId)]);case 4:return q.sent(),this.logger.verbose("Authority has been updated with endpoint discovery response"),[3,6];case 5:this.logger.verbose("Cached metadata found for authority"),q.label=6;case 6:return window.activeRenewals[i]?(this.logger.verbose("Renewing token in progress. Registering callback"),this.registerCallback(window.activeRenewals[i],i,a,s)):r.scopes&&N.onlyContainsOidcScopes(r.scopes)?(this.logger.verbose("OpenID Connect scopes only, renewing idToken"),this.silentLogin=!0,this.renewIdToken(i,a,s,u,T)):(this.logger.verbose("Renewing access token"),this.renewToken(i,a,s,u,T)),[3,8];case 7:return R=q.sent(),this.logger.error(R),s(E.createEndpointResolutionError(R.toString())),[2,null];case 8:return[2]}})})}).then(function(a){return t.logger.verbose("Successfully acquired token"),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!0),a}).catch(function(a){throw t.cacheStorage.resetTempCacheItems(r.state),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!1,a.errorCode),a})},o.prototype.openPopup=function(e,t,r,n){this.logger.verbose("OpenPopup has been called");try{var i=window.screenLeft?window.screenLeft:window.screenX,a=window.screenTop?window.screenTop:window.screenY,s=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,c=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,u=s/2-r/2+i,h=c/2-n/2+a,y=window.open(e,t,"width="+r+", height="+n+", top="+h+", left="+u+", scrollbars=yes");if(!y)throw E.createPopupWindowError();return y.focus&&y.focus(),y}catch(T){throw this.cacheStorage.setInteractionInProgress(!1),E.createPopupWindowError(T.toString())}},o.prototype.loadIframeTimeout=function(e,t,r){return G(this,void 0,void 0,function(){var n,i,a,s,c;return W(this,function(u){switch(u.label){case 0:return n=window.activeRenewals[r],this.logger.verbosePii("Set loading state to pending for: "+r+":"+n),this.cacheStorage.setItem(A.generateTemporaryCacheKey(b.RENEW_STATUS,n),l.inProgress),this.config.system.navigateFrameWait?[4,L.loadFrame(e,t,this.config.system.navigateFrameWait,this.logger)]:[3,2];case 1:return a=u.sent(),[3,3];case 2:a=L.loadFrameSync(e,t,this.logger),u.label=3;case 3:i=a,u.label=4;case 4:return u.trys.push([4,6,,7]),[4,L.monitorIframeForHash(i.contentWindow,this.config.system.loadFrameTimeout,e,this.logger)];case 5:return s=u.sent(),s&&this.handleAuthenticationResponse(s),[3,7];case 6:throw c=u.sent(),this.cacheStorage.getItem(A.generateTemporaryCacheKey(b.RENEW_STATUS,n))===l.inProgress&&(this.logger.verbose("Loading frame has timed out after: "+this.config.system.loadFrameTimeout/1e3+" seconds for scope/authority "+r+":"+n),n&&window.callbackMappedToRenewStates[n]&&window.callbackMappedToRenewStates[n](null,c),this.cacheStorage.removeItem(A.generateTemporaryCacheKey(b.RENEW_STATUS,n))),L.removeHiddenIframe(i),c;case 7:return L.removeHiddenIframe(i),[2]}})})},o.prototype.navigateWindow=function(e,t){if(e&&!m.isEmpty(e)){var r=t||window,n=t?"Navigated Popup window to:"+e:"Navigate to:"+e;this.logger.infoPii(n),r.location.assign(e)}else throw this.logger.info("Navigate url is empty"),D.createUnexpectedError("Navigate url is empty")},o.prototype.registerCallback=function(e,t,r,n){var i=this;window.activeRenewals[t]=e,window.promiseMappedToRenewStates[e]||(window.promiseMappedToRenewStates[e]=[]),window.promiseMappedToRenewStates[e].push({resolve:r,reject:n}),window.callbackMappedToRenewStates[e]||(window.callbackMappedToRenewStates[e]=function(a,s){delete window.activeRenewals[t];for(var c=0;c<window.promiseMappedToRenewStates[e].length;++c)try{if(s)window.promiseMappedToRenewStates[e][c].reject(s);else if(a)window.promiseMappedToRenewStates[e][c].resolve(a);else throw i.cacheStorage.resetTempCacheItems(e),D.createUnexpectedError("Error and response are both null")}catch(u){i.logger.warning(u)}delete window.promiseMappedToRenewStates[e],delete window.callbackMappedToRenewStates[e]})},o.prototype.logout=function(e){this.logger.verbose("Logout has been called"),this.logoutAsync(e)},o.prototype.logoutAsync=function(e){return G(this,void 0,void 0,function(){var t,r,n,i,a,s;return W(this,function(c){switch(c.label){case 0:t=e||I.createNewGuid(),r=this.telemetryManager.createAndStartApiEvent(t,K.Logout),this.clearCache(),this.account=null,c.label=1;case 1:return c.trys.push([1,5,,6]),this.authorityInstance.hasCachedMetadata()?[3,3]:(this.logger.verbose("No cached metadata for authority"),[4,z.saveMetadataFromNetwork(this.authorityInstance,this.telemetryManager,e)]);case 2:return c.sent(),[3,4];case 3:this.logger.verbose("Cached metadata found for authority"),c.label=4;case 4:return n="client-request-id="+t,i=void 0,this.getPostLogoutRedirectUri()?(i="&post_logout_redirect_uri="+encodeURIComponent(this.getPostLogoutRedirectUri()),this.logger.verbose("redirectUri found and set")):(i="",this.logger.verbose("No redirectUri set for app. postLogoutQueryParam is empty")),a=void 0,this.authorityInstance.EndSessionEndpoint?(a=this.authorityInstance.EndSessionEndpoint+"?"+n+i,this.logger.verbose("EndSessionEndpoint found and urlNavigate set"),this.logger.verbosePii("urlNavigate set to: "+this.authorityInstance.EndSessionEndpoint)):(a=this.authority+"oauth2/v2.0/logout?"+n+i,this.logger.verbose("No endpoint, urlNavigate set to default")),this.telemetryManager.stopAndFlushApiEvent(t,r,!0),this.logger.verbose("Navigating window to urlNavigate"),this.navigateWindow(a),[3,6];case 5:return s=c.sent(),this.telemetryManager.stopAndFlushApiEvent(t,r,!1,s.errorCode),[3,6];case 6:return[2]}})})},o.prototype.clearCache=function(){this.logger.verbose("Clearing cache"),window.renewStates=[];for(var e=this.cacheStorage.getAllTokens(l.clientId,l.homeAccountIdentifier),t=0;t<e.length;t++)this.cacheStorage.removeItem(JSON.stringify(e[t].key));this.cacheStorage.resetCacheItems(),this.cacheStorage.clearMsalCookie(),this.logger.verbose("Cache cleared")},o.prototype.clearCacheForScope=function(e){this.logger.verbose("Clearing access token from cache");for(var t=this.cacheStorage.getAllAccessTokens(l.clientId,l.homeAccountIdentifier),r=0;r<t.length;r++){var n=t[r];n.value.accessToken===e&&(this.cacheStorage.removeItem(JSON.stringify(n.key)),this.logger.verbosePii("Access token removed: "+n.key))}},o.prototype.isCallback=function(e){return this.logger.info("isCallback will be deprecated in favor of urlContainsHash in MSAL.js v2.0."),this.logger.verbose("isCallback has been called"),f.urlContainsHash(e)},o.prototype.processCallBack=function(e,t,r){this.logger.info("ProcessCallBack has been called. Processing callback from redirect response");var n=t;n||(this.logger.verbose("StateInfo is null, getting stateInfo from hash"),n=this.getResponseState(e));var i,a;try{i=this.saveTokenFromHash(e,n)}catch(c){a=c}try{this.cacheStorage.clearMsalCookie(n.state);var s=this.getAccountState(n.state);if(i){if(n.requestType===l.renewToken||i.accessToken?(window.parent!==window?this.logger.verbose("Window is in iframe, acquiring token silently"):this.logger.verbose("Acquiring token interactive in progress"),this.logger.verbose("Response tokenType set to "+p.ACCESS_TOKEN),i.tokenType=p.ACCESS_TOKEN):n.requestType===l.login&&(this.logger.verbose("Response tokenType set to "+p.ID_TOKEN),i.tokenType=p.ID_TOKEN),!r){this.logger.verbose("Setting redirectResponse"),this.redirectResponse=i;return}}else if(!r){this.logger.verbose("Response is null, setting redirectResponse with state"),this.redirectResponse=pe(s),this.redirectError=a,this.cacheStorage.resetTempCacheItems(n.state);return}this.logger.verbose("Calling callback provided to processCallback"),r(i,a)}catch(c){throw this.logger.error("Error occurred in token received callback function: "+c),E.createErrorInCallbackFunction(c.toString())}},o.prototype.handleAuthenticationResponse=function(e){this.logger.verbose("HandleAuthenticationResponse has been called");var t=e||window.location.hash,r=this.getResponseState(t);this.logger.verbose("Obtained state from response");var n=window.callbackMappedToRenewStates[r.state];this.processCallBack(t,r,n)},o.prototype.handleRedirectAuthenticationResponse=function(e){this.logger.info("Returned from redirect url"),this.logger.verbose("HandleRedirectAuthenticationResponse has been called"),L.clearUrlFragment(window),this.logger.verbose("Window.location.hash cleared");var t=this.getResponseState(e);if(this.config.auth.navigateToLoginRequestUrl&&window.parent===window){this.logger.verbose("Window.parent is equal to window, not in popup or iframe. Navigation to login request url after login turned on");var r=this.cacheStorage.getItem(A.generateTemporaryCacheKey(b.LOGIN_REQUEST,t.state),this.inCookie);if(!r||r==="null"){this.logger.error("Unable to get valid login request url from cache, redirecting to home page"),window.location.assign("/");return}else{this.logger.verbose("Valid login request url obtained from cache");var n=f.removeHashFromUrl(window.location.href),i=f.removeHashFromUrl(r);if(n!==i){this.logger.verbose("Current url is not login request url, navigating"),this.logger.verbosePii("CurrentUrl: "+n+", finalRedirectUrl: "+i),window.location.assign(""+i+e);return}else{this.logger.verbose("Current url matches login request url");var a=f.GetUrlComponents(r);a.Hash&&(this.logger.verbose("Login request url contains hash, resetting non-msal hash"),window.location.hash=a.Hash)}}}else this.config.auth.navigateToLoginRequestUrl||this.logger.verbose("Default navigation to start page after login turned off");this.processCallBack(e,t,null)},o.prototype.getResponseState=function(e){this.logger.verbose("GetResponseState has been called");var t=f.deserializeHash(e),r;if(!t)throw D.createUnexpectedError("Hash was not parsed correctly.");if(t.hasOwnProperty(p.STATE)){this.logger.verbose("Hash contains state. Creating stateInfo object");var n=F.parseLibraryState(t.state);r={requestType:l.unknown,state:t.state,timestamp:n.ts,method:n.method,stateMatch:!1}}else throw D.createUnexpectedError("Hash does not contain state.");if(r.state===this.cacheStorage.getItem(A.generateTemporaryCacheKey(b.STATE_LOGIN,r.state),this.inCookie)||r.state===this.silentAuthenticationState)return this.logger.verbose("State matches cached state, setting requestType to login"),r.requestType=l.login,r.stateMatch=!0,r;if(r.state===this.cacheStorage.getItem(A.generateTemporaryCacheKey(b.STATE_ACQ_TOKEN,r.state),this.inCookie))return this.logger.verbose("State matches cached state, setting requestType to renewToken"),r.requestType=l.renewToken,r.stateMatch=!0,r;if(!r.stateMatch){this.logger.verbose("State does not match cached state, setting requestType to type from window"),r.requestType=window.requestType;for(var i=window.renewStates,a=0;a<i.length;a++)if(i[a]===r.state){this.logger.verbose("Matching state found for request"),r.stateMatch=!0;break}r.stateMatch||this.logger.verbose("Matching state not found for request")}return r},o.prototype.getCachedToken=function(e,t){this.logger.verbose("GetCachedToken has been called");var r=e.scopes,n=this.getCachedIdToken(e,t),i=this.getCachedAccessToken(e,t,r),a=this.getAccountState(e.state);return Ee.buildAuthResponse(n,i,e,t,r,a)},o.prototype.getTokenCacheItemByAuthority=function(e,t,r,n){var i=this,a;return f.isCommonAuthority(e)||f.isOrganizationsAuthority(e)||f.isConsumersAuthority(e)?a=Se.filterTokenCacheItemsByDomain(t,f.GetUrlComponents(e).HostNameAndPort):a=Se.filterTokenCacheItemsByAuthority(t,e),a.length===1?a[0]:a.length>1?(this.logger.warning("Multiple matching tokens found. Cleaning cache and requesting a new token."),a.forEach(function(s){i.cacheStorage.removeItem(JSON.stringify(s.key))}),null):(this.logger.verbose("No matching tokens of type "+n+" found"),null)},o.prototype.getCachedIdToken=function(e,t){this.logger.verbose("Getting all cached tokens of type ID Token");var r=this.cacheStorage.getAllIdTokens(this.clientId,t?t.homeAccountIdentifier:null),n=e.authority||this.authority,i=this.getTokenCacheItemByAuthority(n,r,null,p.ID_TOKEN);if(i){this.logger.verbose("Evaluating ID token found");var a=this.evaluateTokenExpiration(i);if(a){this.logger.verbose("ID token expiration is within offset, using ID token found in cache");var s=i.value;return s?this.logger.verbose("ID Token found in cache is valid and unexpired"):this.logger.verbose("ID Token found in cache is invalid"),s?new $(s.idToken):null}else return this.logger.verbose("Cached ID token is expired, removing from cache"),this.cacheStorage.removeItem(JSON.stringify(i.key)),null}else return this.logger.verbose("No tokens found"),null},o.prototype.getCachedAccessToken=function(e,t,r){this.logger.verbose("Getting all cached tokens of type Access Token");var n=this.cacheStorage.getAllAccessTokens(this.clientId,t?t.homeAccountIdentifier:null),i=Se.filterTokenCacheItemsByScope(n,r),a=e.authority||this.authority,s=this.getTokenCacheItemByAuthority(a,i,r,p.ACCESS_TOKEN);if(s){e.authorityInstance=z.CreateInstance(s.key.authority,this.config.auth.validateAuthority),this.logger.verbose("Evaluating access token found");var c=this.evaluateTokenExpiration(s);if(c){this.logger.verbose("Access token expiration is within offset, using access token found in cache");var u=t||this.getAccount();if(!u)throw D.createUnexpectedError("Account should not be null here.");var h=this.getAccountState(e.state),y={uniqueId:"",tenantId:"",tokenType:p.ACCESS_TOKEN,idToken:null,idTokenClaims:null,accessToken:s.value.accessToken,scopes:s.key.scopes.split(" "),expiresOn:new Date(Number(s.value.expiresIn)*1e3),account:u,accountState:h,fromCache:!0};return y}else return this.logger.verbose("Access token expired, removing from cache"),this.cacheStorage.removeItem(JSON.stringify(s.key)),null}else return this.logger.verbose("No matching token found when filtering by scope and authority"),null},o.prototype.evaluateTokenExpiration=function(e){var t=Number(e.value.expiresIn);return ue.validateExpirationIsWithinOffset(t,this.config.system.tokenRenewalOffsetSeconds)},o.prototype.extractADALIdToken=function(){this.logger.verbose("ExtractADALIdToken has been called");var e=this.cacheStorage.getItem(l.adalIdToken);return m.isEmpty(e)?null:ue.extractIdToken(e)},o.prototype.renewToken=function(e,t,r,n,i){this.logger.verbose("RenewToken has been called"),this.logger.verbosePii("RenewToken scope and authority: "+e);var a=L.generateFrameName(Ae.TOKEN_FRAME,e);L.addHiddenIFrame(a,this.logger),this.updateCacheEntries(i,n,!1),this.logger.verbosePii("RenewToken expected state: "+i.state);var s=f.urlRemoveQueryStringParameter(f.createNavigateUrl(i),l.prompt)+l.prompt_none+l.response_mode_fragment;window.renewStates.push(i.state),window.requestType=l.renewToken,this.logger.verbose("Set window.renewState and requestType"),this.registerCallback(i.state,e,t,r),this.logger.infoPii("Navigate to: "+s),this.loadIframeTimeout(s,a,e).catch(function(c){return r(c)})},o.prototype.renewIdToken=function(e,t,r,n,i){this.logger.info("RenewIdToken has been called");var a=L.generateFrameName(Ae.ID_TOKEN_FRAME,e);L.addHiddenIFrame(a,this.logger),this.updateCacheEntries(i,n,!1),this.logger.verbose("RenewIdToken expected state: "+i.state);var s=f.urlRemoveQueryStringParameter(f.createNavigateUrl(i),l.prompt)+l.prompt_none+l.response_mode_fragment;this.silentLogin?(this.logger.verbose("Silent login is true, set silentAuthenticationState"),window.requestType=l.login,this.silentAuthenticationState=i.state):(this.logger.verbose("Not silent login, set window.renewState and requestType"),window.requestType=l.renewToken,window.renewStates.push(i.state)),this.registerCallback(i.state,e,t,r),this.logger.infoPii('Navigate to:" '+s),this.loadIframeTimeout(s,a,e).catch(function(c){return r(c)})},o.prototype.saveToken=function(e,t,r,n,i){var a=new je(t,this.clientId,r,n.uid,n.utid),s=new qe(e.accessToken,e.idToken.rawIdToken,i.toString(),n.encodeClientInfo());return this.cacheStorage.setItem(JSON.stringify(a),JSON.stringify(s)),i?(this.logger.verbose("New expiration set for token"),e.expiresOn=new Date(i*1e3)):this.logger.error("Could not parse expiresIn parameter for access token"),e},o.prototype.saveIdToken=function(e,t,r,n,i){this.logger.verbose("SaveIdToken has been called");var a=S({},e),s;a.scopes=l.oidcScopes,a.accessToken=r[p.ID_TOKEN];var c=Number(i.expiration);return this.logger.verbose("Saving ID token to cache"),this.saveToken(a,t,s,n,c)},o.prototype.saveAccessToken=function(e,t,r,n){this.logger.verbose("SaveAccessToken has been called");var i=S({},e),a=r[p.SCOPE],s=a.split(" "),c=this.cacheStorage.getAllAccessTokens(this.clientId,t);this.logger.verbose("Retrieving all access tokens from cache and removing duplicates");for(var u=0;u<c.length;u++){var h=c[u];if(h.key.homeAccountIdentifier===e.account.homeAccountIdentifier){var y=h.key.scopes.split(" ");N.isIntersectingScopes(y,s)&&this.cacheStorage.removeItem(JSON.stringify(h.key))}}i.accessToken=r[p.ACCESS_TOKEN],i.scopes=s;var T=Y.parseExpiresIn(r[p.EXPIRES_IN]),w=F.parseLibraryState(r[p.STATE]),k=w.ts+T;return this.logger.verbose("Saving access token to cache"),this.saveToken(i,t,a,n,k)},o.prototype.saveTokenFromHash=function(e,t){this.logger.verbose("SaveTokenFromHash has been called"),this.logger.info("State status: "+t.stateMatch+"; Request type: "+t.requestType);var r={uniqueId:"",tenantId:"",tokenType:"",idToken:null,idTokenClaims:null,accessToken:null,scopes:[],expiresOn:null,account:null,accountState:"",fromCache:!1},n,i=f.deserializeHash(e),a="",s="",c=null;if(i.hasOwnProperty(p.ERROR_DESCRIPTION)||i.hasOwnProperty(p.ERROR)){if(this.logger.verbose("Server returned an error"),this.logger.infoPii("Error : "+i[p.ERROR]+"; Error description: "+i[p.ERROR_DESCRIPTION]),this.cacheStorage.setItem(P.ERROR,i[p.ERROR]),this.cacheStorage.setItem(P.ERROR_DESC,i[p.ERROR_DESCRIPTION]),t.requestType===l.login&&(this.logger.verbose("RequestType is login, caching login error, generating authorityKey"),this.cacheStorage.setItem(P.LOGIN_ERROR,i[p.ERROR_DESCRIPTION]+":"+i[p.ERROR]),a=A.generateAuthorityKey(t.state)),t.requestType===l.renewToken){this.logger.verbose("RequestType is renewToken, generating acquireTokenAccountKey"),a=A.generateAuthorityKey(t.state);var u=this.getAccount(),h=void 0;u&&!m.isEmpty(u.homeAccountIdentifier)?(h=u.homeAccountIdentifier,this.logger.verbose("AccountId is set")):(h=l.no_account,this.logger.verbose("AccountId is set as no_account")),s=A.generateAcquireTokenAccountKey(h,t.state)}var y=i[p.ERROR],T=i[p.ERROR_DESCRIPTION];be.isInteractionRequiredError(y)||be.isInteractionRequiredError(T)?n=new be(i[p.ERROR],i[p.ERROR_DESCRIPTION]):n=new Te(i[p.ERROR],i[p.ERROR_DESCRIPTION])}else if(this.logger.verbose("Server returns success"),t.stateMatch){this.logger.info("State is right"),i.hasOwnProperty(p.SESSION_STATE)&&(this.logger.verbose("Fragment has session state, caching"),this.cacheStorage.setItem(A.generateTemporaryCacheKey(b.SESSION_STATE,t.state),i[p.SESSION_STATE])),r.accountState=this.getAccountState(t.state);var w=void 0;if(i.hasOwnProperty(p.ACCESS_TOKEN)){this.logger.info("Fragment has access token"),r.accessToken=i[p.ACCESS_TOKEN],i.hasOwnProperty(p.SCOPE)&&(r.scopes=i[p.SCOPE].split(" ")),i.hasOwnProperty(p.ID_TOKEN)?(this.logger.verbose("Fragment has id_token"),c=new $(i[p.ID_TOKEN])):(this.logger.verbose("No idToken on fragment, getting idToken from cache"),c=new $(this.cacheStorage.getItem(H.IDTOKEN))),r=Ee.setResponseIdToken(r,c);var k=this.populateAuthority(t.state,this.inCookie,this.cacheStorage,c);this.logger.verbose("Got authority from cache"),i.hasOwnProperty(p.CLIENT_INFO)?(this.logger.verbose("Fragment has clientInfo"),w=new ie(i[p.CLIENT_INFO],k)):this.authorityInstance.AuthorityType===ee.Adfs?w=ie.createClientInfoFromIdToken(c,k):this.logger.warning("ClientInfo not received in the response from AAD"),r.account=ae.createAccount(c,w),this.logger.verbose("Account object created from response");var U=void 0;r.account&&!m.isEmpty(r.account.homeAccountIdentifier)?(this.logger.verbose("AccountKey set"),U=r.account.homeAccountIdentifier):(this.logger.verbose("AccountKey set as no_account"),U=l.no_account),s=A.generateAcquireTokenAccountKey(U,t.state);var V=A.generateAcquireTokenAccountKey(l.no_account,t.state);this.logger.verbose("AcquireTokenAccountKey generated");var j=this.cacheStorage.getItem(s),R=void 0;m.isEmpty(j)?m.isEmpty(this.cacheStorage.getItem(V))||(this.logger.verbose("No acquireToken account retrieved from cache"),r=this.saveAccessToken(r,k,i,w)):(R=JSON.parse(j),this.logger.verbose("AcquireToken request account retrieved from cache"),r.account&&R&&ae.compareAccounts(r.account,R)?(r=this.saveAccessToken(r,k,i,w),this.logger.info("The user object received in the response is the same as the one passed in the acquireToken request")):this.logger.warning("The account object created from the response is not the same as the one passed in the acquireToken request"))}if(i.hasOwnProperty(p.ID_TOKEN)){this.logger.info("Fragment has idToken"),c=new $(i[p.ID_TOKEN]);var k=this.populateAuthority(t.state,this.inCookie,this.cacheStorage,c);if(r=Ee.setResponseIdToken(r,c),i.hasOwnProperty(p.CLIENT_INFO)?(this.logger.verbose("Fragment has clientInfo"),w=new ie(i[p.CLIENT_INFO],k)):this.authorityInstance.AuthorityType===ee.Adfs?w=ie.createClientInfoFromIdToken(c,k):this.logger.warning("ClientInfo not received in the response from AAD"),this.account=ae.createAccount(c,w),r.account=this.account,this.logger.verbose("Account object created from response"),c&&c.nonce){this.logger.verbose("IdToken has nonce");var q=this.cacheStorage.getItem(A.generateTemporaryCacheKey(b.NONCE_IDTOKEN,t.state),this.inCookie);c.nonce!==q?(this.account=null,this.cacheStorage.setItem(P.LOGIN_ERROR,"Nonce Mismatch. Expected Nonce: "+q+",Actual Nonce: "+c.nonce),this.logger.error("Nonce Mismatch. Expected Nonce: "+q+", Actual Nonce: "+c.nonce),n=E.createNonceMismatchError(q,c.nonce)):(this.logger.verbose("Nonce matches, saving idToken to cache"),this.cacheStorage.setItem(H.IDTOKEN,i[p.ID_TOKEN],this.inCookie),this.cacheStorage.setItem(H.CLIENT_INFO,w.encodeClientInfo(),this.inCookie),this.saveIdToken(r,k,i,w,c))}else this.logger.verbose("No idToken or no nonce. Cache key for Authority set as state"),a=t.state,s=t.state,this.logger.error("Invalid id_token received in the response"),n=E.createInvalidIdTokenError(c),this.cacheStorage.setItem(P.ERROR,n.errorCode),this.cacheStorage.setItem(P.ERROR_DESC,n.errorMessage)}}else{this.logger.verbose("State mismatch"),a=t.state,s=t.state;var fe=this.cacheStorage.getItem(A.generateTemporaryCacheKey(b.STATE_LOGIN,t.state),this.inCookie);this.logger.error("State Mismatch. Expected State: "+fe+", Actual State: "+t.state),n=E.createInvalidStateError(t.state,fe),this.cacheStorage.setItem(P.ERROR,n.errorCode),this.cacheStorage.setItem(P.ERROR_DESC,n.errorMessage)}if(this.cacheStorage.removeItem(A.generateTemporaryCacheKey(b.RENEW_STATUS,t.state)),this.cacheStorage.resetTempCacheItems(t.state),this.logger.verbose("Status set to complete, temporary cache cleared"),this.inCookie&&(this.logger.verbose("InCookie is true, setting authorityKey in cookie"),this.cacheStorage.setItemCookie(a,"",-1),this.cacheStorage.clearMsalCookie(t.state)),n)throw n;if(!r)throw D.createUnexpectedError("Response is null");return r},o.prototype.populateAuthority=function(e,t,r,n){this.logger.verbose("PopulateAuthority has been called");var i=A.generateAuthorityKey(e),a=r.getItem(i,t);return m.isEmpty(a)?a:f.replaceTenantPath(a,n.tenantId)},o.prototype.getAccount=function(){if(this.account)return this.account;var e=this.cacheStorage.getItem(H.IDTOKEN,this.inCookie),t=this.cacheStorage.getItem(H.CLIENT_INFO,this.inCookie);if(!m.isEmpty(e)&&!m.isEmpty(t)){var r=new $(e),n=new ie(t,"");return this.account=ae.createAccount(r,n),this.account}return null},o.prototype.getAccountState=function(e){if(e){var t=e.indexOf(l.resourceDelimiter);if(t>-1&&t+1<e.length)return e.substring(t+1)}return e},o.prototype.getAllAccounts=function(){for(var e=[],t=this.cacheStorage.getAllAccessTokens(l.clientId,l.homeAccountIdentifier),r=0;r<t.length;r++){var n=new $(t[r].value.idToken),i=new ie(t[r].value.homeAccountIdentifier,""),a=ae.createAccount(n,i);e.push(a)}return this.getUniqueAccounts(e)},o.prototype.getUniqueAccounts=function(e){if(!e||e.length<=1)return e;for(var t=[],r=[],n=0;n<e.length;++n)e[n].homeAccountIdentifier&&t.indexOf(e[n].homeAccountIdentifier)===-1&&(t.push(e[n].homeAccountIdentifier),r.push(e[n]));return r},o.prototype.broadcast=function(e,t){var r=new CustomEvent(e,{detail:t});window.dispatchEvent(r)},o.prototype.getCachedTokenInternal=function(e,t,r,n){var i=t||this.getAccount();if(!i)return null;var a=this.authorityInstance?this.authorityInstance:z.CreateInstance(this.authority,this.config.auth.validateAuthority),s=this.getTokenType(i,e),c=new X(a,this.clientId,s,this.getRedirectUri(),e,r,n);return this.getCachedToken(c,t)},o.prototype.getScopesForEndpoint=function(e){if(this.config.framework.unprotectedResources.length>0){for(var t=0;t<this.config.framework.unprotectedResources.length;t++)if(e.indexOf(this.config.framework.unprotectedResources[t])>-1)return null}if(this.config.framework.protectedResourceMap.size>0)for(var r=0,n=Array.from(this.config.framework.protectedResourceMap.keys());r<n.length;r++){var i=n[r];if(e.indexOf(i)>-1)return this.config.framework.protectedResourceMap.get(i)}if(e.indexOf("http://")>-1||e.indexOf("https://")>-1){if(f.getHostFromUri(e)===f.getHostFromUri(this.getRedirectUri()))return new Array(this.clientId)}else return new Array(this.clientId);return null},o.prototype.getLoginInProgress=function(){return this.cacheStorage.isInteractionInProgress(!0)},o.prototype.setInteractionInProgress=function(e){this.cacheStorage.setInteractionInProgress(e)},o.prototype.setloginInProgress=function(e){this.setInteractionInProgress(e)},o.prototype.getAcquireTokenInProgress=function(){return this.cacheStorage.isInteractionInProgress(!0)},o.prototype.setAcquireTokenInProgress=function(e){this.setInteractionInProgress(e)},o.prototype.getLogger=function(){return this.logger},o.prototype.setLogger=function(e){this.logger=e},o.prototype.getRedirectUri=function(e){return e||(typeof this.config.auth.redirectUri=="function"?this.config.auth.redirectUri():this.config.auth.redirectUri)},o.prototype.getPostLogoutRedirectUri=function(){return typeof this.config.auth.postLogoutRedirectUri=="function"?this.config.auth.postLogoutRedirectUri():this.config.auth.postLogoutRedirectUri},o.prototype.getCurrentConfiguration=function(){if(!this.config)throw _.createNoSetConfigurationError();return this.config},o.prototype.getTokenType=function(e,t){var r=ae.compareAccounts(e,this.getAccount());return X.determineResponseType(r,t)},o.prototype.setAccountCache=function(e,t){var r=e?this.getAccountId(e):l.no_account,n=A.generateAcquireTokenAccountKey(r,t);this.cacheStorage.setItem(n,JSON.stringify(e))},o.prototype.setAuthorityCache=function(e,t){var r=A.generateAuthorityKey(e);this.cacheStorage.setItem(r,f.CanonicalizeUri(t),this.inCookie)},o.prototype.updateCacheEntries=function(e,t,r,n){n&&this.cacheStorage.setItem(A.generateTemporaryCacheKey(b.LOGIN_REQUEST,e.state),n,this.inCookie),r?this.cacheStorage.setItem(A.generateTemporaryCacheKey(b.STATE_LOGIN,e.state),e.state,this.inCookie):this.setAccountCache(t,e.state),this.setAuthorityCache(e.state,e.authority),this.cacheStorage.setItem(A.generateTemporaryCacheKey(b.NONCE_IDTOKEN,e.state),e.nonce,this.inCookie)},o.prototype.getAccountId=function(e){var t;return m.isEmpty(e.homeAccountIdentifier)?t=l.no_account:t=e.homeAccountIdentifier,t},o.prototype.buildIDTokenRequest=function(e){var t={scopes:l.oidcScopes,authority:this.authority,account:this.getAccount(),extraQueryParameters:e.extraQueryParameters,correlationId:e.correlationId};return t},o.prototype.getTelemetryManagerFromConfig=function(e,t){if(!e)return Pe.getTelemetrymanagerStub(t,this.logger);var r=e.applicationName,n=e.applicationVersion,i=e.telemetryEmitter;if(!r||!n||!i)throw _.createTelemetryConfigError(e);var a={applicationName:r,applicationVersion:n},s={platform:a,clientId:t};return new Pe(s,i,this.logger)},o}();function tt(o,e){return o.getAccount()?o.acquireTokenSilent(e).then(t=>t.accessToken).catch(t=>t.name==="InteractionRequiredAuthError"?o.acquireTokenPopup(e).then(r=>r.accessToken).catch(r=>Promise.reject(r&&r.message)):(console.error(t),Promise.reject("Could not fetch token"))):Promise.reject("Not logged in")}function Qn(o){let y=o,{redirectUri:e=`${location.origin}/auth`,restrict:t=!1,scopes:r=["User.Read"],storeAuthStateInCookie:n,cacheLocation:i="sessionStorage",framework:a,system:s}=y,c=He(y,["redirectUri","restrict","scopes","storeAuthStateInCookie","cacheLocation","framework","system"]),u=new Ne({auth:Me({redirectUri:e},c),cache:{storeAuthStateInCookie:n,cacheLocation:i},system:s,framework:a}),h={scopes:r};return u.handleRedirectCallback(()=>{}),{login(){u.loginRedirect(h)},logout(){u.logout()},account(){return u.getAccount()},extendHeaders(T){t||T.setHeaders(tt(u,h).then(w=>w&&{Authorization:`Bearer ${w}`},()=>{}))},token(){return tt(u,h)}}}})();
|
package/src/create.test.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import create from 'zustand';
|
|
2
|
+
import { createListener } from 'piral-base';
|
|
2
3
|
import { createAdalApi } from './create';
|
|
3
|
-
import { createListener } from 'piral-core';
|
|
4
4
|
|
|
5
5
|
function createMockContainer() {
|
|
6
|
-
const state =
|
|
6
|
+
const state = create(() => ({}));
|
|
7
7
|
const events = createListener(state);
|
|
8
8
|
return {
|
|
9
9
|
context: {
|
|
@@ -11,7 +11,7 @@ function createMockContainer() {
|
|
|
11
11
|
defineActions() {},
|
|
12
12
|
state,
|
|
13
13
|
dispatch(update) {
|
|
14
|
-
|
|
14
|
+
state.setState(update(state.getState()));
|
|
15
15
|
},
|
|
16
16
|
} as any,
|
|
17
17
|
api: {} as any,
|
package/src/create.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PiralPlugin } from 'piral-core';
|
|
2
2
|
import { AdalClient } from './setup';
|
|
3
|
-
import {
|
|
3
|
+
import { PiletAdalApi } from './types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Creates new Pilet API extensions for the integration of MSAL.
|
|
7
7
|
*/
|
|
8
|
-
export function createAdalApi(client: AdalClient): PiralPlugin<
|
|
8
|
+
export function createAdalApi(client: AdalClient): PiralPlugin<PiletAdalApi> {
|
|
9
9
|
return (context) => {
|
|
10
10
|
context.on('before-fetch', client.extendHeaders);
|
|
11
11
|
|
package/src/setup.ts
CHANGED
|
@@ -69,6 +69,26 @@ export interface AdalConfig {
|
|
|
69
69
|
* For more details see the MSAL.js documentation.
|
|
70
70
|
*/
|
|
71
71
|
framework?: any;
|
|
72
|
+
/**
|
|
73
|
+
* Determines whether or not the authority should be validated.
|
|
74
|
+
*/
|
|
75
|
+
validateAuthority?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Additional metadata to hand over.
|
|
78
|
+
*/
|
|
79
|
+
authorityMetadata?: string;
|
|
80
|
+
/**
|
|
81
|
+
* A list of known authorities to respect.
|
|
82
|
+
*/
|
|
83
|
+
knownAuthorities?: Array<string>;
|
|
84
|
+
/**
|
|
85
|
+
* Optionally decides where to redirect to in the logout case.
|
|
86
|
+
*/
|
|
87
|
+
postLogoutRedirectUri?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Determines if the URL for the login request should be navigated to.
|
|
90
|
+
*/
|
|
91
|
+
navigateToLoginRequestUrl?: boolean;
|
|
72
92
|
}
|
|
73
93
|
|
|
74
94
|
export interface AdalRequest {
|
|
@@ -108,8 +128,6 @@ export interface AdalClient {
|
|
|
108
128
|
*/
|
|
109
129
|
export function setupAdalClient(config: AdalConfig): AdalClient {
|
|
110
130
|
const {
|
|
111
|
-
clientId,
|
|
112
|
-
authority,
|
|
113
131
|
redirectUri = `${location.origin}/auth`,
|
|
114
132
|
restrict = false,
|
|
115
133
|
scopes = ['User.Read'],
|
|
@@ -117,12 +135,12 @@ export function setupAdalClient(config: AdalConfig): AdalClient {
|
|
|
117
135
|
cacheLocation = 'sessionStorage',
|
|
118
136
|
framework,
|
|
119
137
|
system,
|
|
138
|
+
...remainingOptions
|
|
120
139
|
} = config;
|
|
121
140
|
const msalInstance = new UserAgentApplication({
|
|
122
141
|
auth: {
|
|
123
|
-
clientId,
|
|
124
142
|
redirectUri,
|
|
125
|
-
|
|
143
|
+
...remainingOptions,
|
|
126
144
|
},
|
|
127
145
|
cache: {
|
|
128
146
|
storeAuthStateInCookie,
|
package/src/types.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare module 'piral-core/lib/types/custom' {
|
|
2
|
-
interface PiletCustomApi extends
|
|
2
|
+
interface PiletCustomApi extends PiletAdalApi {}
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface PiletAdalApi {
|
|
6
6
|
/**
|
|
7
7
|
* Gets the currently valid access token, if any.
|
|
8
8
|
*/
|