@azure/msal-node-extensions 1.0.0-alpha.3 → 1.0.0-alpha.31
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/README.md +156 -5
- package/binding.gyp +11 -1
- package/dist/broker/NativeBrokerPlugin.d.ts +20 -0
- package/dist/error/NativeAuthError.d.ts +6 -0
- package/dist/error/PersistenceError.d.ts +28 -0
- package/dist/index.d.ts +4 -0
- package/dist/msal-node-extensions.cjs.development.js +949 -932
- package/dist/msal-node-extensions.cjs.development.js.map +1 -1
- package/dist/msal-node-extensions.cjs.production.min.js +1 -1
- package/dist/msal-node-extensions.cjs.production.min.js.map +1 -1
- package/dist/msal-node-extensions.esm.js +957 -947
- package/dist/msal-node-extensions.esm.js.map +1 -1
- package/dist/packageMetadata.d.ts +2 -0
- package/dist/persistence/BasePersistence.d.ts +5 -0
- package/dist/persistence/FilePersistence.d.ts +4 -2
- package/dist/persistence/FilePersistenceWithDataProtection.d.ts +3 -1
- package/dist/persistence/IPersistence.d.ts +3 -1
- package/dist/persistence/IPersistenceConfiguration.d.ts +10 -0
- package/dist/persistence/KeychainPersistence.d.ts +3 -1
- package/dist/persistence/LibSecretPersistence.d.ts +3 -1
- package/dist/persistence/PersistenceCachePlugin.d.ts +11 -7
- package/dist/persistence/PersistenceCreator.d.ts +5 -0
- package/dist/utils/Constants.d.ts +30 -0
- package/dist/utils/Environment.d.ts +16 -0
- package/package.json +28 -15
- package/src/{dpapi-addon/Dpapi.ts → Dpapi.ts} +12 -12
- package/src/broker/NativeBrokerPlugin.ts +418 -0
- package/src/dpapi-addon/dpapi_addon.h +2 -1
- package/src/dpapi-addon/dpapi_not_supported.cpp +4 -10
- package/src/dpapi-addon/dpapi_win.cpp +25 -33
- package/src/dpapi-addon/main.cpp +14 -16
- package/src/error/NativeAuthError.ts +19 -0
- package/src/error/PersistenceError.ts +101 -61
- package/src/index.ts +17 -8
- package/src/lock/CrossPlatformLock.ts +89 -89
- package/src/lock/CrossPlatformLockOptions.ts +15 -15
- package/src/packageMetadata.ts +3 -0
- package/src/persistence/BasePersistence.ts +43 -0
- package/src/persistence/FilePersistence.ts +140 -134
- package/src/persistence/FilePersistenceWithDataProtection.ts +92 -84
- package/src/persistence/IPersistence.ts +4 -2
- package/src/persistence/IPersistenceConfiguration.ts +17 -0
- package/src/persistence/KeychainPersistence.ts +89 -78
- package/src/persistence/LibSecretPersistence.ts +90 -79
- package/src/persistence/PersistenceCachePlugin.ts +40 -30
- package/src/persistence/PersistenceCreator.ts +78 -0
- package/src/utils/Constants.ts +67 -30
- package/src/utils/Environment.ts +101 -0
- package/CHANGELOG.json +0 -50
- package/changelog.md +0 -28
- /package/dist/{dpapi-addon/Dpapi.d.ts → Dpapi.d.ts} +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import path from "path";
|
|
7
|
+
import { Constants, Platform } from "./Constants";
|
|
8
|
+
import { PersistenceError } from "../error/PersistenceError";
|
|
9
|
+
import { StringUtils } from "@azure/msal-common";
|
|
10
|
+
|
|
11
|
+
export class Environment {
|
|
12
|
+
static get homeEnvVar(): string {
|
|
13
|
+
return this.getEnvironmentVariable(Constants.ENVIRONMENT.HOME);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static get lognameEnvVar(): string {
|
|
17
|
+
return this.getEnvironmentVariable(Constants.ENVIRONMENT.LOGNAME);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static get userEnvVar(): string {
|
|
21
|
+
return this.getEnvironmentVariable(Constants.ENVIRONMENT.USER);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static get lnameEnvVar(): string {
|
|
25
|
+
return this.getEnvironmentVariable(Constants.ENVIRONMENT.LNAME);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static get usernameEnvVar(): string {
|
|
29
|
+
return this.getEnvironmentVariable(Constants.ENVIRONMENT.USERNAME);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static getEnvironmentVariable(name: string): string {
|
|
33
|
+
return process.env[name];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static getEnvironmentPlatform(): string {
|
|
37
|
+
return process.platform;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static isWindowsPlatform(): boolean {
|
|
41
|
+
return this.getEnvironmentPlatform() === Platform.WINDOWS;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static isLinuxPlatform(): boolean {
|
|
45
|
+
return this.getEnvironmentPlatform() === Platform.LINUX;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static isMacPlatform(): boolean {
|
|
49
|
+
return this.getEnvironmentPlatform() === Platform.MACOS;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static isLinuxRootUser(): boolean {
|
|
53
|
+
return process.getuid() === Constants.LINUX_ROOT_USER_GUID;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static getUserRootDirectory(): string {
|
|
57
|
+
return !this.isWindowsPlatform ?
|
|
58
|
+
this.getUserHomeDirOnUnix() :
|
|
59
|
+
this.getUserHomeDirOnWindows();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static getUserHomeDirOnWindows(): string {
|
|
63
|
+
return this.getEnvironmentVariable(Constants.ENVIRONMENT.LOCAL_APPLICATION_DATA);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static getUserHomeDirOnUnix(): string | null {
|
|
67
|
+
if (this.isWindowsPlatform()) {
|
|
68
|
+
throw PersistenceError.createNotSupportedError(
|
|
69
|
+
"Getting the user home directory for unix is not supported in windows");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!StringUtils.isEmpty(this.homeEnvVar)) {
|
|
73
|
+
return this.homeEnvVar;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let username = null;
|
|
77
|
+
if (!StringUtils.isEmpty(this.lognameEnvVar)) {
|
|
78
|
+
username = this.lognameEnvVar;
|
|
79
|
+
} else if (!StringUtils.isEmpty(this.userEnvVar)) {
|
|
80
|
+
username = this.userEnvVar;
|
|
81
|
+
} else if (!StringUtils.isEmpty(this.lnameEnvVar)) {
|
|
82
|
+
username = this.lnameEnvVar;
|
|
83
|
+
} else if (!StringUtils.isEmpty(this.usernameEnvVar)) {
|
|
84
|
+
username = this.usernameEnvVar;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (this.isMacPlatform()) {
|
|
88
|
+
return !StringUtils.isEmpty(username) ? path.join("/Users", username) : null;
|
|
89
|
+
} else if (this.isLinuxPlatform()) {
|
|
90
|
+
if (this.isLinuxRootUser()) {
|
|
91
|
+
return "/root";
|
|
92
|
+
} else {
|
|
93
|
+
return !StringUtils.isEmpty(username) ? path.join("/home", username) : null;
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
throw PersistenceError.createNotSupportedError(
|
|
97
|
+
"Getting the user home directory for unix is not supported in windows");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
}
|
package/CHANGELOG.json
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@azure/msal-node-extensions",
|
|
3
|
-
"entries": [
|
|
4
|
-
{
|
|
5
|
-
"date": "Wed, 23 Sep 2020 21:13:48 GMT",
|
|
6
|
-
"tag": "@azure/msal-node-extensions_v1.0.0-alpha.3",
|
|
7
|
-
"version": "1.0.0-alpha.3",
|
|
8
|
-
"comments": {
|
|
9
|
-
"prerelease": [
|
|
10
|
-
{
|
|
11
|
-
"comment": "Update error message (#2265)",
|
|
12
|
-
"author": "sagonzal@microsoft.com",
|
|
13
|
-
"commit": "81d044a2a4640ebfa8b3bd80cb30cc2c602bbef1",
|
|
14
|
-
"package": "@azure/msal-node-extensions"
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"date": "Thu, 17 Sep 2020 23:16:22 GMT",
|
|
21
|
-
"tag": "@azure/msal-node-extensions_v1.0.0",
|
|
22
|
-
"version": "1.0.0-alpha.2",
|
|
23
|
-
"comments": {
|
|
24
|
-
"none": [
|
|
25
|
-
{
|
|
26
|
-
"comment": "Update msal-node-extensionst to use central eslint configuration",
|
|
27
|
-
"author": "janutter@microsoft.com",
|
|
28
|
-
"commit": "fc49c6f16b3f7a62a67d249107fc484272133305",
|
|
29
|
-
"package": "@azure/msal-node-extensions"
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"date": "Thu, 13 Aug 2020 02:20:48 GMT",
|
|
36
|
-
"tag": "@azure/msal-node-extensions_v1.0.0-alpha.2",
|
|
37
|
-
"version": "1.0.0-alpha.2",
|
|
38
|
-
"comments": {
|
|
39
|
-
"none": [
|
|
40
|
-
{
|
|
41
|
-
"comment": "updating files for automated release steps",
|
|
42
|
-
"author": "prkanher@microsoft.com",
|
|
43
|
-
"commit": "791409e7c9975218ae2b3a91e6a6a190b59474b1",
|
|
44
|
-
"package": "@azure/msal-node-extensions"
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
}
|
package/changelog.md
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# Change Log - @azure/msal-node-extensions
|
|
2
|
-
|
|
3
|
-
This log was last generated on Wed, 23 Sep 2020 21:13:48 GMT and should not be manually modified.
|
|
4
|
-
|
|
5
|
-
<!-- Start content -->
|
|
6
|
-
|
|
7
|
-
## 1.0.0-alpha.3
|
|
8
|
-
|
|
9
|
-
Wed, 23 Sep 2020 21:13:48 GMT
|
|
10
|
-
|
|
11
|
-
### Changes
|
|
12
|
-
|
|
13
|
-
- Update error message (#2265) (sagonzal@microsoft.com)
|
|
14
|
-
|
|
15
|
-
# 1.0.0-alpha.2
|
|
16
|
-
- Fix issue where binding.gyp was not being uploaded to npm
|
|
17
|
-
|
|
18
|
-
# 1.0.0-alpha.1
|
|
19
|
-
- Increment @azure/msal-common version to 1.1.0
|
|
20
|
-
|
|
21
|
-
# 1.0.0-alpha.0
|
|
22
|
-
|
|
23
|
-
- Extensions 1: Sets directory structure, adds Windows DPAPI Node addon (#1830)
|
|
24
|
-
- Extensions 2: Add cross process lock (#1831)
|
|
25
|
-
- Extensions 3: Add cache persistence plugin, persistence on Windows, Linux, and Mac (#1832)
|
|
26
|
-
- Extensions 4: Add sample (#1834)
|
|
27
|
-
- Extensions 5: Add documentation, add logger (#1835)
|
|
28
|
-
- Extensions 6: Add tests (#1849)
|
|
File without changes
|