@azure/msal-node 1.17.3 → 1.18.0
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 +21 -21
- package/README.md +181 -181
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/config/Configuration.d.ts +2 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/msal-node.cjs.development.js +11 -4
- package/dist/msal-node.cjs.development.js.map +1 -1
- package/dist/msal-node.cjs.production.min.js +1 -1
- package/dist/msal-node.cjs.production.min.js.map +1 -1
- package/dist/msal-node.esm.js +11 -4
- package/dist/msal-node.esm.js.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/package.json +68 -68
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 Microsoft
|
|
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) 2020 Microsoft
|
|
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,181 +1,181 @@
|
|
|
1
|
-
# Microsoft Authentication Library for Node (msal-node)
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@azure/msal-node/)
|
|
4
|
-
[](https://nodei.co/npm/@azure/msal-node/)
|
|
5
|
-
[](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js)
|
|
6
|
-
|
|
7
|
-
| <a href="https://docs.microsoft.com/azure/active-directory/develop/guidedsetups/active-directory-javascriptspa" 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_node.html" target="_blank">Library Reference</a> |
|
|
8
|
-
| --- | --- | --- |
|
|
9
|
-
|
|
10
|
-
1. [About](#about)
|
|
11
|
-
1. [FAQ](#faq)
|
|
12
|
-
1. [Changelog](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/CHANGELOG.md)
|
|
13
|
-
1. [Prerequisites](#prerequisites)
|
|
14
|
-
1. [Installation](#installation)
|
|
15
|
-
1. [Node Version Support](#node-version-support)
|
|
16
|
-
1. [Usage](#usage)
|
|
17
|
-
1. [Samples](#samples)
|
|
18
|
-
1. [Build Library](#build-and-test)
|
|
19
|
-
1. [Security Reporting](#security-reporting)
|
|
20
|
-
1. [License](#license)
|
|
21
|
-
1. [Code of Conduct](#we-value-and-adhere-to-the-microsoft-open-source-code-of-conduct)
|
|
22
|
-
|
|
23
|
-
## About
|
|
24
|
-
|
|
25
|
-
MSAL Node enables 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).
|
|
26
|
-
|
|
27
|
-
### OAuth2.0 grant types supported:
|
|
28
|
-
|
|
29
|
-
The current version supports the following ways of acquiring tokens:
|
|
30
|
-
|
|
31
|
-
#### Public Client:
|
|
32
|
-
- [Authorization Code Grant](https://oauth.net/2/grant-types/authorization-code/) with [PKCE](https://oauth.net/2/pkce/)
|
|
33
|
-
- [Device Code Grant](https://oauth.net/2/grant-types/device-code/)
|
|
34
|
-
- [Refresh Token Grant](https://oauth.net/2/grant-types/refresh-token/)
|
|
35
|
-
- [Silent Flow](https://docs.microsoft.com/azure/active-directory/develop/msal-acquire-cache-tokens#acquiring-tokens-silently-from-the-cache)
|
|
36
|
-
- [Username and Password flow](https://docs.microsoft.com/azure/active-directory/develop/msal-authentication-flows#usernamepassword)
|
|
37
|
-
|
|
38
|
-
#### Confidential Client:
|
|
39
|
-
- [Authorization Code Grant](https://oauth.net/2/grant-types/authorization-code/) with a client credential
|
|
40
|
-
- [Refresh Token Grant](https://oauth.net/2/grant-types/refresh-token/)
|
|
41
|
-
- [Silent Flow](https://docs.microsoft.com/azure/active-directory/develop/msal-acquire-cache-tokens#acquiring-tokens-silently-from-the-cache)
|
|
42
|
-
- [Client Credential Grant](https://oauth.net/2/grant-types/client-credentials/)
|
|
43
|
-
- [On-behalf-of flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow)
|
|
44
|
-
- [Username and Password flow](https://docs.microsoft.com/azure/active-directory/develop/msal-authentication-flows#usernamepassword)
|
|
45
|
-
|
|
46
|
-
**[Coming Soon]** In the future we plan to add support for:
|
|
47
|
-
- [Integrated Windows Authentication flow](https://docs.microsoft.com/azure/active-directory/develop/msal-authentication-flows#integrated-windows-authentication)
|
|
48
|
-
|
|
49
|
-
More details on different grant types supported by Microsoft authentication libraries in general can be found [here](https://docs.microsoft.com/azure/active-directory/develop/msal-authentication-flows).
|
|
50
|
-
|
|
51
|
-
### Scenarios supported:
|
|
52
|
-
|
|
53
|
-
The scenarios supported with this library are:
|
|
54
|
-
- Desktop app that calls web APIs
|
|
55
|
-
- Web app that calls web APIs
|
|
56
|
-
- Web APIs that call web APIs
|
|
57
|
-
- Daemon apps
|
|
58
|
-
|
|
59
|
-
More details on scenarios and the authentication flows that map to each of them can be found [here](https://docs.microsoft.com/azure/active-directory/develop/authentication-flows-app-scenarios).
|
|
60
|
-
|
|
61
|
-
## FAQ
|
|
62
|
-
|
|
63
|
-
See [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/faq.md).
|
|
64
|
-
|
|
65
|
-
## Prerequisites
|
|
66
|
-
|
|
67
|
-
Before using `@azure/msal-node` you will need to register your app in the azure portal:
|
|
68
|
-
|
|
69
|
-
- [App registration](https://docs.microsoft.com/graph/auth-register-app-v2)
|
|
70
|
-
|
|
71
|
-
## Installation
|
|
72
|
-
|
|
73
|
-
### Via NPM:
|
|
74
|
-
```javascript
|
|
75
|
-
npm install @azure/msal-node
|
|
76
|
-
```
|
|
77
|
-
## Node Version Support
|
|
78
|
-
MSAL Node will follow the [Long Term Support (LTS) schedule of the Node.js project](https://nodejs.org/about/releases/). Our support plan is as follows.
|
|
79
|
-
|
|
80
|
-
Any major MSAL Node release:
|
|
81
|
-
- Will support stable (even-numbered) Maintenance LTS, Active LTS, and Current versions of Node
|
|
82
|
-
- Will drop support for any previously supported Node versions that have reached end of life
|
|
83
|
-
- Will not support prerelease/preview/pending versions until they are stable
|
|
84
|
-
|
|
85
|
-
| MSAL Node version | MSAL support status | Supported Node versions |
|
|
86
|
-
|-------------------|-------------------------|-------------------------|
|
|
87
|
-
| 1.x.x | Active development | 10, 12, 14, 16, 18 |
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
## Usage
|
|
91
|
-
|
|
92
|
-
### MSAL basics
|
|
93
|
-
- [Understand difference in between Public Client and Confidential Clients](https://docs.microsoft.com/azure/active-directory/develop/msal-client-applications)
|
|
94
|
-
- [Initialize a Public Client Application](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/initialize-public-client-application.md)
|
|
95
|
-
- [Initialize a Confidential Client Application](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/initialize-confidential-client-application.md)
|
|
96
|
-
- [Configuration](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/configuration.md)
|
|
97
|
-
- [Request](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-common/docs/request.md)
|
|
98
|
-
- [Response](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-common/docs/Response.md)
|
|
99
|
-
|
|
100
|
-
## Samples
|
|
101
|
-
There are multiple [samples](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples) included in the repository that use MSAL Node to acquire tokens. These samples are currently used for manual testing, and are not meant to be a reference of best practices, therefore use judgement and do not blindly copy this code to any production applications.
|
|
102
|
-
|
|
103
|
-
AAD samples:
|
|
104
|
-
|
|
105
|
-
- [auth-code](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/auth-code): Express app using OAuth2.0 authorization code flow.
|
|
106
|
-
- [auth-code-pkce](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/auth-code-pkce): Express app using OAuth2.0 authorization code flow with PKCE.
|
|
107
|
-
- [device-code](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/device-code): Command line app using OAuth 2.0 device code flow.
|
|
108
|
-
- [refresh-token](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/refresh-token): Command line app using OAuth 2.0 refresh flow.
|
|
109
|
-
- [silent-flow](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/silent-flow): Express app using OAuth2.0 authorization code flow to acquire a token and store in the token cache, and silent flow to use tokens in the token cache.
|
|
110
|
-
- [client-credentials](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/client-credentials): Daemon app using OAuth 2.0 client credential grant to acquire a token.
|
|
111
|
-
- [on-behalf-of](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/on-behalf-of): Web application using OAuth 2.0 auth code flow to acquire a token for a web API. The web API validates the token, and calls Microsoft Graph on behalf of the user who authenticated in the web application.
|
|
112
|
-
- [username-password](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/username-password): Web application using OAuth 2.0 resource owner password credentials (ROPC) flow to acquire a token for a web API.
|
|
113
|
-
- [ElectronTestApp](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/ElectronTestApp): Electron desktop application using OAuth 2.0 auth code with PKCE flow to acquire a token for a web API such as Microsoft Graph.
|
|
114
|
-
- [ExpressTestApp](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/ExpressTestApp): Express.js MVC web application using OAuth 2.0 auth code with PKCE flow to acquire a token for a web API such as Microsoft Graph.
|
|
115
|
-
- [Hybrid Spa Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-browser-samples/HybridSample): Sample demonstrating how to use `enableSpaAuthorizationCode` to perform SSO for applications that leverage server-side and client-side authentication using MSAL Browser and MSAL Node.
|
|
116
|
-
|
|
117
|
-
B2C samples:
|
|
118
|
-
|
|
119
|
-
- [b2c-user-flows](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/b2c-user-flows): Express app using OAuth2.0 authorization code flow.
|
|
120
|
-
- [ms-identity-b2c-javascript-nodejs-management](https://github.com/Azure-Samples/ms-identity-b2c-javascript-nodejs-management/tree/main/Chapter2): Command line app using OAuth 2.0 client credentials flow for performing user management operations on an Azure AD / Azure AD B2C tenant
|
|
121
|
-
|
|
122
|
-
Others:
|
|
123
|
-
|
|
124
|
-
- [msal-node-extensions](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/extensions/samples/msal-node-extensions): Uses authorization code flow to acquire tokens and the [msal-extensions](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/extensions/) library to write the MSAL in-memory token cache to disk.
|
|
125
|
-
|
|
126
|
-
## Build and Test
|
|
127
|
-
|
|
128
|
-
- If you don't have [lerna](https://github.com/lerna/lerna) installed, run `npm install -g lerna`
|
|
129
|
-
- Run `lerna bootstrap` from anywhere within `microsoft-authentication-library-for-js.git`.
|
|
130
|
-
- Navigate to `microsoft-authentication-library-for-js/lib/msal-common` and run `npm run build`
|
|
131
|
-
- Navigate to `microsoft-authentication-library-for-js/lib/msal-node` and run `npm run build`
|
|
132
|
-
|
|
133
|
-
```javascript
|
|
134
|
-
// to link msal-node and msal-common packages
|
|
135
|
-
lerna bootstrap
|
|
136
|
-
|
|
137
|
-
// Change to the msal-node package directory
|
|
138
|
-
cd lib/msal-common/
|
|
139
|
-
|
|
140
|
-
// To run build only for node package
|
|
141
|
-
npm run build
|
|
142
|
-
|
|
143
|
-
// Change to the msal-node package directory
|
|
144
|
-
cd lib/msal-node/
|
|
145
|
-
|
|
146
|
-
// To run build only for node package
|
|
147
|
-
npm run build
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Local Development
|
|
151
|
-
Below is a list of commands you will probably find useful:
|
|
152
|
-
|
|
153
|
-
#### `npm run build:modules:watch`
|
|
154
|
-
Runs the project in development/watch mode. Your project will be rebuilt upon changes. TSDX has a special logger for you convenience. Error messages are pretty printed and formatted for compatibility VS Code's Problems tab. The library will be rebuilt if you make edits.
|
|
155
|
-
|
|
156
|
-
#### `npm run build`
|
|
157
|
-
Bundles the package to the `dist` folder.
|
|
158
|
-
The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).
|
|
159
|
-
|
|
160
|
-
#### `lerna bootstrap`
|
|
161
|
-
If you are running the project in development/watch mode, or have made changes in `msal-common` and need them reflecting across the project, please run `lerna bootstrap` to link all the symbols. Please note that `npm install` will unlink all the code, hence it is advised to run `lerna bootstrap` post installation.
|
|
162
|
-
|
|
163
|
-
#### `npm run lint`
|
|
164
|
-
Runs eslint with Prettier
|
|
165
|
-
|
|
166
|
-
#### `npm test`, `npm run test:coverage`, `npm run test:watch`
|
|
167
|
-
Runs the test watcher (Jest) in an interactive mode.
|
|
168
|
-
By default, runs tests related to files changed since the last commit.
|
|
169
|
-
Generate code coverage by adding the flag --coverage. No additional setup needed. Jest can collect code coverage information from entire projects, including untested files.
|
|
170
|
-
|
|
171
|
-
## Security Reporting
|
|
172
|
-
|
|
173
|
-
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.
|
|
174
|
-
|
|
175
|
-
## License
|
|
176
|
-
|
|
177
|
-
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
|
|
178
|
-
|
|
179
|
-
## We Value and Adhere to the Microsoft Open Source Code of Conduct
|
|
180
|
-
|
|
181
|
-
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 Node (msal-node)
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@azure/msal-node/)
|
|
4
|
+
[](https://nodei.co/npm/@azure/msal-node/)
|
|
5
|
+
[](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js)
|
|
6
|
+
|
|
7
|
+
| <a href="https://docs.microsoft.com/azure/active-directory/develop/guidedsetups/active-directory-javascriptspa" 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_node.html" target="_blank">Library Reference</a> |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
|
|
10
|
+
1. [About](#about)
|
|
11
|
+
1. [FAQ](#faq)
|
|
12
|
+
1. [Changelog](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/CHANGELOG.md)
|
|
13
|
+
1. [Prerequisites](#prerequisites)
|
|
14
|
+
1. [Installation](#installation)
|
|
15
|
+
1. [Node Version Support](#node-version-support)
|
|
16
|
+
1. [Usage](#usage)
|
|
17
|
+
1. [Samples](#samples)
|
|
18
|
+
1. [Build Library](#build-and-test)
|
|
19
|
+
1. [Security Reporting](#security-reporting)
|
|
20
|
+
1. [License](#license)
|
|
21
|
+
1. [Code of Conduct](#we-value-and-adhere-to-the-microsoft-open-source-code-of-conduct)
|
|
22
|
+
|
|
23
|
+
## About
|
|
24
|
+
|
|
25
|
+
MSAL Node enables 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).
|
|
26
|
+
|
|
27
|
+
### OAuth2.0 grant types supported:
|
|
28
|
+
|
|
29
|
+
The current version supports the following ways of acquiring tokens:
|
|
30
|
+
|
|
31
|
+
#### Public Client:
|
|
32
|
+
- [Authorization Code Grant](https://oauth.net/2/grant-types/authorization-code/) with [PKCE](https://oauth.net/2/pkce/)
|
|
33
|
+
- [Device Code Grant](https://oauth.net/2/grant-types/device-code/)
|
|
34
|
+
- [Refresh Token Grant](https://oauth.net/2/grant-types/refresh-token/)
|
|
35
|
+
- [Silent Flow](https://docs.microsoft.com/azure/active-directory/develop/msal-acquire-cache-tokens#acquiring-tokens-silently-from-the-cache)
|
|
36
|
+
- [Username and Password flow](https://docs.microsoft.com/azure/active-directory/develop/msal-authentication-flows#usernamepassword)
|
|
37
|
+
|
|
38
|
+
#### Confidential Client:
|
|
39
|
+
- [Authorization Code Grant](https://oauth.net/2/grant-types/authorization-code/) with a client credential
|
|
40
|
+
- [Refresh Token Grant](https://oauth.net/2/grant-types/refresh-token/)
|
|
41
|
+
- [Silent Flow](https://docs.microsoft.com/azure/active-directory/develop/msal-acquire-cache-tokens#acquiring-tokens-silently-from-the-cache)
|
|
42
|
+
- [Client Credential Grant](https://oauth.net/2/grant-types/client-credentials/)
|
|
43
|
+
- [On-behalf-of flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow)
|
|
44
|
+
- [Username and Password flow](https://docs.microsoft.com/azure/active-directory/develop/msal-authentication-flows#usernamepassword)
|
|
45
|
+
|
|
46
|
+
**[Coming Soon]** In the future we plan to add support for:
|
|
47
|
+
- [Integrated Windows Authentication flow](https://docs.microsoft.com/azure/active-directory/develop/msal-authentication-flows#integrated-windows-authentication)
|
|
48
|
+
|
|
49
|
+
More details on different grant types supported by Microsoft authentication libraries in general can be found [here](https://docs.microsoft.com/azure/active-directory/develop/msal-authentication-flows).
|
|
50
|
+
|
|
51
|
+
### Scenarios supported:
|
|
52
|
+
|
|
53
|
+
The scenarios supported with this library are:
|
|
54
|
+
- Desktop app that calls web APIs
|
|
55
|
+
- Web app that calls web APIs
|
|
56
|
+
- Web APIs that call web APIs
|
|
57
|
+
- Daemon apps
|
|
58
|
+
|
|
59
|
+
More details on scenarios and the authentication flows that map to each of them can be found [here](https://docs.microsoft.com/azure/active-directory/develop/authentication-flows-app-scenarios).
|
|
60
|
+
|
|
61
|
+
## FAQ
|
|
62
|
+
|
|
63
|
+
See [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/faq.md).
|
|
64
|
+
|
|
65
|
+
## Prerequisites
|
|
66
|
+
|
|
67
|
+
Before using `@azure/msal-node` you will need to register your app in the azure portal:
|
|
68
|
+
|
|
69
|
+
- [App registration](https://docs.microsoft.com/graph/auth-register-app-v2)
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
|
|
73
|
+
### Via NPM:
|
|
74
|
+
```javascript
|
|
75
|
+
npm install @azure/msal-node
|
|
76
|
+
```
|
|
77
|
+
## Node Version Support
|
|
78
|
+
MSAL Node will follow the [Long Term Support (LTS) schedule of the Node.js project](https://nodejs.org/about/releases/). Our support plan is as follows.
|
|
79
|
+
|
|
80
|
+
Any major MSAL Node release:
|
|
81
|
+
- Will support stable (even-numbered) Maintenance LTS, Active LTS, and Current versions of Node
|
|
82
|
+
- Will drop support for any previously supported Node versions that have reached end of life
|
|
83
|
+
- Will not support prerelease/preview/pending versions until they are stable
|
|
84
|
+
|
|
85
|
+
| MSAL Node version | MSAL support status | Supported Node versions |
|
|
86
|
+
|-------------------|-------------------------|-------------------------|
|
|
87
|
+
| 1.x.x | Active development | 10, 12, 14, 16, 18 |
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## Usage
|
|
91
|
+
|
|
92
|
+
### MSAL basics
|
|
93
|
+
- [Understand difference in between Public Client and Confidential Clients](https://docs.microsoft.com/azure/active-directory/develop/msal-client-applications)
|
|
94
|
+
- [Initialize a Public Client Application](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/initialize-public-client-application.md)
|
|
95
|
+
- [Initialize a Confidential Client Application](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/initialize-confidential-client-application.md)
|
|
96
|
+
- [Configuration](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/configuration.md)
|
|
97
|
+
- [Request](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-common/docs/request.md)
|
|
98
|
+
- [Response](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-common/docs/Response.md)
|
|
99
|
+
|
|
100
|
+
## Samples
|
|
101
|
+
There are multiple [samples](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples) included in the repository that use MSAL Node to acquire tokens. These samples are currently used for manual testing, and are not meant to be a reference of best practices, therefore use judgement and do not blindly copy this code to any production applications.
|
|
102
|
+
|
|
103
|
+
AAD samples:
|
|
104
|
+
|
|
105
|
+
- [auth-code](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/auth-code): Express app using OAuth2.0 authorization code flow.
|
|
106
|
+
- [auth-code-pkce](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/auth-code-pkce): Express app using OAuth2.0 authorization code flow with PKCE.
|
|
107
|
+
- [device-code](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/device-code): Command line app using OAuth 2.0 device code flow.
|
|
108
|
+
- [refresh-token](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/refresh-token): Command line app using OAuth 2.0 refresh flow.
|
|
109
|
+
- [silent-flow](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/silent-flow): Express app using OAuth2.0 authorization code flow to acquire a token and store in the token cache, and silent flow to use tokens in the token cache.
|
|
110
|
+
- [client-credentials](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/client-credentials): Daemon app using OAuth 2.0 client credential grant to acquire a token.
|
|
111
|
+
- [on-behalf-of](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/on-behalf-of): Web application using OAuth 2.0 auth code flow to acquire a token for a web API. The web API validates the token, and calls Microsoft Graph on behalf of the user who authenticated in the web application.
|
|
112
|
+
- [username-password](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/username-password): Web application using OAuth 2.0 resource owner password credentials (ROPC) flow to acquire a token for a web API.
|
|
113
|
+
- [ElectronTestApp](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/ElectronTestApp): Electron desktop application using OAuth 2.0 auth code with PKCE flow to acquire a token for a web API such as Microsoft Graph.
|
|
114
|
+
- [ExpressTestApp](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/ExpressTestApp): Express.js MVC web application using OAuth 2.0 auth code with PKCE flow to acquire a token for a web API such as Microsoft Graph.
|
|
115
|
+
- [Hybrid Spa Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-browser-samples/HybridSample): Sample demonstrating how to use `enableSpaAuthorizationCode` to perform SSO for applications that leverage server-side and client-side authentication using MSAL Browser and MSAL Node.
|
|
116
|
+
|
|
117
|
+
B2C samples:
|
|
118
|
+
|
|
119
|
+
- [b2c-user-flows](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/b2c-user-flows): Express app using OAuth2.0 authorization code flow.
|
|
120
|
+
- [ms-identity-b2c-javascript-nodejs-management](https://github.com/Azure-Samples/ms-identity-b2c-javascript-nodejs-management/tree/main/Chapter2): Command line app using OAuth 2.0 client credentials flow for performing user management operations on an Azure AD / Azure AD B2C tenant
|
|
121
|
+
|
|
122
|
+
Others:
|
|
123
|
+
|
|
124
|
+
- [msal-node-extensions](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/extensions/samples/msal-node-extensions): Uses authorization code flow to acquire tokens and the [msal-extensions](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/extensions/) library to write the MSAL in-memory token cache to disk.
|
|
125
|
+
|
|
126
|
+
## Build and Test
|
|
127
|
+
|
|
128
|
+
- If you don't have [lerna](https://github.com/lerna/lerna) installed, run `npm install -g lerna`
|
|
129
|
+
- Run `lerna bootstrap` from anywhere within `microsoft-authentication-library-for-js.git`.
|
|
130
|
+
- Navigate to `microsoft-authentication-library-for-js/lib/msal-common` and run `npm run build`
|
|
131
|
+
- Navigate to `microsoft-authentication-library-for-js/lib/msal-node` and run `npm run build`
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
// to link msal-node and msal-common packages
|
|
135
|
+
lerna bootstrap
|
|
136
|
+
|
|
137
|
+
// Change to the msal-node package directory
|
|
138
|
+
cd lib/msal-common/
|
|
139
|
+
|
|
140
|
+
// To run build only for node package
|
|
141
|
+
npm run build
|
|
142
|
+
|
|
143
|
+
// Change to the msal-node package directory
|
|
144
|
+
cd lib/msal-node/
|
|
145
|
+
|
|
146
|
+
// To run build only for node package
|
|
147
|
+
npm run build
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Local Development
|
|
151
|
+
Below is a list of commands you will probably find useful:
|
|
152
|
+
|
|
153
|
+
#### `npm run build:modules:watch`
|
|
154
|
+
Runs the project in development/watch mode. Your project will be rebuilt upon changes. TSDX has a special logger for you convenience. Error messages are pretty printed and formatted for compatibility VS Code's Problems tab. The library will be rebuilt if you make edits.
|
|
155
|
+
|
|
156
|
+
#### `npm run build`
|
|
157
|
+
Bundles the package to the `dist` folder.
|
|
158
|
+
The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).
|
|
159
|
+
|
|
160
|
+
#### `lerna bootstrap`
|
|
161
|
+
If you are running the project in development/watch mode, or have made changes in `msal-common` and need them reflecting across the project, please run `lerna bootstrap` to link all the symbols. Please note that `npm install` will unlink all the code, hence it is advised to run `lerna bootstrap` post installation.
|
|
162
|
+
|
|
163
|
+
#### `npm run lint`
|
|
164
|
+
Runs eslint with Prettier
|
|
165
|
+
|
|
166
|
+
#### `npm test`, `npm run test:coverage`, `npm run test:watch`
|
|
167
|
+
Runs the test watcher (Jest) in an interactive mode.
|
|
168
|
+
By default, runs tests related to files changed since the last commit.
|
|
169
|
+
Generate code coverage by adding the flag --coverage. No additional setup needed. Jest can collect code coverage information from entire projects, including untested files.
|
|
170
|
+
|
|
171
|
+
## Security Reporting
|
|
172
|
+
|
|
173
|
+
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.
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
|
|
178
|
+
|
|
179
|
+
## We Value and Adhere to the Microsoft Open Source Code of Conduct
|
|
180
|
+
|
|
181
|
+
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientApplication.d.ts","sourceRoot":"","sources":["../src/client/ClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,mBAAmB,EAEnB,oBAAoB,EAGpB,eAAe,EAEf,MAAM,EACN,sBAAsB,EAYtB,wBAAwB,EAExB,iBAAiB,EACjB,wBAAwB,EAGZ,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAyB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAG7E;;;GAGG;AACH,8BAAsB,iBAAiB;IAEnC,SAAS,CAAC,QAAQ,C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AO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAyBtG;;;;;OAKG;IACH,SAAS,CAAC,gCAAgC,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,sBAAsB;IAWhI;;;;OAIG;YACW,eAAe;IAkB7B;;OAEG;IACH,UAAU,IAAI,IAAI;CAGrB"}
|
|
@@ -35,10 +35,12 @@ export declare type NodeAuthOptions = {
|
|
|
35
35
|
* Use this to configure the below cache configuration options:
|
|
36
36
|
*
|
|
37
37
|
* - cachePlugin - Plugin for reading and writing token cache to disk.
|
|
38
|
+
* - claimsBasedCachingEnabled - Flag to enable/disable claims based caching. Set to true by default.
|
|
38
39
|
* @public
|
|
39
40
|
*/
|
|
40
41
|
export declare type CacheOptions = {
|
|
41
42
|
cachePlugin?: ICachePlugin;
|
|
43
|
+
claimsBasedCachingEnabled?: boolean;
|
|
42
44
|
};
|
|
43
45
|
/**
|
|
44
46
|
* Use this to configure the below broker options:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Configuration.d.ts","sourceRoot":"","sources":["../src/config/Configuration.ts"],"names":[],"mappings":";AAKA,OAAO,EACH,aAAa,EACb,cAAc,EAEd,YAAY,EACZ,YAAY,EAGZ,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,oBAAY,eAAe,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE;QAChB,UAA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AAqB,CAAC,EAClC,IAAI,EACJ,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACZ,EAAE,aAAa,GAAG,iBAAiB,CAcnC"}
|
|
@@ -422,7 +422,9 @@ const DEFAULT_AUTH_OPTIONS = {
|
|
|
422
422
|
},
|
|
423
423
|
skipAuthorityMetadataCache: false
|
|
424
424
|
};
|
|
425
|
-
const DEFAULT_CACHE_OPTIONS = {
|
|
425
|
+
const DEFAULT_CACHE_OPTIONS = {
|
|
426
|
+
claimsBasedCachingEnabled: true
|
|
427
|
+
};
|
|
426
428
|
const DEFAULT_LOGGER_OPTIONS = {
|
|
427
429
|
loggerCallback: () => {
|
|
428
430
|
// allow users to not set logger call back
|
|
@@ -1636,7 +1638,7 @@ class TokenCache {
|
|
|
1636
1638
|
|
|
1637
1639
|
/* eslint-disable header/header */
|
|
1638
1640
|
const name = "@azure/msal-node";
|
|
1639
|
-
const version = "1.
|
|
1641
|
+
const version = "1.18.0";
|
|
1640
1642
|
|
|
1641
1643
|
/*
|
|
1642
1644
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1951,6 +1953,9 @@ class ClientApplication {
|
|
|
1951
1953
|
piiLoggingEnabled: this.config.system.loggerOptions.piiLoggingEnabled,
|
|
1952
1954
|
correlationId: requestCorrelationId
|
|
1953
1955
|
},
|
|
1956
|
+
cacheOptions: {
|
|
1957
|
+
claimsBasedCachingEnabled: this.config.cache.claimsBasedCachingEnabled
|
|
1958
|
+
},
|
|
1954
1959
|
cryptoInterface: this.cryptoProvider,
|
|
1955
1960
|
networkInterface: this.config.system.networkClient,
|
|
1956
1961
|
storageInterface: this.storage,
|
|
@@ -1988,8 +1993,10 @@ class ClientApplication {
|
|
|
1988
1993
|
this.logger.verbose("Authentication Scheme 'pop' is not supported yet, setting Authentication Scheme to 'Bearer' for request", authRequest.correlationId);
|
|
1989
1994
|
}
|
|
1990
1995
|
authRequest.authenticationScheme = msalCommon.AuthenticationScheme.BEARER;
|
|
1991
|
-
// Set requested claims hash if claims were requested
|
|
1992
|
-
if (
|
|
1996
|
+
// Set requested claims hash if claims-based caching is enabled and claims were requested
|
|
1997
|
+
if (this.config.cache.claimsBasedCachingEnabled && authRequest.claims &&
|
|
1998
|
+
// Checks for empty stringified object "{}" which doesn't qualify as requested claims
|
|
1999
|
+
!msalCommon.StringUtils.isEmptyObj(authRequest.claims)) {
|
|
1993
2000
|
authRequest.requestedClaimsHash = await this.cryptoProvider.hashString(authRequest.claims);
|
|
1994
2001
|
}
|
|
1995
2002
|
return {
|