@azure/msal-react 1.5.6 → 1.5.7

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 CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) Microsoft Corporation. All rights reserved.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
package/README.md CHANGED
@@ -1,144 +1,144 @@
1
- # Microsoft Authentication Library for React (msal-react)
2
-
3
- [![npm version](https://img.shields.io/npm/v/@azure/msal-react.svg?style=flat)](https://www.npmjs.com/package/@azure/msal-react/)
4
- [![npm version](https://img.shields.io/npm/dm/@azure/msal-react.svg)](https://nodei.co/npm/@azure/msal-react/)
5
- [![codecov](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js/branch/dev/graph/badge.svg?flag=msal-react)](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js)
6
-
7
- | <a href="https://docs.microsoft.com/azure/active-directory/develop/tutorial-v2-react" target="blank">Getting Started</a> | <a href="https://aka.ms/aaddevv2" target="_blank">AAD Docs</a> | <a href="https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_react.html" target="_blank">Library Reference</a> | <a href="https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples" target="blank">Samples</a>
8
- |--- | --- | --- | --- |
9
-
10
- 1. [About](#about)
11
- 1. [FAQ](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/FAQ.md)
12
- 1. [Changelog](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/CHANGELOG.md)
13
- 1. [Prerequisites](#prerequisites)
14
- 1. [Installation](#installation)
15
- 1. [Build and Test](#build-and-test)
16
- 1. [Usage](#usage)
17
- - [Getting Started](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/getting-started.md)
18
- - [Msal Basics](#msal-basics)
19
- - [Advanced Topics](#advanced-topics)
20
- - [MSAL React Specific Concepts](#msal-react-specific-concepts)
21
- 1. [Samples](#samples)
22
- 1. [Security Reporting](#security-reporting)
23
- 1. [License](#license)
24
- 1. [Code of Conduct](#we-value-and-adhere-to-the-microsoft-open-source-code-of-conduct)
25
-
26
- ## About
27
-
28
- The MSAL library for JavaScript enables client-side JavaScript applications to authenticate users using [Azure AD](https://docs.microsoft.com/azure/active-directory/develop/v2-overview) work and school accounts (AAD), Microsoft personal accounts (MSA) and social identity providers like Facebook, Google, LinkedIn, Microsoft accounts, etc. through [Azure AD B2C](https://docs.microsoft.com/azure/active-directory-b2c/active-directory-b2c-overview#identity-providers) service. It also enables your app to get tokens to access [Microsoft Cloud](https://www.microsoft.com/enterprise) services such as [Microsoft Graph](https://graph.microsoft.io).
29
-
30
- The `@azure/msal-react` package described by the code in this folder uses the [`@azure/msal-browser` package](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser) as a peer dependency to enable authentication in Javascript Single-Page Applications without backend servers. This version of the library uses the OAuth 2.0 Authorization Code Flow with PKCE. To read more about this protocol, as well as the differences between implicit flow and authorization code flow, see the section in the [@azure/msal-browser readme](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/README.md#implicit-flow-vs-authorization-code-flow-with-pkce).
31
-
32
- ## Prerequisites
33
-
34
- - `@azure/msal-react` is meant to be used in [Single-Page Application scenarios](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-overview).
35
-
36
- - Before using `@azure/msal-react` you will need to [register a Single Page Application in Azure AD](https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-spa-app-registration) to get a valid `clientId` for configuration, and to register the routes that your app will accept redirect traffic on.
37
-
38
- ## Installation
39
-
40
- The MSAL React package is available on NPM.
41
-
42
- ```sh
43
- npm install react react-dom
44
- npm install @azure/msal-react @azure/msal-browser
45
- ```
46
-
47
- ## Build and Test
48
-
49
- See the [`contributing.md`](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/contributing.md) file for more information.
50
-
51
- ### Building the package locally
52
-
53
- To build the `@azure/msal-react` library, you can do the following:
54
-
55
- ```bash
56
- // Install dev dependencies from root of repo
57
- npm install
58
- // Change to the msal-react package directory
59
- cd lib/msal-react/
60
- // To run build only for react package
61
- npm run build
62
- ```
63
-
64
- To build both the `@azure/msal-react` library and `@azure/msal-browser` libraries, you can do the following:
65
-
66
- ```bash
67
- // Install dev dependencies from root of repo
68
- npm install
69
- // Change to the msal-react package directory
70
- cd lib/msal-react/
71
- // To run build for react and browser packages
72
- npm run build:all
73
- ```
74
-
75
- ### Running Tests
76
-
77
- `@azure/msal-react` uses [jest](https://jestjs.io/) to run unit tests and coverage.
78
-
79
- ```bash
80
- // To run tests
81
- npm test
82
- // To run tests with code coverage
83
- npm run test:coverage
84
- ```
85
-
86
- ## Usage
87
-
88
- For help getting started with `@azure/msal-react` please see our [getting started](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/getting-started.md) doc.
89
-
90
- Migrating from [react-aad-msal](https://www.npmjs.com/package/react-aad-msal)? Check out our [migration guide](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/migration-guide.md).
91
-
92
- ### MSAL Basics
93
-
94
- Since `@azure/msal-react` is a wrapper around `@azure/msal-browser` many docs from the `msal-browser` repo are relevant here as well. For concepts specific to `@azure/msal-react` please see [below](#msal-react-specific-concepts)
95
-
96
- 1. [Initialization](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/initialization.md)
97
- 1. [Acquiring and using an access token](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/acquire-token.md)
98
- 1. [Managing token lifetimes](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/token-lifetimes.md)
99
- 1. [Managing Accounts](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-common/docs/Accounts.md)
100
- 1. [Logging out](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/logout.md)
101
-
102
- ### Advanced Topics
103
-
104
- - [Configuration Options](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/configuration.md)
105
- - [Request and Response Details](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/request-response-object.md)
106
- - [Events](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/events.md)
107
- - [Cache Storage](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/caching.md)
108
- - [Performance Enhancements](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/performance.md)
109
-
110
- ### MSAL React Specific Concepts
111
-
112
- 1. [Hooks](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/hooks.md)
113
- 1. [Events](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/events.md)
114
- 1. [Class Components](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/class-components.md)
115
- 1. [Performance](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/performance.md)
116
-
117
- ## Samples
118
-
119
- Our [samples directory](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples) contains several example apps you can spin up to see how this library can be used in different contexts.
120
-
121
- - [Create React App (JS) Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/react-router-sample)
122
- - [Create React App (TS) Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/typescript-sample)
123
- - [Next.js Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/nextjs-sample)
124
- - [Gatsby Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/gatsby-sample)
125
- - [B2C Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/b2c-sample)
126
-
127
- More advanced samples backed with a tutorial can be found in the [Azure Samples](https://github.com/Azure-Samples) space on GitHub:
128
-
129
- - [React SPA calling Express.js web API](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/3-Authorization-II/1-call-api)
130
- - [React SPA calling Express.js web API using App Roles and RBAC](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/5-AccessControl/1-call-api-roles)
131
- - [React SPA calling Microsoft Graph via Express.js web API using on-behalf-of flow](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/6-AdvancedScenarios/1-call-api-obo)
132
- - [Deployment tutorial for Azure Static Web Apps](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/4-Deployment/2-deploy-static)
133
-
134
- ## Security Reporting
135
-
136
- If you find a security issue with our libraries or services please report it to [secure@microsoft.com](mailto:secure@microsoft.com) with as much detail as possible. Your submission may be eligible for a bounty through the [Microsoft Bounty](http://aka.ms/bugbounty) program. Please do not post security issues to GitHub Issues or any other public site. We will contact you shortly upon receiving the information. We encourage you to get notifications of when security incidents occur by visiting [this page](https://technet.microsoft.com/security/dd252948) and subscribing to Security Advisory Alerts.
137
-
138
- ## License
139
-
140
- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
141
-
142
- ## We Value and Adhere to the Microsoft Open Source Code of Conduct
143
-
144
- This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
1
+ # Microsoft Authentication Library for React (msal-react)
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@azure/msal-react.svg?style=flat)](https://www.npmjs.com/package/@azure/msal-react/)
4
+ [![npm version](https://img.shields.io/npm/dm/@azure/msal-react.svg)](https://nodei.co/npm/@azure/msal-react/)
5
+ [![codecov](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js/branch/dev/graph/badge.svg?flag=msal-react)](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js)
6
+
7
+ | <a href="https://docs.microsoft.com/azure/active-directory/develop/tutorial-v2-react" target="blank">Getting Started</a> | <a href="https://aka.ms/aaddevv2" target="_blank">AAD Docs</a> | <a href="https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_react.html" target="_blank">Library Reference</a> | <a href="https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples" target="blank">Samples</a>
8
+ |--- | --- | --- | --- |
9
+
10
+ 1. [About](#about)
11
+ 1. [FAQ](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/FAQ.md)
12
+ 1. [Changelog](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/CHANGELOG.md)
13
+ 1. [Prerequisites](#prerequisites)
14
+ 1. [Installation](#installation)
15
+ 1. [Build and Test](#build-and-test)
16
+ 1. [Usage](#usage)
17
+ - [Getting Started](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/getting-started.md)
18
+ - [Msal Basics](#msal-basics)
19
+ - [Advanced Topics](#advanced-topics)
20
+ - [MSAL React Specific Concepts](#msal-react-specific-concepts)
21
+ 1. [Samples](#samples)
22
+ 1. [Security Reporting](#security-reporting)
23
+ 1. [License](#license)
24
+ 1. [Code of Conduct](#we-value-and-adhere-to-the-microsoft-open-source-code-of-conduct)
25
+
26
+ ## About
27
+
28
+ The MSAL library for JavaScript enables client-side JavaScript applications to authenticate users using [Azure AD](https://docs.microsoft.com/azure/active-directory/develop/v2-overview) work and school accounts (AAD), Microsoft personal accounts (MSA) and social identity providers like Facebook, Google, LinkedIn, Microsoft accounts, etc. through [Azure AD B2C](https://docs.microsoft.com/azure/active-directory-b2c/active-directory-b2c-overview#identity-providers) service. It also enables your app to get tokens to access [Microsoft Cloud](https://www.microsoft.com/enterprise) services such as [Microsoft Graph](https://graph.microsoft.io).
29
+
30
+ The `@azure/msal-react` package described by the code in this folder uses the [`@azure/msal-browser` package](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser) as a peer dependency to enable authentication in Javascript Single-Page Applications without backend servers. This version of the library uses the OAuth 2.0 Authorization Code Flow with PKCE. To read more about this protocol, as well as the differences between implicit flow and authorization code flow, see the section in the [@azure/msal-browser readme](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/README.md#implicit-flow-vs-authorization-code-flow-with-pkce).
31
+
32
+ ## Prerequisites
33
+
34
+ - `@azure/msal-react` is meant to be used in [Single-Page Application scenarios](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-overview).
35
+
36
+ - Before using `@azure/msal-react` you will need to [register a Single Page Application in Azure AD](https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-spa-app-registration) to get a valid `clientId` for configuration, and to register the routes that your app will accept redirect traffic on.
37
+
38
+ ## Installation
39
+
40
+ The MSAL React package is available on NPM.
41
+
42
+ ```sh
43
+ npm install react react-dom
44
+ npm install @azure/msal-react @azure/msal-browser
45
+ ```
46
+
47
+ ## Build and Test
48
+
49
+ See the [`contributing.md`](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/contributing.md) file for more information.
50
+
51
+ ### Building the package locally
52
+
53
+ To build the `@azure/msal-react` library, you can do the following:
54
+
55
+ ```bash
56
+ // Install dev dependencies from root of repo
57
+ npm install
58
+ // Change to the msal-react package directory
59
+ cd lib/msal-react/
60
+ // To run build only for react package
61
+ npm run build
62
+ ```
63
+
64
+ To build both the `@azure/msal-react` library and `@azure/msal-browser` libraries, you can do the following:
65
+
66
+ ```bash
67
+ // Install dev dependencies from root of repo
68
+ npm install
69
+ // Change to the msal-react package directory
70
+ cd lib/msal-react/
71
+ // To run build for react and browser packages
72
+ npm run build:all
73
+ ```
74
+
75
+ ### Running Tests
76
+
77
+ `@azure/msal-react` uses [jest](https://jestjs.io/) to run unit tests and coverage.
78
+
79
+ ```bash
80
+ // To run tests
81
+ npm test
82
+ // To run tests with code coverage
83
+ npm run test:coverage
84
+ ```
85
+
86
+ ## Usage
87
+
88
+ For help getting started with `@azure/msal-react` please see our [getting started](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/getting-started.md) doc.
89
+
90
+ Migrating from [react-aad-msal](https://www.npmjs.com/package/react-aad-msal)? Check out our [migration guide](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/migration-guide.md).
91
+
92
+ ### MSAL Basics
93
+
94
+ Since `@azure/msal-react` is a wrapper around `@azure/msal-browser` many docs from the `msal-browser` repo are relevant here as well. For concepts specific to `@azure/msal-react` please see [below](#msal-react-specific-concepts)
95
+
96
+ 1. [Initialization](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/initialization.md)
97
+ 1. [Acquiring and using an access token](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/acquire-token.md)
98
+ 1. [Managing token lifetimes](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/token-lifetimes.md)
99
+ 1. [Managing Accounts](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-common/docs/Accounts.md)
100
+ 1. [Logging out](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/logout.md)
101
+
102
+ ### Advanced Topics
103
+
104
+ - [Configuration Options](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/configuration.md)
105
+ - [Request and Response Details](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/request-response-object.md)
106
+ - [Events](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/events.md)
107
+ - [Cache Storage](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/caching.md)
108
+ - [Performance Enhancements](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/performance.md)
109
+
110
+ ### MSAL React Specific Concepts
111
+
112
+ 1. [Hooks](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/hooks.md)
113
+ 1. [Events](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/events.md)
114
+ 1. [Class Components](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/class-components.md)
115
+ 1. [Performance](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/performance.md)
116
+
117
+ ## Samples
118
+
119
+ Our [samples directory](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples) contains several example apps you can spin up to see how this library can be used in different contexts.
120
+
121
+ - [Create React App (JS) Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/react-router-sample)
122
+ - [Create React App (TS) Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/typescript-sample)
123
+ - [Next.js Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/nextjs-sample)
124
+ - [Gatsby Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/gatsby-sample)
125
+ - [B2C Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/b2c-sample)
126
+
127
+ More advanced samples backed with a tutorial can be found in the [Azure Samples](https://github.com/Azure-Samples) space on GitHub:
128
+
129
+ - [React SPA calling Express.js web API](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/3-Authorization-II/1-call-api)
130
+ - [React SPA calling Express.js web API using App Roles and RBAC](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/5-AccessControl/1-call-api-roles)
131
+ - [React SPA calling Microsoft Graph via Express.js web API using on-behalf-of flow](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/6-AdvancedScenarios/1-call-api-obo)
132
+ - [Deployment tutorial for Azure Static Web Apps](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/4-Deployment/2-deploy-static)
133
+
134
+ ## Security Reporting
135
+
136
+ If you find a security issue with our libraries or services please report it to [secure@microsoft.com](mailto:secure@microsoft.com) with as much detail as possible. Your submission may be eligible for a bounty through the [Microsoft Bounty](http://aka.ms/bugbounty) program. Please do not post security issues to GitHub Issues or any other public site. We will contact you shortly upon receiving the information. We encourage you to get notifications of when security incidents occur by visiting [this page](https://technet.microsoft.com/security/dd252948) and subscribing to Security Advisory Alerts.
137
+
138
+ ## License
139
+
140
+ Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
141
+
142
+ ## We Value and Adhere to the Microsoft Open Source Code of Conduct
143
+
144
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
@@ -85,7 +85,7 @@ function getAccountByIdentifiers(allAccounts, accountIdentifiers) {
85
85
 
86
86
  /* eslint-disable header/header */
87
87
  const name = "@azure/msal-react";
88
- const version = "1.5.6";
88
+ const version = "1.5.7";
89
89
 
90
90
  /*
91
91
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1 +1 @@
1
- {"version":3,"file":"msal-react.cjs.development.js","sources":["../src/MsalContext.ts","../src/utils/utilities.ts","../src/packageMetadata.ts","../src/MsalProvider.tsx","../src/hooks/useMsal.ts","../src/hooks/useIsAuthenticated.ts","../src/components/AuthenticatedTemplate.tsx","../src/components/UnauthenticatedTemplate.tsx","../src/hooks/useAccount.ts","../src/error/ReactAuthError.ts","../src/hooks/useMsalAuthentication.ts","../src/components/MsalAuthenticationTemplate.tsx","../src/components/withMsal.tsx"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as React from \"react\";\nimport { IPublicClientApplication, stubbedPublicClientApplication, Logger, InteractionStatus, AccountInfo } from \"@azure/msal-browser\";\n\nexport interface IMsalContext {\n instance: IPublicClientApplication;\n inProgress: InteractionStatus;\n accounts: AccountInfo[];\n logger: Logger;\n}\n\n/*\n * Stubbed context implementation\n * Only used when there is no provider, which is an unsupported scenario\n */\nconst defaultMsalContext: IMsalContext = {\n instance: stubbedPublicClientApplication,\n inProgress: InteractionStatus.None,\n accounts: [],\n logger: new Logger({})\n};\n\nexport const MsalContext = React.createContext<IMsalContext>(\n defaultMsalContext\n);\nexport const MsalConsumer = MsalContext.Consumer;\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { AccountInfo } from \"@azure/msal-browser\";\n\ntype FaaCFunction = <T>(args: T) => React.ReactNode;\n\nexport function getChildrenOrFunction<T>(\n children: React.ReactNode | FaaCFunction,\n args: T\n): React.ReactNode {\n if (typeof children === \"function\") {\n return children(args);\n }\n return children;\n}\n\n/*\n * Utility types\n * Reference: https://github.com/piotrwitek/utility-types\n */\ntype SetDifference<A, B> = A extends B ? never : A;\ntype SetComplement<A, A1 extends A> = SetDifference<A, A1>;\nexport type Subtract<T extends T1, T1 extends object> = Pick<T,SetComplement<keyof T, keyof T1>>;\n\n/**\n * Helper function to determine whether 2 arrays are equal\n * Used to avoid unnecessary state updates\n * @param arrayA \n * @param arrayB \n */\nexport function accountArraysAreEqual(arrayA: Array<AccountIdentifiers>, arrayB: Array<AccountIdentifiers>): boolean {\n if (arrayA.length !== arrayB.length) {\n return false;\n }\n\n const comparisonArray = [...arrayB];\n\n return arrayA.every((elementA) => {\n const elementB = comparisonArray.shift();\n if (!elementA || !elementB) {\n return false;\n }\n\n return (elementA.homeAccountId === elementB.homeAccountId) && \n (elementA.localAccountId === elementB.localAccountId) &&\n (elementA.username === elementB.username);\n });\n}\n\nexport function getAccountByIdentifiers(allAccounts: AccountInfo[], accountIdentifiers: AccountIdentifiers): AccountInfo | null {\n if (allAccounts.length > 0 && (accountIdentifiers.homeAccountId || accountIdentifiers.localAccountId || accountIdentifiers.username)) {\n const matchedAccounts = allAccounts.filter(accountObj => {\n if (accountIdentifiers.username && accountIdentifiers.username.toLowerCase() !== accountObj.username.toLowerCase()) {\n return false;\n }\n if (accountIdentifiers.homeAccountId && accountIdentifiers.homeAccountId.toLowerCase() !== accountObj.homeAccountId.toLowerCase()) {\n return false;\n }\n if (accountIdentifiers.localAccountId && accountIdentifiers.localAccountId.toLowerCase() !== accountObj.localAccountId.toLowerCase()) {\n return false;\n }\n\n return true;\n });\n\n return matchedAccounts[0] || null;\n } else {\n return null;\n }\n}\n","/* eslint-disable header/header */\nexport const name = \"@azure/msal-react\";\nexport const version = \"1.5.6\";\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React, { useEffect, useReducer, PropsWithChildren, useMemo} from \"react\";\nimport {\n IPublicClientApplication,\n EventMessage,\n EventMessageUtils,\n InteractionStatus,\n Logger,\n WrapperSKU,\n AccountInfo\n} from \"@azure/msal-browser\";\nimport { MsalContext, IMsalContext } from \"./MsalContext\";\nimport { accountArraysAreEqual } from \"./utils/utilities\";\nimport { name as SKU, version } from \"./packageMetadata\";\n\nexport type MsalProviderProps = PropsWithChildren<{\n instance: IPublicClientApplication;\n}>;\n\ntype MsalState = {\n inProgress: InteractionStatus;\n accounts: AccountInfo[];\n};\n\nenum MsalProviderActionType {\n UNBLOCK_INPROGRESS = \"UNBLOCK_INPROGRESS\",\n EVENT = \"EVENT\"\n}\n\ntype MsalProviderReducerAction = {\n type: MsalProviderActionType,\n payload: {\n logger: Logger;\n instance: IPublicClientApplication;\n message?: EventMessage;\n };\n};\n\n/**\n * Returns the next inProgress and accounts state based on event message\n * @param previousState \n * @param action \n */\nconst reducer = (previousState: MsalState, action: MsalProviderReducerAction): MsalState => {\n const { type, payload } = action;\n let newInProgress = previousState.inProgress;\n\n switch (type) {\n case MsalProviderActionType.UNBLOCK_INPROGRESS:\n if (previousState.inProgress === InteractionStatus.Startup){\n newInProgress = InteractionStatus.None;\n payload.logger.info(\"MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'\");\n }\n break;\n case MsalProviderActionType.EVENT:\n const message = payload.message as EventMessage;\n const status = EventMessageUtils.getInteractionStatusFromEvent(message, previousState.inProgress);\n if (status) {\n payload.logger.info(`MsalProvider - ${message.eventType} results in setting inProgress from ${previousState.inProgress} to ${status}`);\n newInProgress = status;\n }\n break;\n default:\n throw new Error(`Unknown action type: ${type}`);\n }\n \n const currentAccounts = payload.instance.getAllAccounts();\n if (newInProgress !== previousState.inProgress && \n !accountArraysAreEqual(currentAccounts, previousState.accounts)) {\n // Both inProgress and accounts changed\n return {\n ...previousState,\n inProgress: newInProgress,\n accounts: currentAccounts\n };\n } else if (newInProgress !== previousState.inProgress) {\n // Only only inProgress changed\n return {\n ...previousState,\n inProgress: newInProgress\n };\n } else if (!accountArraysAreEqual(currentAccounts, previousState.accounts)) {\n // Only accounts changed\n return {\n ...previousState,\n accounts: currentAccounts\n };\n } else {\n // Nothing changed\n return previousState;\n }\n};\n\n/**\n * MSAL context provider component. This must be rendered above any other components that use MSAL.\n */\nexport function MsalProvider({instance, children}: MsalProviderProps): React.ReactElement {\n useEffect(() => {\n instance.initializeWrapperLibrary(WrapperSKU.React, version);\n }, [instance]);\n // Create a logger instance for msal-react with the same options as PublicClientApplication\n const logger = useMemo(() => {\n return instance.getLogger().clone(SKU, version);\n }, [instance]);\n\n const [state, updateState] = useReducer(reducer, undefined, () => {\n // Lazy initialization of the initial state\n return {\n inProgress: InteractionStatus.Startup,\n accounts: instance.getAllAccounts()\n };\n });\n \n useEffect(() => {\n const callbackId = instance.addEventCallback((message: EventMessage) => {\n updateState({\n payload: {\n instance,\n logger,\n message\n }, \n type: MsalProviderActionType.EVENT\n });\n });\n logger.verbose(`MsalProvider - Registered event callback with id: ${callbackId}`);\n\n instance.initialize().then(() => {\n instance.handleRedirectPromise().catch(() => {\n // Errors should be handled by listening to the LOGIN_FAILURE event\n return;\n }).finally(() => {\n /*\n * If handleRedirectPromise returns a cached promise the necessary events may not be fired\n * This is a fallback to prevent inProgress from getting stuck in 'startup'\n */\n updateState({\n payload: {\n instance,\n logger\n },\n type: MsalProviderActionType.UNBLOCK_INPROGRESS \n });\n });\n });\n\n return () => {\n // Remove callback when component unmounts or accounts change\n if (callbackId) {\n logger.verbose(`MsalProvider - Removing event callback ${callbackId}`);\n instance.removeEventCallback(callbackId);\n }\n };\n }, [instance, logger]);\n\n const contextValue: IMsalContext = {\n instance,\n inProgress: state.inProgress,\n accounts: state.accounts,\n logger\n };\n\n return (\n <MsalContext.Provider value={contextValue}>\n {children}\n </MsalContext.Provider>\n );\n}\n\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { useContext } from \"react\";\nimport { IMsalContext, MsalContext } from \"../MsalContext\";\n\n/**\n * Returns Msal Context values\n */\nexport const useMsal = (): IMsalContext => useContext(MsalContext);\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { useState, useEffect } from \"react\";\nimport { useMsal } from \"./useMsal\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { AccountInfo, InteractionStatus } from \"@azure/msal-browser\";\nimport { getAccountByIdentifiers } from \"../utils/utilities\";\n\nfunction isAuthenticated(allAccounts: AccountInfo[], matchAccount?: AccountIdentifiers): boolean {\n if(matchAccount && (matchAccount.username || matchAccount.homeAccountId || matchAccount.localAccountId)) {\n return !!getAccountByIdentifiers(allAccounts, matchAccount);\n } \n\n return allAccounts.length > 0;\n}\n\n/**\n * Returns whether or not a user is currently signed-in. Optionally provide 1 or more accountIdentifiers to determine if a specific user is signed-in\n * @param matchAccount \n */\nexport function useIsAuthenticated(matchAccount?: AccountIdentifiers): boolean {\n const { accounts: allAccounts, inProgress } = useMsal();\n\n const [hasAuthenticated, setHasAuthenticated] = useState<boolean>(() => {\n if (inProgress === InteractionStatus.Startup) {\n return false;\n }\n return isAuthenticated(allAccounts, matchAccount);\n });\n\n useEffect(() => {\n setHasAuthenticated(isAuthenticated(allAccounts, matchAccount));\n }, [allAccounts, matchAccount]);\n\n return hasAuthenticated;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React, { PropsWithChildren, useMemo } from \"react\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { getChildrenOrFunction } from \"../utils/utilities\";\nimport { useMsal } from \"../hooks/useMsal\";\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\nimport { InteractionStatus } from \"@azure/msal-browser\";\n\nexport type AuthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;\n\n/**\n * Renders child components if user is authenticated\n * @param props \n */\nexport function AuthenticatedTemplate({ username, homeAccountId, localAccountId, children }: AuthenticatedTemplateProps): React.ReactElement|null {\n const context = useMsal();\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\n return {\n username,\n homeAccountId,\n localAccountId\n };\n }, [username, homeAccountId, localAccountId]);\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\n\n if (isAuthenticated && context.inProgress !== InteractionStatus.Startup) {\n return (\n <React.Fragment>\n {getChildrenOrFunction(children, context)}\n </React.Fragment>\n );\n }\n return null;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React, { PropsWithChildren, useMemo } from \"react\";\nimport { useMsal } from \"../hooks/useMsal\";\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\nimport { getChildrenOrFunction } from \"../utils/utilities\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { InteractionStatus } from \"@azure/msal-browser\";\n\nexport type UnauthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;\n\n/**\n * Renders child components if user is unauthenticated\n * @param props \n */\nexport function UnauthenticatedTemplate({ username, homeAccountId, localAccountId, children }: UnauthenticatedTemplateProps): React.ReactElement|null {\n const context = useMsal();\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\n return {\n username,\n homeAccountId,\n localAccountId\n };\n }, [username, homeAccountId, localAccountId]);\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\n\n if (!isAuthenticated && context.inProgress !== InteractionStatus.Startup && context.inProgress !== InteractionStatus.HandleRedirect) {\n return (\n <React.Fragment>\n {getChildrenOrFunction(children, context)}\n </React.Fragment>\n );\n }\n return null;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { useState, useEffect } from \"react\";\nimport { AccountInfo, IPublicClientApplication, AccountEntity } from \"@azure/msal-browser\";\nimport { useMsal } from \"./useMsal\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { getAccountByIdentifiers } from \"../utils/utilities\";\n\nfunction getAccount(instance: IPublicClientApplication, accountIdentifiers?: AccountIdentifiers): AccountInfo | null {\n if (!accountIdentifiers || (!accountIdentifiers.homeAccountId && !accountIdentifiers.localAccountId && !accountIdentifiers.username)) {\n // If no account identifiers are provided, return active account\n return instance.getActiveAccount();\n }\n\n return getAccountByIdentifiers(instance.getAllAccounts(), accountIdentifiers);\n}\n\n/**\n * Given 1 or more accountIdentifiers, returns the Account object if the user is signed-in\n * @param accountIdentifiers \n */\nexport function useAccount(accountIdentifiers?: AccountIdentifiers): AccountInfo | null {\n const { instance, inProgress, logger } = useMsal();\n\n const [account, setAccount] = useState<AccountInfo|null>(() => getAccount(instance, accountIdentifiers));\n\n useEffect(() => {\n setAccount((currentAccount: AccountInfo | null) => {\n const nextAccount = getAccount(instance, accountIdentifiers);\n if (!AccountEntity.accountInfoIsEqual(currentAccount, nextAccount, true)) {\n logger.info(\"useAccount - Updating account\");\n return nextAccount;\n }\n\n return currentAccount;\n });\n }, [inProgress, accountIdentifiers, instance, logger]);\n\n return account;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthError } from \"@azure/msal-browser\";\n\nexport const ReactAuthErrorMessage = {\n invalidInteractionType: {\n code: \"invalid_interaction_type\",\n desc: \"The provided interaction type is invalid.\"\n },\n unableToFallbackToInteraction: {\n code: \"unable_to_fallback_to_interaction\",\n desc: \"Interaction is required but another interaction is already in progress. Please try again when the current interaction is complete.\"\n }\n};\n\nexport class ReactAuthError extends AuthError {\n constructor(errorCode: string, errorMessage?: string) {\n super(errorCode, errorMessage);\n\n Object.setPrototypeOf(this, ReactAuthError.prototype);\n this.name = \"ReactAuthError\";\n }\n\n static createInvalidInteractionTypeError(): ReactAuthError {\n return new ReactAuthError(ReactAuthErrorMessage.invalidInteractionType.code, ReactAuthErrorMessage.invalidInteractionType.desc);\n }\n\n static createUnableToFallbackToInteractionError(): ReactAuthError {\n return new ReactAuthError(ReactAuthErrorMessage.unableToFallbackToInteraction.code, ReactAuthErrorMessage.unableToFallbackToInteraction.desc);\n }\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { useCallback, useEffect, useState, useRef } from \"react\";\nimport { PopupRequest, RedirectRequest, SsoSilentRequest, InteractionType, AuthenticationResult, AuthError, EventMessage, EventType, InteractionStatus, SilentRequest, InteractionRequiredAuthError, OIDC_DEFAULT_SCOPES } from \"@azure/msal-browser\";\nimport { useIsAuthenticated } from \"./useIsAuthenticated\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { useMsal } from \"./useMsal\";\nimport { useAccount } from \"./useAccount\";\nimport { ReactAuthError } from \"../error/ReactAuthError\";\n\nexport type MsalAuthenticationResult = {\n login: (callbackInteractionType?: InteractionType | undefined, callbackRequest?: PopupRequest | RedirectRequest | SilentRequest) => Promise<AuthenticationResult | null>; \n acquireToken: (callbackInteractionType?: InteractionType | undefined, callbackRequest?: SilentRequest | undefined) => Promise<AuthenticationResult | null>;\n result: AuthenticationResult|null;\n error: AuthError|null;\n};\n\n/**\n * If a user is not currently signed in this hook invokes a login. Failed logins can be retried using the login callback returned.\n * If a user is currently signed in this hook attempts to acquire a token. Subsequent token requests can use the acquireToken callback returned.\n * Optionally provide a request object to be used in the login/acquireToken call.\n * Optionally provide a specific user that should be logged in.\n * @param interactionType \n * @param authenticationRequest \n * @param accountIdentifiers \n */\nexport function useMsalAuthentication(\n interactionType: InteractionType, \n authenticationRequest?: PopupRequest|RedirectRequest|SsoSilentRequest, \n accountIdentifiers?: AccountIdentifiers\n): MsalAuthenticationResult {\n const { instance, inProgress, logger } = useMsal();\n const isAuthenticated = useIsAuthenticated(accountIdentifiers);\n const account = useAccount(accountIdentifiers);\n const [[result, error], setResponse] = useState<[AuthenticationResult|null, AuthError|null]>([null, null]);\n\n // Used to prevent state updates after unmount\n const mounted = useRef(true);\n useEffect(() => {\n return () => {\n mounted.current = false;\n };\n },[]);\n\n // Boolean used to check if interaction is in progress in acquireTokenSilent fallback. Use Ref instead of state to prevent acquireToken function from being regenerated on each change to interactionInProgress value\n const interactionInProgress = useRef(inProgress !== InteractionStatus.None);\n useEffect(() => {\n interactionInProgress.current = inProgress !== InteractionStatus.None;\n }, [inProgress]);\n\n // Flag used to control when the hook calls login/acquireToken\n const shouldAcquireToken = useRef(true);\n useEffect(() => {\n if (!!error) {\n // Errors should be handled by consuming component\n shouldAcquireToken.current = false;\n return;\n }\n\n if (!!result) {\n // Token has already been acquired, consuming component/application is responsible for renewing\n shouldAcquireToken.current = false;\n return;\n }\n }, [error, result]);\n\n const login = useCallback(async (callbackInteractionType?: InteractionType, callbackRequest?: PopupRequest|RedirectRequest|SsoSilentRequest): Promise<AuthenticationResult|null> => {\n const loginType = callbackInteractionType || interactionType;\n const loginRequest = callbackRequest || authenticationRequest;\n switch (loginType) {\n case InteractionType.Popup:\n logger.verbose(\"useMsalAuthentication - Calling loginPopup\");\n return instance.loginPopup(loginRequest as PopupRequest);\n case InteractionType.Redirect:\n // This promise is not expected to resolve due to full frame redirect\n logger.verbose(\"useMsalAuthentication - Calling loginRedirect\");\n return instance.loginRedirect(loginRequest as RedirectRequest).then(null);\n case InteractionType.Silent:\n logger.verbose(\"useMsalAuthentication - Calling ssoSilent\");\n return instance.ssoSilent(loginRequest as SsoSilentRequest);\n default:\n throw ReactAuthError.createInvalidInteractionTypeError();\n }\n }, [instance, interactionType, authenticationRequest, logger]);\n\n const acquireToken = useCallback(async (callbackInteractionType?: InteractionType, callbackRequest?: SilentRequest): Promise<AuthenticationResult|null> => {\n const fallbackInteractionType = callbackInteractionType || interactionType;\n\n let tokenRequest: SilentRequest;\n\n if (callbackRequest) {\n logger.trace(\"useMsalAuthentication - acquireToken - Using request provided in the callback\");\n tokenRequest = {\n ...callbackRequest\n };\n } else if (authenticationRequest) {\n logger.trace(\"useMsalAuthentication - acquireToken - Using request provided in the hook\");\n tokenRequest = {\n ...authenticationRequest,\n scopes: authenticationRequest.scopes || OIDC_DEFAULT_SCOPES\n };\n } else {\n logger.trace(\"useMsalAuthentication - acquireToken - No request object provided, using default request.\");\n tokenRequest = {\n scopes: OIDC_DEFAULT_SCOPES\n };\n }\n \n if (!tokenRequest.account && account) {\n logger.trace(\"useMsalAuthentication - acquireToken - Attaching account to request\");\n tokenRequest.account = account;\n }\n\n const getToken = async (): Promise<AuthenticationResult|null> => {\n logger.verbose(\"useMsalAuthentication - Calling acquireTokenSilent\");\n return instance.acquireTokenSilent(tokenRequest).catch(async (e: AuthError) => {\n if (e instanceof InteractionRequiredAuthError) {\n if (!interactionInProgress.current) {\n logger.error(\"useMsalAuthentication - Interaction required, falling back to interaction\");\n return login(fallbackInteractionType, tokenRequest);\n } else {\n logger.error(\"useMsalAuthentication - Interaction required but is already in progress. Please try again, if needed, after interaction completes.\");\n throw ReactAuthError.createUnableToFallbackToInteractionError();\n }\n }\n\n throw e;\n });\n };\n\n return getToken().then((response: AuthenticationResult|null) => {\n if (mounted.current) {\n setResponse([response, null]);\n }\n return response;\n }).catch((e: AuthError) => {\n if (mounted.current) {\n setResponse([null, e]);\n }\n throw e;\n });\n }, [instance, interactionType, authenticationRequest, logger, account, login]);\n\n useEffect(() => {\n const callbackId = instance.addEventCallback((message: EventMessage) => {\n switch(message.eventType) {\n case EventType.LOGIN_SUCCESS:\n case EventType.SSO_SILENT_SUCCESS:\n if (message.payload) {\n setResponse([message.payload as AuthenticationResult, null]);\n }\n break;\n case EventType.LOGIN_FAILURE:\n case EventType.SSO_SILENT_FAILURE:\n if (message.error) {\n setResponse([null, message.error as AuthError]);\n }\n break;\n }\n });\n logger.verbose(`useMsalAuthentication - Registered event callback with id: ${callbackId}`);\n\n return () => {\n if (callbackId) {\n logger.verbose(`useMsalAuthentication - Removing event callback ${callbackId}`);\n instance.removeEventCallback(callbackId);\n }\n };\n }, [instance, logger]);\n\n useEffect(() => {\n if (shouldAcquireToken.current && inProgress === InteractionStatus.None) {\n shouldAcquireToken.current = false;\n if (!isAuthenticated) {\n logger.info(\"useMsalAuthentication - No user is authenticated, attempting to login\");\n login().catch(() => {\n // Errors are saved in state above\n return;\n });\n } else if (account) {\n logger.info(\"useMsalAuthentication - User is authenticated, attempting to acquire token\");\n acquireToken().catch(() => {\n // Errors are saved in state above\n return;\n });\n }\n }\n }, [isAuthenticated, account, inProgress, login, acquireToken, logger]);\n\n return { \n login, \n acquireToken, \n result, \n error\n };\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React, { PropsWithChildren, useMemo } from \"react\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { getChildrenOrFunction } from \"../utils/utilities\";\nimport { useMsal } from \"../hooks/useMsal\";\nimport { MsalAuthenticationResult, useMsalAuthentication } from \"../hooks/useMsalAuthentication\";\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\nimport { InteractionType, PopupRequest, RedirectRequest, SsoSilentRequest, InteractionStatus } from \"@azure/msal-browser\";\nimport { IMsalContext } from \"../MsalContext\";\n\nexport type MsalAuthenticationProps = PropsWithChildren<AccountIdentifiers & {\n interactionType: InteractionType;\n authenticationRequest?: PopupRequest|RedirectRequest|SsoSilentRequest;\n loadingComponent?: React.ElementType<IMsalContext>;\n errorComponent?: React.ElementType<MsalAuthenticationResult>;\n}>;\n\n/**\n * Attempts to authenticate user if not already authenticated, then renders child components\n * @param props\n */\nexport function MsalAuthenticationTemplate({ \n interactionType, \n username, \n homeAccountId, \n localAccountId,\n authenticationRequest, \n loadingComponent: LoadingComponent,\n errorComponent: ErrorComponent,\n children \n}: MsalAuthenticationProps): React.ReactElement|null {\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\n return {\n username,\n homeAccountId,\n localAccountId\n };\n }, [username, homeAccountId, localAccountId]);\n const context = useMsal();\n const msalAuthResult = useMsalAuthentication(interactionType, authenticationRequest, accountIdentifier);\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\n\n if (msalAuthResult.error && context.inProgress === InteractionStatus.None) {\n if (!!ErrorComponent) {\n return <ErrorComponent {...msalAuthResult} />;\n }\n\n throw msalAuthResult.error;\n }\n \n if (isAuthenticated) {\n return (\n <React.Fragment>\n {getChildrenOrFunction(children, msalAuthResult)}\n </React.Fragment>\n );\n } \n \n if (!!LoadingComponent && context.inProgress !== InteractionStatus.None) {\n return <LoadingComponent {...context} />;\n }\n\n return null;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React from \"react\";\nimport { IMsalContext } from \"../MsalContext\";\nimport { useMsal } from \"../hooks/useMsal\";\nimport { Subtract } from \"../utils/utilities\";\n\nexport type WithMsalProps = {\n msalContext: IMsalContext;\n};\n\n/**\n * Higher order component wraps provided component with msal by injecting msal context values into the component's props \n * @param Component \n */\nexport const withMsal = <P extends WithMsalProps>(Component: React.ComponentType<P>): React.FunctionComponent<Subtract<P,WithMsalProps>> => {\n const ComponentWithMsal: React.FunctionComponent<Subtract<P,WithMsalProps>> = props => {\n const msal = useMsal();\n return <Component {...(props as P)} msalContext={msal} />;\n };\n\n const componentName =\n Component.displayName || Component.name || \"Component\";\n ComponentWithMsal.displayName = `withMsal(${componentName})`;\n\n return ComponentWithMsal;\n};\n"],"names":["defaultMsalContext","instance","stubbedPublicClientApplication","inProgress","InteractionStatus","None","accounts","logger","Logger","MsalContext","React","MsalConsumer","Consumer","getChildrenOrFunction","children","args","accountArraysAreEqual","arrayA","arrayB","length","comparisonArray","every","elementA","elementB","shift","homeAccountId","localAccountId","username","getAccountByIdentifiers","allAccounts","accountIdentifiers","matchedAccounts","filter","accountObj","toLowerCase","name","version","MsalProviderActionType","reducer","previousState","action","type","payload","newInProgress","UNBLOCK_INPROGRESS","Startup","info","EVENT","message","status","EventMessageUtils","getInteractionStatusFromEvent","eventType","Error","currentAccounts","getAllAccounts","MsalProvider","useEffect","initializeWrapperLibrary","WrapperSKU","useMemo","getLogger","clone","SKU","state","updateState","useReducer","undefined","callbackId","addEventCallback","verbose","initialize","then","handleRedirectPromise","catch","finally","removeEventCallback","contextValue","Provider","value","useMsal","useContext","isAuthenticated","matchAccount","useIsAuthenticated","hasAuthenticated","setHasAuthenticated","useState","AuthenticatedTemplate","context","accountIdentifier","Fragment","UnauthenticatedTemplate","HandleRedirect","getAccount","getActiveAccount","useAccount","account","setAccount","currentAccount","nextAccount","AccountEntity","accountInfoIsEqual","ReactAuthErrorMessage","invalidInteractionType","code","desc","unableToFallbackToInteraction","ReactAuthError","AuthError","constructor","errorCode","errorMessage","Object","setPrototypeOf","prototype","createInvalidInteractionTypeError","createUnableToFallbackToInteractionError","useMsalAuthentication","interactionType","authenticationRequest","result","error","setResponse","mounted","useRef","current","interactionInProgress","shouldAcquireToken","login","useCallback","callbackInteractionType","callbackRequest","loginType","loginRequest","InteractionType","Popup","loginPopup","Redirect","loginRedirect","Silent","ssoSilent","acquireToken","fallbackInteractionType","tokenRequest","trace","scopes","OIDC_DEFAULT_SCOPES","getToken","acquireTokenSilent","e","InteractionRequiredAuthError","response","EventType","LOGIN_SUCCESS","SSO_SILENT_SUCCESS","LOGIN_FAILURE","SSO_SILENT_FAILURE","MsalAuthenticationTemplate","loadingComponent","LoadingComponent","errorComponent","ErrorComponent","msalAuthResult","withMsal","Component","ComponentWithMsal","props","msal","msalContext","componentName","displayName"],"mappings":";;;;;;;;;;AAAA;;;;AAeA;;;;;AAIA,MAAMA,kBAAkB,GAAiB;AACrCC,EAAAA,QAAQ,EAAEC,0CAD2B;AAErCC,EAAAA,UAAU,EAAEC,6BAAiB,CAACC,IAFO;AAGrCC,EAAAA,QAAQ,EAAE,EAH2B;AAIrCC,EAAAA,MAAM,eAAE,IAAIC,kBAAJ,CAAW,EAAX;AAJ6B,CAAzC;MAOaC,WAAW,gBAAGC,mBAAA,CACvBV,kBADuB;MAGdW,YAAY,GAAGF,WAAW,CAACG;;AC7BxC;;;;AAUA,SAAgBC,sBACZC,UACAC;AAEA,MAAI,OAAOD,QAAP,KAAoB,UAAxB,EAAoC;AAChC,WAAOA,QAAQ,CAACC,IAAD,CAAf;AACH;;AACD,SAAOD,QAAP;AACH;AAUD;;;;;;;AAMA,SAAgBE,sBAAsBC,QAAmCC;AACrE,MAAID,MAAM,CAACE,MAAP,KAAkBD,MAAM,CAACC,MAA7B,EAAqC;AACjC,WAAO,KAAP;AACH;;AAED,QAAMC,eAAe,GAAG,CAAC,GAAGF,MAAJ,CAAxB;AAEA,SAAOD,MAAM,CAACI,KAAP,CAAcC,QAAD;AAChB,UAAMC,QAAQ,GAAGH,eAAe,CAACI,KAAhB,EAAjB;;AACA,QAAI,CAACF,QAAD,IAAa,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MR,eAAe,GAAGE,kBAAkB,CAACM,iBAAD,CAA1C;;AAEA,MAAIyE,cAAc,CAACzC,KAAf,IAAwBjC,OAAO,CAACtF,UAAR,KAAuBC,6BAAiB,CAACC,IAArE,EAA2E;AACvE,QAAI,CAAC,CAAC6J,cAAN,EAAsB;AAClB,aAAOxJ,4BAAA,CAACwJ,cAAD,oBAAoBC,eAApB,CAAP;AACH;;AAED,UAAMA,cAAc,CAACzC,KAArB;AACH;;AAED,MAAIxC,eAAJ,EAAqB;AACjB,WACIxE,4BAAA,CAACA,cAAK,CAACiF,QAAP,MAAA,EACK9E,qBAAqB,CAACC,QAAD,EAAWqJ,cAAX,CAD1B,CADJ;AAKH;;AAED,MAAI,CAAC,CAACH,gBAAF,IAAsBvE,OAAO,CAACtF,UAAR,KAAuBC,6BAAiB,CAACC,IAAnE,EAAyE;AACrE,WAAOK,4BAAA,CAACsJ,gBAAD,oBAAsBvE,QAAtB,CAAP;AACH;;AAED,SAAO,IAAP;AACH;;ACnED;;;;AAKA,AASA;;;;;AAIA,MAAa2E,QAAQ,GAA6BC,SAA1B;AACpB,QAAMC,iBAAiB,GAAuDC,KAAK;AAC/E,UAAMC,IAAI,GAAGxF,OAAO,EAApB;AACA,WAAOtE,4BAAA,CAAC2J,SAAD,oBAAgBE;AAAaE,MAAAA,WAAW,EAAED;MAA1C,CAAP;AACH,GAHD;;AAKA,QAAME,aAAa,GACfL,SAAS,CAACM,WAAV,IAAyBN,SAAS,CAAClI,IAAnC,IAA2C,WAD/C;AAEAmI,EAAAA,iBAAiB,CAACK,WAAlB,eAA4CD,gBAA5C;AAEA,SAAOJ,iBAAP;AACH,CAXM;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"msal-react.cjs.development.js","sources":["../src/MsalContext.ts","../src/utils/utilities.ts","../src/packageMetadata.ts","../src/MsalProvider.tsx","../src/hooks/useMsal.ts","../src/hooks/useIsAuthenticated.ts","../src/components/AuthenticatedTemplate.tsx","../src/components/UnauthenticatedTemplate.tsx","../src/hooks/useAccount.ts","../src/error/ReactAuthError.ts","../src/hooks/useMsalAuthentication.ts","../src/components/MsalAuthenticationTemplate.tsx","../src/components/withMsal.tsx"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { IPublicClientApplication, stubbedPublicClientApplication, Logger, InteractionStatus, AccountInfo } from \"@azure/msal-browser\";\r\n\r\nexport interface IMsalContext {\r\n instance: IPublicClientApplication;\r\n inProgress: InteractionStatus;\r\n accounts: AccountInfo[];\r\n logger: Logger;\r\n}\r\n\r\n/*\r\n * Stubbed context implementation\r\n * Only used when there is no provider, which is an unsupported scenario\r\n */\r\nconst defaultMsalContext: IMsalContext = {\r\n instance: stubbedPublicClientApplication,\r\n inProgress: InteractionStatus.None,\r\n accounts: [],\r\n logger: new Logger({})\r\n};\r\n\r\nexport const MsalContext = React.createContext<IMsalContext>(\r\n defaultMsalContext\r\n);\r\nexport const MsalConsumer = MsalContext.Consumer;\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { AccountInfo } from \"@azure/msal-browser\";\r\n\r\ntype FaaCFunction = <T>(args: T) => React.ReactNode;\r\n\r\nexport function getChildrenOrFunction<T>(\r\n children: React.ReactNode | FaaCFunction,\r\n args: T\r\n): React.ReactNode {\r\n if (typeof children === \"function\") {\r\n return children(args);\r\n }\r\n return children;\r\n}\r\n\r\n/*\r\n * Utility types\r\n * Reference: https://github.com/piotrwitek/utility-types\r\n */\r\ntype SetDifference<A, B> = A extends B ? never : A;\r\ntype SetComplement<A, A1 extends A> = SetDifference<A, A1>;\r\nexport type Subtract<T extends T1, T1 extends object> = Pick<T,SetComplement<keyof T, keyof T1>>;\r\n\r\n/**\r\n * Helper function to determine whether 2 arrays are equal\r\n * Used to avoid unnecessary state updates\r\n * @param arrayA \r\n * @param arrayB \r\n */\r\nexport function accountArraysAreEqual(arrayA: Array<AccountIdentifiers>, arrayB: Array<AccountIdentifiers>): boolean {\r\n if (arrayA.length !== arrayB.length) {\r\n return false;\r\n }\r\n\r\n const comparisonArray = [...arrayB];\r\n\r\n return arrayA.every((elementA) => {\r\n const elementB = comparisonArray.shift();\r\n if (!elementA || !elementB) {\r\n return false;\r\n }\r\n\r\n return (elementA.homeAccountId === elementB.homeAccountId) && \r\n (elementA.localAccountId === elementB.localAccountId) &&\r\n (elementA.username === elementB.username);\r\n });\r\n}\r\n\r\nexport function getAccountByIdentifiers(allAccounts: AccountInfo[], accountIdentifiers: AccountIdentifiers): AccountInfo | null {\r\n if (allAccounts.length > 0 && (accountIdentifiers.homeAccountId || accountIdentifiers.localAccountId || accountIdentifiers.username)) {\r\n const matchedAccounts = allAccounts.filter(accountObj => {\r\n if (accountIdentifiers.username && accountIdentifiers.username.toLowerCase() !== accountObj.username.toLowerCase()) {\r\n return false;\r\n }\r\n if (accountIdentifiers.homeAccountId && accountIdentifiers.homeAccountId.toLowerCase() !== accountObj.homeAccountId.toLowerCase()) {\r\n return false;\r\n }\r\n if (accountIdentifiers.localAccountId && accountIdentifiers.localAccountId.toLowerCase() !== accountObj.localAccountId.toLowerCase()) {\r\n return false;\r\n }\r\n\r\n return true;\r\n });\r\n\r\n return matchedAccounts[0] || null;\r\n } else {\r\n return null;\r\n }\r\n}\r\n","/* eslint-disable header/header */\r\nexport const name = \"@azure/msal-react\";\r\nexport const version = \"1.5.7\";\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React, { useEffect, useReducer, PropsWithChildren, useMemo} from \"react\";\r\nimport {\r\n IPublicClientApplication,\r\n EventMessage,\r\n EventMessageUtils,\r\n InteractionStatus,\r\n Logger,\r\n WrapperSKU,\r\n AccountInfo\r\n} from \"@azure/msal-browser\";\r\nimport { MsalContext, IMsalContext } from \"./MsalContext\";\r\nimport { accountArraysAreEqual } from \"./utils/utilities\";\r\nimport { name as SKU, version } from \"./packageMetadata\";\r\n\r\nexport type MsalProviderProps = PropsWithChildren<{\r\n instance: IPublicClientApplication;\r\n}>;\r\n\r\ntype MsalState = {\r\n inProgress: InteractionStatus;\r\n accounts: AccountInfo[];\r\n};\r\n\r\nenum MsalProviderActionType {\r\n UNBLOCK_INPROGRESS = \"UNBLOCK_INPROGRESS\",\r\n EVENT = \"EVENT\"\r\n}\r\n\r\ntype MsalProviderReducerAction = {\r\n type: MsalProviderActionType,\r\n payload: {\r\n logger: Logger;\r\n instance: IPublicClientApplication;\r\n message?: EventMessage;\r\n };\r\n};\r\n\r\n/**\r\n * Returns the next inProgress and accounts state based on event message\r\n * @param previousState \r\n * @param action \r\n */\r\nconst reducer = (previousState: MsalState, action: MsalProviderReducerAction): MsalState => {\r\n const { type, payload } = action;\r\n let newInProgress = previousState.inProgress;\r\n\r\n switch (type) {\r\n case MsalProviderActionType.UNBLOCK_INPROGRESS:\r\n if (previousState.inProgress === InteractionStatus.Startup){\r\n newInProgress = InteractionStatus.None;\r\n payload.logger.info(\"MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'\");\r\n }\r\n break;\r\n case MsalProviderActionType.EVENT:\r\n const message = payload.message as EventMessage;\r\n const status = EventMessageUtils.getInteractionStatusFromEvent(message, previousState.inProgress);\r\n if (status) {\r\n payload.logger.info(`MsalProvider - ${message.eventType} results in setting inProgress from ${previousState.inProgress} to ${status}`);\r\n newInProgress = status;\r\n }\r\n break;\r\n default:\r\n throw new Error(`Unknown action type: ${type}`);\r\n }\r\n \r\n const currentAccounts = payload.instance.getAllAccounts();\r\n if (newInProgress !== previousState.inProgress && \r\n !accountArraysAreEqual(currentAccounts, previousState.accounts)) {\r\n // Both inProgress and accounts changed\r\n return {\r\n ...previousState,\r\n inProgress: newInProgress,\r\n accounts: currentAccounts\r\n };\r\n } else if (newInProgress !== previousState.inProgress) {\r\n // Only only inProgress changed\r\n return {\r\n ...previousState,\r\n inProgress: newInProgress\r\n };\r\n } else if (!accountArraysAreEqual(currentAccounts, previousState.accounts)) {\r\n // Only accounts changed\r\n return {\r\n ...previousState,\r\n accounts: currentAccounts\r\n };\r\n } else {\r\n // Nothing changed\r\n return previousState;\r\n }\r\n};\r\n\r\n/**\r\n * MSAL context provider component. This must be rendered above any other components that use MSAL.\r\n */\r\nexport function MsalProvider({instance, children}: MsalProviderProps): React.ReactElement {\r\n useEffect(() => {\r\n instance.initializeWrapperLibrary(WrapperSKU.React, version);\r\n }, [instance]);\r\n // Create a logger instance for msal-react with the same options as PublicClientApplication\r\n const logger = useMemo(() => {\r\n return instance.getLogger().clone(SKU, version);\r\n }, [instance]);\r\n\r\n const [state, updateState] = useReducer(reducer, undefined, () => {\r\n // Lazy initialization of the initial state\r\n return {\r\n inProgress: InteractionStatus.Startup,\r\n accounts: instance.getAllAccounts()\r\n };\r\n });\r\n \r\n useEffect(() => {\r\n const callbackId = instance.addEventCallback((message: EventMessage) => {\r\n updateState({\r\n payload: {\r\n instance,\r\n logger,\r\n message\r\n }, \r\n type: MsalProviderActionType.EVENT\r\n });\r\n });\r\n logger.verbose(`MsalProvider - Registered event callback with id: ${callbackId}`);\r\n\r\n instance.initialize().then(() => {\r\n instance.handleRedirectPromise().catch(() => {\r\n // Errors should be handled by listening to the LOGIN_FAILURE event\r\n return;\r\n }).finally(() => {\r\n /*\r\n * If handleRedirectPromise returns a cached promise the necessary events may not be fired\r\n * This is a fallback to prevent inProgress from getting stuck in 'startup'\r\n */\r\n updateState({\r\n payload: {\r\n instance,\r\n logger\r\n },\r\n type: MsalProviderActionType.UNBLOCK_INPROGRESS \r\n });\r\n });\r\n });\r\n\r\n return () => {\r\n // Remove callback when component unmounts or accounts change\r\n if (callbackId) {\r\n logger.verbose(`MsalProvider - Removing event callback ${callbackId}`);\r\n instance.removeEventCallback(callbackId);\r\n }\r\n };\r\n }, [instance, logger]);\r\n\r\n const contextValue: IMsalContext = {\r\n instance,\r\n inProgress: state.inProgress,\r\n accounts: state.accounts,\r\n logger\r\n };\r\n\r\n return (\r\n <MsalContext.Provider value={contextValue}>\r\n {children}\r\n </MsalContext.Provider>\r\n );\r\n}\r\n\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { useContext } from \"react\";\r\nimport { IMsalContext, MsalContext } from \"../MsalContext\";\r\n\r\n/**\r\n * Returns Msal Context values\r\n */\r\nexport const useMsal = (): IMsalContext => useContext(MsalContext);\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { useState, useEffect } from \"react\";\r\nimport { useMsal } from \"./useMsal\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { AccountInfo, InteractionStatus } from \"@azure/msal-browser\";\r\nimport { getAccountByIdentifiers } from \"../utils/utilities\";\r\n\r\nfunction isAuthenticated(allAccounts: AccountInfo[], matchAccount?: AccountIdentifiers): boolean {\r\n if(matchAccount && (matchAccount.username || matchAccount.homeAccountId || matchAccount.localAccountId)) {\r\n return !!getAccountByIdentifiers(allAccounts, matchAccount);\r\n } \r\n\r\n return allAccounts.length > 0;\r\n}\r\n\r\n/**\r\n * Returns whether or not a user is currently signed-in. Optionally provide 1 or more accountIdentifiers to determine if a specific user is signed-in\r\n * @param matchAccount \r\n */\r\nexport function useIsAuthenticated(matchAccount?: AccountIdentifiers): boolean {\r\n const { accounts: allAccounts, inProgress } = useMsal();\r\n\r\n const [hasAuthenticated, setHasAuthenticated] = useState<boolean>(() => {\r\n if (inProgress === InteractionStatus.Startup) {\r\n return false;\r\n }\r\n return isAuthenticated(allAccounts, matchAccount);\r\n });\r\n\r\n useEffect(() => {\r\n setHasAuthenticated(isAuthenticated(allAccounts, matchAccount));\r\n }, [allAccounts, matchAccount]);\r\n\r\n return hasAuthenticated;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React, { PropsWithChildren, useMemo } from \"react\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { getChildrenOrFunction } from \"../utils/utilities\";\r\nimport { useMsal } from \"../hooks/useMsal\";\r\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\r\nimport { InteractionStatus } from \"@azure/msal-browser\";\r\n\r\nexport type AuthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;\r\n\r\n/**\r\n * Renders child components if user is authenticated\r\n * @param props \r\n */\r\nexport function AuthenticatedTemplate({ username, homeAccountId, localAccountId, children }: AuthenticatedTemplateProps): React.ReactElement|null {\r\n const context = useMsal();\r\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\r\n return {\r\n username,\r\n homeAccountId,\r\n localAccountId\r\n };\r\n }, [username, homeAccountId, localAccountId]);\r\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\r\n\r\n if (isAuthenticated && context.inProgress !== InteractionStatus.Startup) {\r\n return (\r\n <React.Fragment>\r\n {getChildrenOrFunction(children, context)}\r\n </React.Fragment>\r\n );\r\n }\r\n return null;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React, { PropsWithChildren, useMemo } from \"react\";\r\nimport { useMsal } from \"../hooks/useMsal\";\r\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\r\nimport { getChildrenOrFunction } from \"../utils/utilities\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { InteractionStatus } from \"@azure/msal-browser\";\r\n\r\nexport type UnauthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;\r\n\r\n/**\r\n * Renders child components if user is unauthenticated\r\n * @param props \r\n */\r\nexport function UnauthenticatedTemplate({ username, homeAccountId, localAccountId, children }: UnauthenticatedTemplateProps): React.ReactElement|null {\r\n const context = useMsal();\r\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\r\n return {\r\n username,\r\n homeAccountId,\r\n localAccountId\r\n };\r\n }, [username, homeAccountId, localAccountId]);\r\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\r\n\r\n if (!isAuthenticated && context.inProgress !== InteractionStatus.Startup && context.inProgress !== InteractionStatus.HandleRedirect) {\r\n return (\r\n <React.Fragment>\r\n {getChildrenOrFunction(children, context)}\r\n </React.Fragment>\r\n );\r\n }\r\n return null;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { useState, useEffect } from \"react\";\r\nimport { AccountInfo, IPublicClientApplication, AccountEntity } from \"@azure/msal-browser\";\r\nimport { useMsal } from \"./useMsal\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { getAccountByIdentifiers } from \"../utils/utilities\";\r\n\r\nfunction getAccount(instance: IPublicClientApplication, accountIdentifiers?: AccountIdentifiers): AccountInfo | null {\r\n if (!accountIdentifiers || (!accountIdentifiers.homeAccountId && !accountIdentifiers.localAccountId && !accountIdentifiers.username)) {\r\n // If no account identifiers are provided, return active account\r\n return instance.getActiveAccount();\r\n }\r\n\r\n return getAccountByIdentifiers(instance.getAllAccounts(), accountIdentifiers);\r\n}\r\n\r\n/**\r\n * Given 1 or more accountIdentifiers, returns the Account object if the user is signed-in\r\n * @param accountIdentifiers \r\n */\r\nexport function useAccount(accountIdentifiers?: AccountIdentifiers): AccountInfo | null {\r\n const { instance, inProgress, logger } = useMsal();\r\n\r\n const [account, setAccount] = useState<AccountInfo|null>(() => getAccount(instance, accountIdentifiers));\r\n\r\n useEffect(() => {\r\n setAccount((currentAccount: AccountInfo | null) => {\r\n const nextAccount = getAccount(instance, accountIdentifiers);\r\n if (!AccountEntity.accountInfoIsEqual(currentAccount, nextAccount, true)) {\r\n logger.info(\"useAccount - Updating account\");\r\n return nextAccount;\r\n }\r\n\r\n return currentAccount;\r\n });\r\n }, [inProgress, accountIdentifiers, instance, logger]);\r\n\r\n return account;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AuthError } from \"@azure/msal-browser\";\r\n\r\nexport const ReactAuthErrorMessage = {\r\n invalidInteractionType: {\r\n code: \"invalid_interaction_type\",\r\n desc: \"The provided interaction type is invalid.\"\r\n },\r\n unableToFallbackToInteraction: {\r\n code: \"unable_to_fallback_to_interaction\",\r\n desc: \"Interaction is required but another interaction is already in progress. Please try again when the current interaction is complete.\"\r\n }\r\n};\r\n\r\nexport class ReactAuthError extends AuthError {\r\n constructor(errorCode: string, errorMessage?: string) {\r\n super(errorCode, errorMessage);\r\n\r\n Object.setPrototypeOf(this, ReactAuthError.prototype);\r\n this.name = \"ReactAuthError\";\r\n }\r\n\r\n static createInvalidInteractionTypeError(): ReactAuthError {\r\n return new ReactAuthError(ReactAuthErrorMessage.invalidInteractionType.code, ReactAuthErrorMessage.invalidInteractionType.desc);\r\n }\r\n\r\n static createUnableToFallbackToInteractionError(): ReactAuthError {\r\n return new ReactAuthError(ReactAuthErrorMessage.unableToFallbackToInteraction.code, ReactAuthErrorMessage.unableToFallbackToInteraction.desc);\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { useCallback, useEffect, useState, useRef } from \"react\";\r\nimport { PopupRequest, RedirectRequest, SsoSilentRequest, InteractionType, AuthenticationResult, AuthError, EventMessage, EventType, InteractionStatus, SilentRequest, InteractionRequiredAuthError, OIDC_DEFAULT_SCOPES } from \"@azure/msal-browser\";\r\nimport { useIsAuthenticated } from \"./useIsAuthenticated\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { useMsal } from \"./useMsal\";\r\nimport { useAccount } from \"./useAccount\";\r\nimport { ReactAuthError } from \"../error/ReactAuthError\";\r\n\r\nexport type MsalAuthenticationResult = {\r\n login: (callbackInteractionType?: InteractionType | undefined, callbackRequest?: PopupRequest | RedirectRequest | SilentRequest) => Promise<AuthenticationResult | null>; \r\n acquireToken: (callbackInteractionType?: InteractionType | undefined, callbackRequest?: SilentRequest | undefined) => Promise<AuthenticationResult | null>;\r\n result: AuthenticationResult|null;\r\n error: AuthError|null;\r\n};\r\n\r\n/**\r\n * If a user is not currently signed in this hook invokes a login. Failed logins can be retried using the login callback returned.\r\n * If a user is currently signed in this hook attempts to acquire a token. Subsequent token requests can use the acquireToken callback returned.\r\n * Optionally provide a request object to be used in the login/acquireToken call.\r\n * Optionally provide a specific user that should be logged in.\r\n * @param interactionType \r\n * @param authenticationRequest \r\n * @param accountIdentifiers \r\n */\r\nexport function useMsalAuthentication(\r\n interactionType: InteractionType, \r\n authenticationRequest?: PopupRequest|RedirectRequest|SsoSilentRequest, \r\n accountIdentifiers?: AccountIdentifiers\r\n): MsalAuthenticationResult {\r\n const { instance, inProgress, logger } = useMsal();\r\n const isAuthenticated = useIsAuthenticated(accountIdentifiers);\r\n const account = useAccount(accountIdentifiers);\r\n const [[result, error], setResponse] = useState<[AuthenticationResult|null, AuthError|null]>([null, null]);\r\n\r\n // Used to prevent state updates after unmount\r\n const mounted = useRef(true);\r\n useEffect(() => {\r\n return () => {\r\n mounted.current = false;\r\n };\r\n },[]);\r\n\r\n // Boolean used to check if interaction is in progress in acquireTokenSilent fallback. Use Ref instead of state to prevent acquireToken function from being regenerated on each change to interactionInProgress value\r\n const interactionInProgress = useRef(inProgress !== InteractionStatus.None);\r\n useEffect(() => {\r\n interactionInProgress.current = inProgress !== InteractionStatus.None;\r\n }, [inProgress]);\r\n\r\n // Flag used to control when the hook calls login/acquireToken\r\n const shouldAcquireToken = useRef(true);\r\n useEffect(() => {\r\n if (!!error) {\r\n // Errors should be handled by consuming component\r\n shouldAcquireToken.current = false;\r\n return;\r\n }\r\n\r\n if (!!result) {\r\n // Token has already been acquired, consuming component/application is responsible for renewing\r\n shouldAcquireToken.current = false;\r\n return;\r\n }\r\n }, [error, result]);\r\n\r\n const login = useCallback(async (callbackInteractionType?: InteractionType, callbackRequest?: PopupRequest|RedirectRequest|SsoSilentRequest): Promise<AuthenticationResult|null> => {\r\n const loginType = callbackInteractionType || interactionType;\r\n const loginRequest = callbackRequest || authenticationRequest;\r\n switch (loginType) {\r\n case InteractionType.Popup:\r\n logger.verbose(\"useMsalAuthentication - Calling loginPopup\");\r\n return instance.loginPopup(loginRequest as PopupRequest);\r\n case InteractionType.Redirect:\r\n // This promise is not expected to resolve due to full frame redirect\r\n logger.verbose(\"useMsalAuthentication - Calling loginRedirect\");\r\n return instance.loginRedirect(loginRequest as RedirectRequest).then(null);\r\n case InteractionType.Silent:\r\n logger.verbose(\"useMsalAuthentication - Calling ssoSilent\");\r\n return instance.ssoSilent(loginRequest as SsoSilentRequest);\r\n default:\r\n throw ReactAuthError.createInvalidInteractionTypeError();\r\n }\r\n }, [instance, interactionType, authenticationRequest, logger]);\r\n\r\n const acquireToken = useCallback(async (callbackInteractionType?: InteractionType, callbackRequest?: SilentRequest): Promise<AuthenticationResult|null> => {\r\n const fallbackInteractionType = callbackInteractionType || interactionType;\r\n\r\n let tokenRequest: SilentRequest;\r\n\r\n if (callbackRequest) {\r\n logger.trace(\"useMsalAuthentication - acquireToken - Using request provided in the callback\");\r\n tokenRequest = {\r\n ...callbackRequest\r\n };\r\n } else if (authenticationRequest) {\r\n logger.trace(\"useMsalAuthentication - acquireToken - Using request provided in the hook\");\r\n tokenRequest = {\r\n ...authenticationRequest,\r\n scopes: authenticationRequest.scopes || OIDC_DEFAULT_SCOPES\r\n };\r\n } else {\r\n logger.trace(\"useMsalAuthentication - acquireToken - No request object provided, using default request.\");\r\n tokenRequest = {\r\n scopes: OIDC_DEFAULT_SCOPES\r\n };\r\n }\r\n \r\n if (!tokenRequest.account && account) {\r\n logger.trace(\"useMsalAuthentication - acquireToken - Attaching account to request\");\r\n tokenRequest.account = account;\r\n }\r\n\r\n const getToken = async (): Promise<AuthenticationResult|null> => {\r\n logger.verbose(\"useMsalAuthentication - Calling acquireTokenSilent\");\r\n return instance.acquireTokenSilent(tokenRequest).catch(async (e: AuthError) => {\r\n if (e instanceof InteractionRequiredAuthError) {\r\n if (!interactionInProgress.current) {\r\n logger.error(\"useMsalAuthentication - Interaction required, falling back to interaction\");\r\n return login(fallbackInteractionType, tokenRequest);\r\n } else {\r\n logger.error(\"useMsalAuthentication - Interaction required but is already in progress. Please try again, if needed, after interaction completes.\");\r\n throw ReactAuthError.createUnableToFallbackToInteractionError();\r\n }\r\n }\r\n\r\n throw e;\r\n });\r\n };\r\n\r\n return getToken().then((response: AuthenticationResult|null) => {\r\n if (mounted.current) {\r\n setResponse([response, null]);\r\n }\r\n return response;\r\n }).catch((e: AuthError) => {\r\n if (mounted.current) {\r\n setResponse([null, e]);\r\n }\r\n throw e;\r\n });\r\n }, [instance, interactionType, authenticationRequest, logger, account, login]);\r\n\r\n useEffect(() => {\r\n const callbackId = instance.addEventCallback((message: EventMessage) => {\r\n switch(message.eventType) {\r\n case EventType.LOGIN_SUCCESS:\r\n case EventType.SSO_SILENT_SUCCESS:\r\n if (message.payload) {\r\n setResponse([message.payload as AuthenticationResult, null]);\r\n }\r\n break;\r\n case EventType.LOGIN_FAILURE:\r\n case EventType.SSO_SILENT_FAILURE:\r\n if (message.error) {\r\n setResponse([null, message.error as AuthError]);\r\n }\r\n break;\r\n }\r\n });\r\n logger.verbose(`useMsalAuthentication - Registered event callback with id: ${callbackId}`);\r\n\r\n return () => {\r\n if (callbackId) {\r\n logger.verbose(`useMsalAuthentication - Removing event callback ${callbackId}`);\r\n instance.removeEventCallback(callbackId);\r\n }\r\n };\r\n }, [instance, logger]);\r\n\r\n useEffect(() => {\r\n if (shouldAcquireToken.current && inProgress === InteractionStatus.None) {\r\n shouldAcquireToken.current = false;\r\n if (!isAuthenticated) {\r\n logger.info(\"useMsalAuthentication - No user is authenticated, attempting to login\");\r\n login().catch(() => {\r\n // Errors are saved in state above\r\n return;\r\n });\r\n } else if (account) {\r\n logger.info(\"useMsalAuthentication - User is authenticated, attempting to acquire token\");\r\n acquireToken().catch(() => {\r\n // Errors are saved in state above\r\n return;\r\n });\r\n }\r\n }\r\n }, [isAuthenticated, account, inProgress, login, acquireToken, logger]);\r\n\r\n return { \r\n login, \r\n acquireToken, \r\n result, \r\n error\r\n };\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React, { PropsWithChildren, useMemo } from \"react\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { getChildrenOrFunction } from \"../utils/utilities\";\r\nimport { useMsal } from \"../hooks/useMsal\";\r\nimport { MsalAuthenticationResult, useMsalAuthentication } from \"../hooks/useMsalAuthentication\";\r\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\r\nimport { InteractionType, PopupRequest, RedirectRequest, SsoSilentRequest, InteractionStatus } from \"@azure/msal-browser\";\r\nimport { IMsalContext } from \"../MsalContext\";\r\n\r\nexport type MsalAuthenticationProps = PropsWithChildren<AccountIdentifiers & {\r\n interactionType: InteractionType;\r\n authenticationRequest?: PopupRequest|RedirectRequest|SsoSilentRequest;\r\n loadingComponent?: React.ElementType<IMsalContext>;\r\n errorComponent?: React.ElementType<MsalAuthenticationResult>;\r\n}>;\r\n\r\n/**\r\n * Attempts to authenticate user if not already authenticated, then renders child components\r\n * @param props\r\n */\r\nexport function MsalAuthenticationTemplate({ \r\n interactionType, \r\n username, \r\n homeAccountId, \r\n localAccountId,\r\n authenticationRequest, \r\n loadingComponent: LoadingComponent,\r\n errorComponent: ErrorComponent,\r\n children \r\n}: MsalAuthenticationProps): React.ReactElement|null {\r\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\r\n return {\r\n username,\r\n homeAccountId,\r\n localAccountId\r\n };\r\n }, [username, homeAccountId, localAccountId]);\r\n const context = useMsal();\r\n const msalAuthResult = useMsalAuthentication(interactionType, authenticationRequest, accountIdentifier);\r\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\r\n\r\n if (msalAuthResult.error && context.inProgress === InteractionStatus.None) {\r\n if (!!ErrorComponent) {\r\n return <ErrorComponent {...msalAuthResult} />;\r\n }\r\n\r\n throw msalAuthResult.error;\r\n }\r\n \r\n if (isAuthenticated) {\r\n return (\r\n <React.Fragment>\r\n {getChildrenOrFunction(children, msalAuthResult)}\r\n </React.Fragment>\r\n );\r\n } \r\n \r\n if (!!LoadingComponent && context.inProgress !== InteractionStatus.None) {\r\n return <LoadingComponent {...context} />;\r\n }\r\n\r\n return null;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React from \"react\";\r\nimport { IMsalContext } from \"../MsalContext\";\r\nimport { useMsal } from \"../hooks/useMsal\";\r\nimport { Subtract } from \"../utils/utilities\";\r\n\r\nexport type WithMsalProps = {\r\n msalContext: IMsalContext;\r\n};\r\n\r\n/**\r\n * Higher order component wraps provided component with msal by injecting msal context values into the component's props \r\n * @param Component \r\n */\r\nexport const withMsal = <P extends WithMsalProps>(Component: React.ComponentType<P>): React.FunctionComponent<Subtract<P,WithMsalProps>> => {\r\n const ComponentWithMsal: React.FunctionComponent<Subtract<P,WithMsalProps>> = props => {\r\n const msal = useMsal();\r\n return <Component {...(props as P)} msalContext={msal} />;\r\n };\r\n\r\n const componentName =\r\n Component.displayName || Component.name || \"Component\";\r\n ComponentWithMsal.displayName = `withMsal(${componentName})`;\r\n\r\n return ComponentWithMsal;\r\n};\r\n"],"names":["defaultMsalContext","instance","stubbedPublicClientApplication","inProgress","InteractionStatus","None","accounts","logger","Logger","MsalContext","React","MsalConsumer","Consumer","getChildrenOrFunction","children","args","accountArraysAreEqual","arrayA","arrayB","length","comparisonArray","every","elementA","elementB","shift","homeAccountId","localAccountId","username","getAccountByIdentifiers","allAccounts","accountIdentifiers","matchedAccounts","filter","accountObj","toLowerCase","name","version","MsalProviderActionType","reducer","previousState","action","type","payload","newInProgress","UNBLOCK_INPROGRESS","Startup","info","EVENT","message","status","EventMessageUtils","getInteractionStatusFromEvent","eventType","Error","currentAccounts","getAllAccounts","MsalProvider","useEffect","initializeWrapperLibrary","WrapperSKU","useMemo","getLogger","clone","SKU","state","updateState","useReducer","undefined","callbackId","addEventCallback","verbose","initialize","then","handleRedirectPromise","catch","finally","removeEventCallback","contextValue","Provider","value","useMsal","useContext","isAuthenticated","matchAccount","useIsAuthenticated","hasAuthenticated","setHasAuthenticated","useState","AuthenticatedTemplate","context","accountIdentifier","Fragment","UnauthenticatedTemplate","HandleRedirect","getAccount","getActiveAccount","useAccount","account","setAccount","currentAccount","nextAccount","AccountEntity","accountInfoIsEqual","ReactAuthErrorMessage","invalidInteractionType","code","desc","unableToFallbackToInteraction","ReactAuthError","AuthError","constructor","errorCode","errorMessage","Object","setPrototypeOf","prototype","createInvalidInteractionTypeError","createUnableToFallbackToInteractionError","useMsalAuthentication","interactionType","authenticationRequest","result","error","setResponse","mounted","useRef","current","interactionInProgress","shouldAcquireToken","login","useCallback","callbackInteractionType","callbackRequest","loginType","loginRequest","InteractionType","Popup","loginPopup","Redirect","loginRedirect","Silent","ssoSilent","acquireToken","fallbackInteractionType","tokenRequest","trace","scopes","OIDC_DEFAULT_SCOPES","getToken","acquireTokenSilent","e","InteractionRequiredAuthError","response","EventType","LOGIN_SUCCESS","SSO_SILENT_SUCCESS","LOGIN_FAILURE","SSO_SILENT_FAILURE","MsalAuthenticationTemplate","loadingComponent","LoadingComponent","errorComponent","ErrorComponent","msalAuthResult","withMsal","Component","ComponentWithMsal","props","msal","msalContext","componentName","displayName"],"mappings":";;;;;;;;;;AAAA;;;;AAeA;;;;;AAIA,MAAMA,kBAAkB,GAAiB;AACrCC,EAAAA,QAAQ,EAAEC,0CAD2B;AAErCC,EAAAA,UAAU,EAAEC,6BAAiB,CAACC,IAFO;AAGrCC,EAAAA,QAAQ,EAAE,EAH2B;AAIrCC,EA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