@azure/msal-node-extensions 1.0.0-alpha.31 → 1.0.0-alpha.34

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.
Files changed (35) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +192 -192
  3. package/binding.gyp +39 -39
  4. package/dist/msal-node-extensions.cjs.development.js +4 -4
  5. package/dist/msal-node-extensions.cjs.development.js.map +1 -1
  6. package/dist/msal-node-extensions.cjs.production.min.js +1 -1
  7. package/dist/msal-node-extensions.cjs.production.min.js.map +1 -1
  8. package/dist/msal-node-extensions.esm.js +4 -4
  9. package/dist/msal-node-extensions.esm.js.map +1 -1
  10. package/dist/packageMetadata.d.ts +1 -1
  11. package/package.json +69 -66
  12. package/src/Dpapi.ts +12 -12
  13. package/src/broker/NativeBrokerPlugin.ts +418 -418
  14. package/src/dpapi-addon/dpapi_addon.h +7 -7
  15. package/src/dpapi-addon/dpapi_not_supported.cpp +13 -13
  16. package/src/dpapi-addon/dpapi_win.cpp +106 -106
  17. package/src/dpapi-addon/main.cpp +30 -30
  18. package/src/error/NativeAuthError.ts +19 -19
  19. package/src/error/PersistenceError.ts +101 -101
  20. package/src/index.ts +17 -17
  21. package/src/lock/CrossPlatformLock.ts +89 -89
  22. package/src/lock/CrossPlatformLockOptions.ts +15 -15
  23. package/src/packageMetadata.ts +3 -3
  24. package/src/persistence/BasePersistence.ts +43 -43
  25. package/src/persistence/DataProtectionScope.ts +20 -20
  26. package/src/persistence/FilePersistence.ts +140 -140
  27. package/src/persistence/FilePersistenceWithDataProtection.ts +92 -92
  28. package/src/persistence/IPersistence.ts +17 -17
  29. package/src/persistence/IPersistenceConfiguration.ts +17 -17
  30. package/src/persistence/KeychainPersistence.ts +89 -89
  31. package/src/persistence/LibSecretPersistence.ts +90 -90
  32. package/src/persistence/PersistenceCachePlugin.ts +106 -106
  33. package/src/persistence/PersistenceCreator.ts +78 -78
  34. package/src/utils/Constants.ts +67 -67
  35. package/src/utils/Environment.ts +101 -101
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) Microsoft Corporation.
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.
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,193 +1,193 @@
1
- # Microsoft Authentication Extensions for Node
2
-
3
- ![npm (scoped)](https://img.shields.io/npm/v/@azure/msal-node-extensions)
4
- ![npm](https://img.shields.io/npm/dw/@azure/msal-node-extensions)
5
-
6
- | <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>
7
- |--- | --- | --- | --- |
8
-
9
- 1. [About](#about)
10
- - [Goals](#goals)
11
- - [Non-Goals](#non-goals)
12
- 1. [FAQ](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/extensions/docs/faq.md)
13
- 1. [Changelog](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/extensions/msal-node-extensions/CHANGELOG.md)
14
- 1. [Prerequisites](#prerequisites)
15
- 1. [Installation](#installation)
16
- 1. [Usage](#usage)
17
- - [Getting Started](#getting-started)
18
- - [Security Boundary](#security-boundary)
19
- 1. [Build and Test](#build-and-test)
20
- - [Build package](#building-the-package-locally)
21
- - [Test package](#running-tests)
22
- 1. [Samples](#samples)
23
- 1. [Security Reporting](#security-reporting)
24
- 1. [License](#license)
25
- 1. [Contributing](#contributing)
26
- 1. [Code of Conduct](#we-value-and-adhere-to-the-microsoft-open-source-code-of-conduct)
27
-
28
- ## About
29
- The Microsoft Authentication Extensions for Node offers secure mechanisms for client applications to perform cross-platform token cache serialization and persistence. It gives additional support to the Microsoft Authentication Library for Node (MSAL).
30
-
31
- [MSAL Node](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-node) supports an in-memory cache by default and provides the ICachePlugin interface to perform cache serialization, but does not provide a default way of storing the token cache to disk. Microsoft authentication extensions for node is default implementation for persisting cache to disk across different platforms.
32
-
33
- Supported platforms are Windows, Mac and Linux:
34
-
35
- - Windows - DPAPI is used for encryption.
36
- - MAC - The MAC KeyChain is used.
37
- - Linux - LibSecret is used for storing to "Secret Service".
38
-
39
- > Note: It is recommended to use this library for cache persistence support for Public client applications such as Desktop apps only. In web applications, this may lead to scale and performance issues. Web applications are recommended to persist the cache in session.
40
-
41
- ### Goals
42
- * Provide a robust, secure and configurable token cache persistence implementation across Windows, Mac and Linux for public client applications (rich clients, CLI applications etc.)
43
- * Token cache storage can be accessed by multiple processes concurrently.
44
-
45
- ### Non Goals
46
- * This implementation is not suitable for web app / web api scenarios, where storing the cache should be done in memory, Redis, Sql Server etc. Have a look at the [web samples](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples) for server-side implementations.
47
-
48
- ## Prerequisites
49
-
50
- The extensions contain prebuild binaries.
51
- [node-gyp](https://github.com/nodejs/node-gyp) is used to compile addons for accessing system APIs. Installation requirements are listed on the [node-gyp README](https://github.com/nodejs/node-gyp#installation)
52
-
53
- On linux, the library uses `libsecret` so you may need to install it. Depending on your distribution, you will need to run the following command:
54
-
55
- - Debian/Ubuntu: `sudo apt-get install libsecret-1-dev`
56
- - Red Hat-based: `sudo yum install libsecret-devel`
57
- - Arch Linux: sudo `pacman -S libsecret`
58
-
59
- ## Installation
60
-
61
- The `msal-node-extensions` package is available on NPM.
62
-
63
- ```bash
64
- npm i @azure/msal-node-extensions --save
65
- ```
66
- ## Usage
67
- ### Getting started
68
- Here is a code snippet on how to configure the token cache.
69
-
70
- ```js
71
- const {
72
- DataProtectionScope,
73
- Environment,
74
- PersistenceCreator,
75
- PersistenceCachePlugin,
76
- } = require("@azure/msal-node-extensions");
77
-
78
- // You can use the helper functions provided through the Environment class to construct your cache path
79
- // The helper functions provide consistent implementations across Windows, Mac and Linux.
80
- const cachePath = path.join(Environment.getUserRootDirectory(), "./cache.json");
81
-
82
- const persistenceConfiguration = {
83
- cachePath,
84
- dataProtectionScope: DataProtectionScope.CurrentUser,
85
- serviceName: "<SERVICE-NAME>",
86
- accountName: "<ACCOUNT-NAME>",
87
- usePlaintextFileOnLinux: false,
88
- }
89
-
90
- // The PersistenceCreator obfuscates a lot of the complexity by doing the following actions for you :-
91
- // 1. Detects the environment the application is running on and initializes the right persistence instance for the environment.
92
- // 2. Performs persistence validation for you.
93
- // 3. Performs any fallbacks if necessary.
94
- PersistenceCreator
95
- .createPersistence(persistenceConfiguration)
96
- .then(async (persistence) => {
97
- const publicClientConfig = {
98
- auth: {
99
- clientId: "<CLIENT-ID>",
100
- authority: "<AUTHORITY>",
101
- },
102
-
103
- // This hooks up the cross-platform cache into MSAL
104
- cache: {
105
- cachePlugin: new PersistenceCachePlugin(persistence)
106
- }
107
- };
108
-
109
- const pca = new msal.PublicClientApplication(publicClientConfig);
110
-
111
- // Use the public client application as required...
112
- });
113
- ```
114
-
115
- All the arguments for the persistence configuration are explained below:
116
- | Field Name | Description | Required For |
117
- | ---------- | ----------- | ------------ |
118
- | cachePath | This is the path to the lock file the library uses to synchronize the reads and the writes | Windows, Mac and Linux |
119
- | dataProtectionScope | Specifies the scope of the data protection on Windows either the current user or the local machine. | Windows |
120
- | serviceName | This specifies the service name to be used on Mac and/or Linux | Mac and Linux |
121
- | accountName | This specifies the account name to be used on Mac and/or Linux | Mac and Linux |
122
- | usePlaintextFileOnLinux | This is a flag to default to plain text on linux if libsecret fails. Defaults to `false` | Linux |
123
-
124
- ### Security boundary
125
- On Windows and Linux, the token cache is scoped to the user session, i.e. all applications running on behalf of the user can access the cache. Mac offers a more restricted scope, ensuring that only the application that created the cache can access it, and prompting the user if others apps want access.
126
-
127
- ## Build and Test
128
-
129
- If you intend to contribute to the library visit the [`contributing section`](#contributing) for even more information on how.
130
-
131
- ### Building the package locally
132
-
133
- To build the `@azure/msal-node-extensions` library, you can do the following:
134
-
135
- ```bash
136
- // Install dev dependencies from root of repo
137
- npm install
138
- // Change to the msal-node-extensions package directory
139
- cd extensions/msal-node-extensions
140
- // To run build only for node-extensions package
141
- npm run build
142
- ```
143
-
144
- To build both the `@azure/msal-node-extensions` library and `@azure/msal-common` libraries, you can do the following:
145
-
146
- ```bash
147
- // Install dev dependencies from root of repo
148
- npm install
149
- // Change to the msal-react package directory
150
- cd lib/msal-node-extensions/
151
- // To run build for the common package
152
- npm run build:common
153
- // To run build for the msal-node-extensions package
154
- npm run build
155
- ```
156
-
157
- ### Running Tests
158
-
159
- `@azure/msal-node-extensions` uses [jest](https://jestjs.io/) to run unit tests and coverage.
160
-
161
- ```bash
162
- // To run tests
163
- npm test
164
- ```
165
-
166
- ## Samples
167
- Have a look at a [simple auth-code app](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/extensions/samples/msal-node-extensions) using this token cache. We use this for testing on Windows, Mac and Linux.
168
-
169
- ## Security Reporting
170
-
171
- 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.
172
-
173
- ## License
174
-
175
- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
176
-
177
- ## Contributing
178
-
179
- This project welcomes contributions and suggestions. Most contributions require you to agree to a
180
- Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
181
- the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
182
-
183
- When you submit a pull request, a CLA bot will automatically determine whether you need to provide
184
- a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
185
- provided by the bot. You will only need to do this once across all repos using our CLA.
186
-
187
- This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
188
- For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
189
- contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
190
-
191
- ## We Value and Adhere to the Microsoft Open Source Code of Conduct
192
-
1
+ # Microsoft Authentication Extensions for Node
2
+
3
+ ![npm (scoped)](https://img.shields.io/npm/v/@azure/msal-node-extensions)
4
+ ![npm](https://img.shields.io/npm/dw/@azure/msal-node-extensions)
5
+
6
+ | <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>
7
+ |--- | --- | --- | --- |
8
+
9
+ 1. [About](#about)
10
+ - [Goals](#goals)
11
+ - [Non-Goals](#non-goals)
12
+ 1. [FAQ](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/extensions/docs/faq.md)
13
+ 1. [Changelog](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/extensions/msal-node-extensions/CHANGELOG.md)
14
+ 1. [Prerequisites](#prerequisites)
15
+ 1. [Installation](#installation)
16
+ 1. [Usage](#usage)
17
+ - [Getting Started](#getting-started)
18
+ - [Security Boundary](#security-boundary)
19
+ 1. [Build and Test](#build-and-test)
20
+ - [Build package](#building-the-package-locally)
21
+ - [Test package](#running-tests)
22
+ 1. [Samples](#samples)
23
+ 1. [Security Reporting](#security-reporting)
24
+ 1. [License](#license)
25
+ 1. [Contributing](#contributing)
26
+ 1. [Code of Conduct](#we-value-and-adhere-to-the-microsoft-open-source-code-of-conduct)
27
+
28
+ ## About
29
+ The Microsoft Authentication Extensions for Node offers secure mechanisms for client applications to perform cross-platform token cache serialization and persistence. It gives additional support to the Microsoft Authentication Library for Node (MSAL).
30
+
31
+ [MSAL Node](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-node) supports an in-memory cache by default and provides the ICachePlugin interface to perform cache serialization, but does not provide a default way of storing the token cache to disk. Microsoft authentication extensions for node is default implementation for persisting cache to disk across different platforms.
32
+
33
+ Supported platforms are Windows, Mac and Linux:
34
+
35
+ - Windows - DPAPI is used for encryption.
36
+ - MAC - The MAC KeyChain is used.
37
+ - Linux - LibSecret is used for storing to "Secret Service".
38
+
39
+ > Note: It is recommended to use this library for cache persistence support for Public client applications such as Desktop apps only. In web applications, this may lead to scale and performance issues. Web applications are recommended to persist the cache in session.
40
+
41
+ ### Goals
42
+ * Provide a robust, secure and configurable token cache persistence implementation across Windows, Mac and Linux for public client applications (rich clients, CLI applications etc.)
43
+ * Token cache storage can be accessed by multiple processes concurrently.
44
+
45
+ ### Non Goals
46
+ * This implementation is not suitable for web app / web api scenarios, where storing the cache should be done in memory, Redis, Sql Server etc. Have a look at the [web samples](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples) for server-side implementations.
47
+
48
+ ## Prerequisites
49
+
50
+ The extensions contain prebuild binaries.
51
+ [node-gyp](https://github.com/nodejs/node-gyp) is used to compile addons for accessing system APIs. Installation requirements are listed on the [node-gyp README](https://github.com/nodejs/node-gyp#installation)
52
+
53
+ On linux, the library uses `libsecret` so you may need to install it. Depending on your distribution, you will need to run the following command:
54
+
55
+ - Debian/Ubuntu: `sudo apt-get install libsecret-1-dev`
56
+ - Red Hat-based: `sudo yum install libsecret-devel`
57
+ - Arch Linux: sudo `pacman -S libsecret`
58
+
59
+ ## Installation
60
+
61
+ The `msal-node-extensions` package is available on NPM.
62
+
63
+ ```bash
64
+ npm i @azure/msal-node-extensions --save
65
+ ```
66
+ ## Usage
67
+ ### Getting started
68
+ Here is a code snippet on how to configure the token cache.
69
+
70
+ ```js
71
+ const {
72
+ DataProtectionScope,
73
+ Environment,
74
+ PersistenceCreator,
75
+ PersistenceCachePlugin,
76
+ } = require("@azure/msal-node-extensions");
77
+
78
+ // You can use the helper functions provided through the Environment class to construct your cache path
79
+ // The helper functions provide consistent implementations across Windows, Mac and Linux.
80
+ const cachePath = path.join(Environment.getUserRootDirectory(), "./cache.json");
81
+
82
+ const persistenceConfiguration = {
83
+ cachePath,
84
+ dataProtectionScope: DataProtectionScope.CurrentUser,
85
+ serviceName: "<SERVICE-NAME>",
86
+ accountName: "<ACCOUNT-NAME>",
87
+ usePlaintextFileOnLinux: false,
88
+ }
89
+
90
+ // The PersistenceCreator obfuscates a lot of the complexity by doing the following actions for you :-
91
+ // 1. Detects the environment the application is running on and initializes the right persistence instance for the environment.
92
+ // 2. Performs persistence validation for you.
93
+ // 3. Performs any fallbacks if necessary.
94
+ PersistenceCreator
95
+ .createPersistence(persistenceConfiguration)
96
+ .then(async (persistence) => {
97
+ const publicClientConfig = {
98
+ auth: {
99
+ clientId: "<CLIENT-ID>",
100
+ authority: "<AUTHORITY>",
101
+ },
102
+
103
+ // This hooks up the cross-platform cache into MSAL
104
+ cache: {
105
+ cachePlugin: new PersistenceCachePlugin(persistence)
106
+ }
107
+ };
108
+
109
+ const pca = new msal.PublicClientApplication(publicClientConfig);
110
+
111
+ // Use the public client application as required...
112
+ });
113
+ ```
114
+
115
+ All the arguments for the persistence configuration are explained below:
116
+ | Field Name | Description | Required For |
117
+ | ---------- | ----------- | ------------ |
118
+ | cachePath | This is the path to the lock file the library uses to synchronize the reads and the writes | Windows, Mac and Linux |
119
+ | dataProtectionScope | Specifies the scope of the data protection on Windows either the current user or the local machine. | Windows |
120
+ | serviceName | This specifies the service name to be used on Mac and/or Linux | Mac and Linux |
121
+ | accountName | This specifies the account name to be used on Mac and/or Linux | Mac and Linux |
122
+ | usePlaintextFileOnLinux | This is a flag to default to plain text on linux if libsecret fails. Defaults to `false` | Linux |
123
+
124
+ ### Security boundary
125
+ On Windows and Linux, the token cache is scoped to the user session, i.e. all applications running on behalf of the user can access the cache. Mac offers a more restricted scope, ensuring that only the application that created the cache can access it, and prompting the user if others apps want access.
126
+
127
+ ## Build and Test
128
+
129
+ If you intend to contribute to the library visit the [`contributing section`](#contributing) for even more information on how.
130
+
131
+ ### Building the package locally
132
+
133
+ To build the `@azure/msal-node-extensions` library, you can do the following:
134
+
135
+ ```bash
136
+ // Install dev dependencies from root of repo
137
+ npm install
138
+ // Change to the msal-node-extensions package directory
139
+ cd extensions/msal-node-extensions
140
+ // To run build only for node-extensions package
141
+ npm run build
142
+ ```
143
+
144
+ To build both the `@azure/msal-node-extensions` library and `@azure/msal-common` libraries, you can do the following:
145
+
146
+ ```bash
147
+ // Install dev dependencies from root of repo
148
+ npm install
149
+ // Change to the msal-react package directory
150
+ cd lib/msal-node-extensions/
151
+ // To run build for the common package
152
+ npm run build:common
153
+ // To run build for the msal-node-extensions package
154
+ npm run build
155
+ ```
156
+
157
+ ### Running Tests
158
+
159
+ `@azure/msal-node-extensions` uses [jest](https://jestjs.io/) to run unit tests and coverage.
160
+
161
+ ```bash
162
+ // To run tests
163
+ npm test
164
+ ```
165
+
166
+ ## Samples
167
+ Have a look at a [simple auth-code app](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/extensions/samples/msal-node-extensions) using this token cache. We use this for testing on Windows, Mac and Linux.
168
+
169
+ ## Security Reporting
170
+
171
+ 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.
172
+
173
+ ## License
174
+
175
+ Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
176
+
177
+ ## Contributing
178
+
179
+ This project welcomes contributions and suggestions. Most contributions require you to agree to a
180
+ Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
181
+ the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
182
+
183
+ When you submit a pull request, a CLA bot will automatically determine whether you need to provide
184
+ a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
185
+ provided by the bot. You will only need to do this once across all repos using our CLA.
186
+
187
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
188
+ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
189
+ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
190
+
191
+ ## We Value and Adhere to the Microsoft Open Source Code of Conduct
192
+
193
193
  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.
package/binding.gyp CHANGED
@@ -1,39 +1,39 @@
1
- {
2
- "targets": [
3
- {
4
- 'target_name': 'dpapi',
5
- 'cflags!': [ '-fno-exceptions' ],
6
- 'cflags_cc!': [ '-fno-exceptions' ],
7
- 'xcode_settings': { 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
8
- 'CLANG_CXX_LIBRARY': 'libc++',
9
- 'MACOSX_DEPLOYMENT_TARGET': '10.7',
10
- },
11
- 'msvs_settings': {
12
- 'VCCLCompilerTool': { 'ExceptionHandling': 1 },
13
- },
14
- 'version': '0.1.0',
15
- 'sources': [
16
- 'src/dpapi-addon/main.cpp',
17
- 'src/dpapi-addon/dpapi_addon.h'
18
- ],
19
- 'include_dirs': [
20
- '<!(node -p "require(\'node-addon-api\').include_dir")',
21
-
22
- "include"
23
- ],
24
- 'conditions': [
25
- ['OS=="win"', {
26
- 'sources': [
27
- 'src/dpapi-addon/dpapi_win.cpp',
28
- ],
29
- 'libraries': [
30
- '-lcrypt32.lib'
31
- ],
32
- }],
33
- ['OS not in ["win"]', {
34
- 'sources': [ 'src/dpapi-addon/dpapi_not_supported.ccp' ]
35
- }]
36
- ]
37
- }
38
- ]
39
- }
1
+ {
2
+ "targets": [
3
+ {
4
+ 'target_name': 'dpapi',
5
+ 'cflags!': [ '-fno-exceptions' ],
6
+ 'cflags_cc!': [ '-fno-exceptions' ],
7
+ 'xcode_settings': { 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
8
+ 'CLANG_CXX_LIBRARY': 'libc++',
9
+ 'MACOSX_DEPLOYMENT_TARGET': '10.7',
10
+ },
11
+ 'msvs_settings': {
12
+ 'VCCLCompilerTool': { 'ExceptionHandling': 1 },
13
+ },
14
+ 'version': '0.1.0',
15
+ 'sources': [
16
+ 'src/dpapi-addon/main.cpp',
17
+ 'src/dpapi-addon/dpapi_addon.h'
18
+ ],
19
+ 'include_dirs': [
20
+ '<!(node -p "require(\'node-addon-api\').include_dir")',
21
+
22
+ "include"
23
+ ],
24
+ 'conditions': [
25
+ ['OS=="win"', {
26
+ 'sources': [
27
+ 'src/dpapi-addon/dpapi_win.cpp',
28
+ ],
29
+ 'libraries': [
30
+ '-lcrypt32.lib'
31
+ ],
32
+ }],
33
+ ['OS not in ["win"]', {
34
+ 'sources': [ 'src/dpapi-addon/dpapi_not_supported.ccp' ]
35
+ }]
36
+ ]
37
+ }
38
+ ]
39
+ }
@@ -320,7 +320,7 @@ class BasePersistence {
320
320
  await persistenceValidator.save(Constants.PERSISTENCE_TEST_DATA);
321
321
  const retrievedDummyData = await persistenceValidator.load();
322
322
  if (!retrievedDummyData) {
323
- throw PersistenceError.createCachePersistenceError("Persistence check failed. Data was written but it could not be read. " + "Possible cause: on Linux, LibSecret is installed but D-Bus isn't running \
323
+ throw PersistenceError.createCachePersistenceError("Persistence check failed. Data was written but it could not be read. " + "Possible cause: on Linux, LibSecret is installed but D-Bus isn't running \
324
324
  because it cannot be started over SSH.");
325
325
  }
326
326
  if (retrievedDummyData !== Constants.PERSISTENCE_TEST_DATA) {
@@ -788,7 +788,7 @@ class NativeAuthError extends msalCommon.AuthError {
788
788
 
789
789
  /* eslint-disable header/header */
790
790
  const name = "@azure/msal-node-extensions";
791
- const version = "1.0.0-alpha.31";
791
+ const version = "1.0.0-alpha.34";
792
792
 
793
793
  /*
794
794
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1084,7 +1084,7 @@ class NativeBrokerPlugin {
1084
1084
  }
1085
1085
  getAuthenticationResult(request, authResult) {
1086
1086
  this.logger.trace("NativeBrokerPlugin - getAuthenticationResult called", request.correlationId);
1087
- let fromCache;
1087
+ let fromCache = false;
1088
1088
  try {
1089
1089
  const telemetryJSON = JSON.parse(authResult.telemetryData);
1090
1090
  fromCache = !!telemetryJSON["is_cache"];
@@ -1108,7 +1108,7 @@ class NativeBrokerPlugin {
1108
1108
  idTokenClaims: idTokenClaims,
1109
1109
  accessToken: authResult.accessToken,
1110
1110
  fromCache: fromCache,
1111
- expiresOn: new Date(authResult.expiresOn * 1000),
1111
+ expiresOn: new Date(authResult.expiresOn),
1112
1112
  tokenType: authResult.isPopAuthorization ? msalCommon.AuthenticationScheme.POP : msalCommon.AuthenticationScheme.BEARER,
1113
1113
  correlationId: request.correlationId,
1114
1114
  fromNativeBroker: true