@azure/msal-node 2.12.0 → 2.13.1
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/dist/cache/ITokenCache.d.ts +15 -15
- package/dist/cache/NodeStorage.cjs +423 -423
- package/dist/cache/NodeStorage.d.ts +193 -193
- package/dist/cache/NodeStorage.mjs +423 -423
- package/dist/cache/TokenCache.cjs +265 -265
- package/dist/cache/TokenCache.d.ts +90 -90
- package/dist/cache/TokenCache.mjs +265 -265
- package/dist/cache/distributed/DistributedCachePlugin.cjs +26 -26
- package/dist/cache/distributed/DistributedCachePlugin.d.ts +10 -10
- package/dist/cache/distributed/DistributedCachePlugin.mjs +26 -26
- package/dist/cache/distributed/ICacheClient.d.ts +17 -17
- package/dist/cache/distributed/IPartitionManager.d.ts +28 -28
- package/dist/cache/serializer/Deserializer.cjs +167 -167
- package/dist/cache/serializer/Deserializer.d.ts +42 -42
- package/dist/cache/serializer/Deserializer.mjs +167 -167
- package/dist/cache/serializer/Serializer.cjs +137 -137
- package/dist/cache/serializer/Serializer.d.ts +39 -39
- package/dist/cache/serializer/Serializer.mjs +137 -137
- package/dist/cache/serializer/SerializerTypes.d.ts +102 -102
- package/dist/client/ClientApplication.cjs +334 -334
- package/dist/client/ClientApplication.d.ts +143 -143
- package/dist/client/ClientApplication.mjs +334 -334
- package/dist/client/ClientAssertion.cjs +143 -143
- package/dist/client/ClientAssertion.d.ts +55 -55
- package/dist/client/ClientAssertion.mjs +143 -143
- package/dist/client/ClientCredentialClient.cjs +194 -194
- package/dist/client/ClientCredentialClient.d.ts +33 -33
- package/dist/client/ClientCredentialClient.mjs +194 -194
- package/dist/client/ConfidentialClientApplication.cjs +169 -169
- package/dist/client/ConfidentialClientApplication.cjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.d.ts +58 -58
- package/dist/client/ConfidentialClientApplication.mjs +169 -169
- package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
- package/dist/client/DeviceCodeClient.cjs +207 -207
- package/dist/client/DeviceCodeClient.d.ts +53 -53
- package/dist/client/DeviceCodeClient.mjs +207 -207
- package/dist/client/IConfidentialClientApplication.d.ts +39 -39
- package/dist/client/IPublicClientApplication.d.ts +42 -42
- package/dist/client/ManagedIdentityApplication.cjs +84 -84
- package/dist/client/ManagedIdentityApplication.d.ts +30 -30
- package/dist/client/ManagedIdentityApplication.mjs +84 -84
- package/dist/client/ManagedIdentityClient.cjs +60 -60
- package/dist/client/ManagedIdentityClient.d.ts +27 -27
- package/dist/client/ManagedIdentityClient.mjs +60 -60
- package/dist/client/ManagedIdentitySources/AppService.cjs +45 -45
- package/dist/client/ManagedIdentitySources/AppService.d.ts +17 -17
- package/dist/client/ManagedIdentitySources/AppService.mjs +45 -45
- package/dist/client/ManagedIdentitySources/AzureArc.cjs +155 -120
- package/dist/client/ManagedIdentitySources/AzureArc.cjs.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts +27 -23
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.mjs +155 -122
- package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs +122 -122
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +30 -30
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +122 -122
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.cjs +38 -38
- package/dist/client/ManagedIdentitySources/CloudShell.d.ts +16 -16
- package/dist/client/ManagedIdentitySources/CloudShell.mjs +38 -38
- package/dist/client/ManagedIdentitySources/Imds.cjs +43 -43
- package/dist/client/ManagedIdentitySources/Imds.d.ts +12 -12
- package/dist/client/ManagedIdentitySources/Imds.mjs +43 -43
- package/dist/client/ManagedIdentitySources/ServiceFabric.cjs +54 -54
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +17 -17
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +54 -54
- package/dist/client/OnBehalfOfClient.cjs +202 -202
- package/dist/client/OnBehalfOfClient.d.ts +47 -47
- package/dist/client/OnBehalfOfClient.mjs +202 -202
- package/dist/client/PublicClientApplication.cjs +237 -237
- package/dist/client/PublicClientApplication.d.ts +72 -72
- package/dist/client/PublicClientApplication.mjs +237 -237
- package/dist/client/UsernamePasswordClient.cjs +95 -95
- package/dist/client/UsernamePasswordClient.d.ts +25 -25
- package/dist/client/UsernamePasswordClient.mjs +95 -95
- package/dist/config/Configuration.cjs +106 -106
- package/dist/config/Configuration.d.ts +131 -131
- package/dist/config/Configuration.mjs +106 -106
- package/dist/config/ManagedIdentityId.cjs +48 -48
- package/dist/config/ManagedIdentityId.d.ts +11 -11
- package/dist/config/ManagedIdentityId.mjs +48 -48
- package/dist/config/ManagedIdentityRequestParameters.cjs +28 -28
- package/dist/config/ManagedIdentityRequestParameters.d.ts +11 -11
- package/dist/config/ManagedIdentityRequestParameters.mjs +28 -28
- package/dist/crypto/CryptoProvider.cjs +89 -89
- package/dist/crypto/CryptoProvider.d.ts +62 -62
- package/dist/crypto/CryptoProvider.mjs +89 -89
- package/dist/crypto/GuidGenerator.cjs +22 -22
- package/dist/crypto/GuidGenerator.d.ts +14 -14
- package/dist/crypto/GuidGenerator.mjs +22 -22
- package/dist/crypto/HashUtils.cjs +13 -13
- package/dist/crypto/HashUtils.d.ts +8 -8
- package/dist/crypto/HashUtils.mjs +13 -13
- package/dist/crypto/PkceGenerator.cjs +49 -49
- package/dist/crypto/PkceGenerator.d.ts +22 -22
- package/dist/crypto/PkceGenerator.mjs +49 -49
- package/dist/error/ManagedIdentityError.cjs +41 -41
- package/dist/error/ManagedIdentityError.d.ts +30 -30
- package/dist/error/ManagedIdentityError.mjs +41 -41
- package/dist/error/ManagedIdentityErrorCodes.cjs +24 -24
- package/dist/error/ManagedIdentityErrorCodes.d.ts +22 -22
- package/dist/error/ManagedIdentityErrorCodes.mjs +24 -24
- package/dist/error/NodeAuthError.cjs +95 -95
- package/dist/error/NodeAuthError.d.ts +73 -73
- package/dist/error/NodeAuthError.mjs +95 -95
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +45 -45
- package/dist/index.mjs +1 -1
- package/dist/internals.cjs +8 -8
- package/dist/internals.d.ts +6 -6
- package/dist/internals.mjs +8 -8
- package/dist/network/HttpClient.cjs +281 -281
- package/dist/network/HttpClient.d.ts +25 -25
- package/dist/network/HttpClient.mjs +281 -281
- package/dist/network/HttpClientWithRetries.cjs +34 -34
- package/dist/network/HttpClientWithRetries.d.ts +11 -11
- package/dist/network/HttpClientWithRetries.mjs +34 -34
- package/dist/network/ILoopbackClient.d.ts +10 -10
- package/dist/network/LoopbackClient.cjs +81 -77
- package/dist/network/LoopbackClient.cjs.map +1 -1
- package/dist/network/LoopbackClient.d.ts +21 -21
- package/dist/network/LoopbackClient.d.ts.map +1 -1
- package/dist/network/LoopbackClient.mjs +81 -77
- package/dist/network/LoopbackClient.mjs.map +1 -1
- package/dist/packageMetadata.cjs +4 -4
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.mjs +4 -4
- package/dist/request/AuthorizationCodeRequest.d.ts +21 -21
- package/dist/request/AuthorizationUrlRequest.d.ts +33 -33
- package/dist/request/ClientCredentialRequest.d.ts +14 -14
- package/dist/request/DeviceCodeRequest.d.ts +15 -15
- package/dist/request/InteractiveRequest.d.ts +22 -22
- package/dist/request/ManagedIdentityRequest.d.ts +8 -8
- package/dist/request/ManagedIdentityRequestParams.d.ts +9 -9
- package/dist/request/OnBehalfOfRequest.d.ts +14 -14
- package/dist/request/RefreshTokenRequest.d.ts +17 -17
- package/dist/request/SignOutRequest.d.ts +5 -5
- package/dist/request/SilentFlowRequest.d.ts +16 -16
- package/dist/request/UsernamePasswordRequest.d.ts +19 -19
- package/dist/response/ManagedIdentityTokenResponse.d.ts +34 -34
- package/dist/retry/IHttpRetryPolicy.d.ts +5 -5
- package/dist/retry/LinearRetryPolicy.cjs +40 -40
- package/dist/retry/LinearRetryPolicy.d.ts +11 -11
- package/dist/retry/LinearRetryPolicy.mjs +40 -40
- package/dist/utils/Constants.cjs +136 -136
- package/dist/utils/Constants.d.ts +141 -141
- package/dist/utils/Constants.mjs +136 -136
- package/dist/utils/EncodingUtils.cjs +44 -44
- package/dist/utils/EncodingUtils.d.ts +26 -26
- package/dist/utils/EncodingUtils.mjs +44 -44
- package/dist/utils/NetworkUtils.cjs +38 -38
- package/dist/utils/NetworkUtils.d.ts +5 -5
- package/dist/utils/NetworkUtils.mjs +38 -38
- package/package.json +2 -2
- package/src/client/ConfidentialClientApplication.ts +3 -3
- package/src/client/ManagedIdentitySources/AzureArc.ts +80 -25
- package/src/network/LoopbackClient.ts +7 -1
- package/src/packageMetadata.ts +1 -1
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.
|
|
1
|
+
/*! @azure/msal-node v2.13.1 2024-08-29 */
|
|
2
2
|
'use strict';
|
|
3
|
-
/*
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License.
|
|
6
|
-
*/
|
|
7
|
-
class NetworkUtils {
|
|
8
|
-
static getNetworkResponse(headers, body, statusCode) {
|
|
9
|
-
return {
|
|
10
|
-
headers: headers,
|
|
11
|
-
body: body,
|
|
12
|
-
status: statusCode,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
/*
|
|
16
|
-
* Utility function that converts a URL object into an ordinary options object as expected by the
|
|
17
|
-
* http.request and https.request APIs.
|
|
18
|
-
* https://github.com/nodejs/node/blob/main/lib/internal/url.js#L1090
|
|
19
|
-
*/
|
|
20
|
-
static urlToHttpOptions(url) {
|
|
21
|
-
const options = {
|
|
22
|
-
protocol: url.protocol,
|
|
23
|
-
hostname: url.hostname && url.hostname.startsWith("[")
|
|
24
|
-
? url.hostname.slice(1, -1)
|
|
25
|
-
: url.hostname,
|
|
26
|
-
hash: url.hash,
|
|
27
|
-
search: url.search,
|
|
28
|
-
pathname: url.pathname,
|
|
29
|
-
path: `${url.pathname || ""}${url.search || ""}`,
|
|
30
|
-
href: url.href,
|
|
31
|
-
};
|
|
32
|
-
if (url.port !== "") {
|
|
33
|
-
options.port = Number(url.port);
|
|
34
|
-
}
|
|
35
|
-
if (url.username || url.password) {
|
|
36
|
-
options.auth = `${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`;
|
|
37
|
-
}
|
|
38
|
-
return options;
|
|
39
|
-
}
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
* Licensed under the MIT License.
|
|
6
|
+
*/
|
|
7
|
+
class NetworkUtils {
|
|
8
|
+
static getNetworkResponse(headers, body, statusCode) {
|
|
9
|
+
return {
|
|
10
|
+
headers: headers,
|
|
11
|
+
body: body,
|
|
12
|
+
status: statusCode,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/*
|
|
16
|
+
* Utility function that converts a URL object into an ordinary options object as expected by the
|
|
17
|
+
* http.request and https.request APIs.
|
|
18
|
+
* https://github.com/nodejs/node/blob/main/lib/internal/url.js#L1090
|
|
19
|
+
*/
|
|
20
|
+
static urlToHttpOptions(url) {
|
|
21
|
+
const options = {
|
|
22
|
+
protocol: url.protocol,
|
|
23
|
+
hostname: url.hostname && url.hostname.startsWith("[")
|
|
24
|
+
? url.hostname.slice(1, -1)
|
|
25
|
+
: url.hostname,
|
|
26
|
+
hash: url.hash,
|
|
27
|
+
search: url.search,
|
|
28
|
+
pathname: url.pathname,
|
|
29
|
+
path: `${url.pathname || ""}${url.search || ""}`,
|
|
30
|
+
href: url.href,
|
|
31
|
+
};
|
|
32
|
+
if (url.port !== "") {
|
|
33
|
+
options.port = Number(url.port);
|
|
34
|
+
}
|
|
35
|
+
if (url.username || url.password) {
|
|
36
|
+
options.auth = `${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`;
|
|
37
|
+
}
|
|
38
|
+
return options;
|
|
39
|
+
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export { NetworkUtils };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@azure/msal-node",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.13.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Microsoft",
|
|
7
7
|
"email": "nugetaad@microsoft.com",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"yargs": "^17.3.1"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@azure/msal-common": "14.14.
|
|
82
|
+
"@azure/msal-common": "14.14.2",
|
|
83
83
|
"jsonwebtoken": "^9.0.0",
|
|
84
84
|
"uuid": "^8.3.0"
|
|
85
85
|
},
|
|
@@ -221,9 +221,9 @@ export class ConfidentialClientApplication
|
|
|
221
221
|
const clientSecretNotEmpty = !!this.config.auth.clientSecret;
|
|
222
222
|
const clientAssertionNotEmpty = !!this.config.auth.clientAssertion;
|
|
223
223
|
const certificateNotEmpty =
|
|
224
|
-
(!!this.config.auth.clientCertificate
|
|
225
|
-
!!this.config.auth.clientCertificate
|
|
226
|
-
!!this.config.auth.clientCertificate
|
|
224
|
+
(!!this.config.auth.clientCertificate?.thumbprint ||
|
|
225
|
+
!!this.config.auth.clientCertificate?.thumbprintSha256) &&
|
|
226
|
+
!!this.config.auth.clientCertificate?.privateKey;
|
|
227
227
|
|
|
228
228
|
/*
|
|
229
229
|
* If app developer configures this callback, they don't need a credential
|
|
@@ -33,18 +33,36 @@ import {
|
|
|
33
33
|
RESOURCE_BODY_OR_QUERY_PARAMETER_NAME,
|
|
34
34
|
} from "../../utils/Constants";
|
|
35
35
|
import { NodeStorage } from "../../cache/NodeStorage";
|
|
36
|
-
import {
|
|
36
|
+
import {
|
|
37
|
+
accessSync,
|
|
38
|
+
constants as fsConstants,
|
|
39
|
+
readFileSync,
|
|
40
|
+
statSync,
|
|
41
|
+
} from "fs";
|
|
37
42
|
import { ManagedIdentityTokenResponse } from "../../response/ManagedIdentityTokenResponse";
|
|
38
43
|
import { ManagedIdentityId } from "../../config/ManagedIdentityId";
|
|
39
44
|
import path from "path";
|
|
40
45
|
|
|
41
46
|
export const ARC_API_VERSION: string = "2019-11-01";
|
|
47
|
+
export const DEFAULT_AZURE_ARC_IDENTITY_ENDPOINT: string =
|
|
48
|
+
"http://127.0.0.1:40342/metadata/identity/oauth2/token";
|
|
49
|
+
const HIMDS_EXECUTABLE_HELPER_STRING = "N/A: himds executable exists";
|
|
50
|
+
|
|
51
|
+
type FilePathMap = {
|
|
52
|
+
win32: string;
|
|
53
|
+
linux: string;
|
|
54
|
+
};
|
|
42
55
|
|
|
43
|
-
export const SUPPORTED_AZURE_ARC_PLATFORMS = {
|
|
56
|
+
export const SUPPORTED_AZURE_ARC_PLATFORMS: FilePathMap = {
|
|
44
57
|
win32: `${process.env["ProgramData"]}\\AzureConnectedMachineAgent\\Tokens\\`,
|
|
45
58
|
linux: "/var/opt/azcmagent/tokens/",
|
|
46
59
|
};
|
|
47
60
|
|
|
61
|
+
export const AZURE_ARC_FILE_DETECTION: FilePathMap = {
|
|
62
|
+
win32: `${process.env["ProgramFiles"]}\\AzureConnectedMachineAgent\\himds.exe`,
|
|
63
|
+
linux: "/opt/azcmagent/bin/himds",
|
|
64
|
+
};
|
|
65
|
+
|
|
48
66
|
/**
|
|
49
67
|
* Original source of code: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/src/AzureArcManagedIdentitySource.cs
|
|
50
68
|
*/
|
|
@@ -64,13 +82,38 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
64
82
|
}
|
|
65
83
|
|
|
66
84
|
public static getEnvironmentVariables(): Array<string | undefined> {
|
|
67
|
-
|
|
85
|
+
let identityEndpoint: string | undefined =
|
|
68
86
|
process.env[
|
|
69
87
|
ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT
|
|
70
88
|
];
|
|
71
|
-
|
|
89
|
+
let imdsEndpoint: string | undefined =
|
|
72
90
|
process.env[ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT];
|
|
73
91
|
|
|
92
|
+
// if either of the identity or imds endpoints are undefined, check if the himds executable exists
|
|
93
|
+
if (!identityEndpoint || !imdsEndpoint) {
|
|
94
|
+
// get the expected Windows or Linux file path of the himds executable
|
|
95
|
+
const fileDetectionPath: string =
|
|
96
|
+
AZURE_ARC_FILE_DETECTION[process.platform as keyof FilePathMap];
|
|
97
|
+
try {
|
|
98
|
+
/*
|
|
99
|
+
* check if the himds executable exists and its permissions allow it to be read
|
|
100
|
+
* returns undefined if true, throws an error otherwise
|
|
101
|
+
*/
|
|
102
|
+
accessSync(
|
|
103
|
+
fileDetectionPath,
|
|
104
|
+
fsConstants.F_OK | fsConstants.R_OK
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
identityEndpoint = DEFAULT_AZURE_ARC_IDENTITY_ENDPOINT;
|
|
108
|
+
imdsEndpoint = HIMDS_EXECUTABLE_HELPER_STRING;
|
|
109
|
+
} catch (err) {
|
|
110
|
+
/*
|
|
111
|
+
* do nothing
|
|
112
|
+
* accessSync returns undefined on success, and throws an error on failure
|
|
113
|
+
*/
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
74
117
|
return [identityEndpoint, imdsEndpoint];
|
|
75
118
|
}
|
|
76
119
|
|
|
@@ -84,36 +127,46 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
84
127
|
const [identityEndpoint, imdsEndpoint] =
|
|
85
128
|
AzureArc.getEnvironmentVariables();
|
|
86
129
|
|
|
87
|
-
// if either of the identity or imds endpoints are undefined
|
|
130
|
+
// if either of the identity or imds endpoints are undefined (even after himds file detection)
|
|
88
131
|
if (!identityEndpoint || !imdsEndpoint) {
|
|
89
132
|
logger.info(
|
|
90
|
-
`[Managed Identity] ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is unavailable because one or both of
|
|
133
|
+
`[Managed Identity] ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is unavailable through environment variables because one or both of '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' and '${ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT}' are not defined. ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is also unavailable through file detection.`
|
|
91
134
|
);
|
|
135
|
+
|
|
92
136
|
return null;
|
|
93
137
|
}
|
|
94
138
|
|
|
95
|
-
|
|
139
|
+
// check if the imds endpoint is set to the default for file detection
|
|
140
|
+
if (imdsEndpoint === HIMDS_EXECUTABLE_HELPER_STRING) {
|
|
141
|
+
logger.info(
|
|
142
|
+
`[Managed Identity] ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is available through file detection. Defaulting to known ${ManagedIdentitySourceNames.AZURE_ARC} endpoint: ${DEFAULT_AZURE_ARC_IDENTITY_ENDPOINT}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity.`
|
|
143
|
+
);
|
|
144
|
+
} else {
|
|
145
|
+
// otherwise, both the identity and imds endpoints are defined without file detection; validate them
|
|
146
|
+
|
|
147
|
+
const validatedIdentityEndpoint: string =
|
|
148
|
+
AzureArc.getValidatedEnvVariableUrlString(
|
|
149
|
+
ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT,
|
|
150
|
+
identityEndpoint,
|
|
151
|
+
ManagedIdentitySourceNames.AZURE_ARC,
|
|
152
|
+
logger
|
|
153
|
+
);
|
|
154
|
+
// remove trailing slash
|
|
155
|
+
validatedIdentityEndpoint.endsWith("/")
|
|
156
|
+
? validatedIdentityEndpoint.slice(0, -1)
|
|
157
|
+
: validatedIdentityEndpoint;
|
|
158
|
+
|
|
96
159
|
AzureArc.getValidatedEnvVariableUrlString(
|
|
97
|
-
ManagedIdentityEnvironmentVariableNames.
|
|
98
|
-
|
|
160
|
+
ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT,
|
|
161
|
+
imdsEndpoint,
|
|
99
162
|
ManagedIdentitySourceNames.AZURE_ARC,
|
|
100
163
|
logger
|
|
101
164
|
);
|
|
102
|
-
// remove trailing slash
|
|
103
|
-
validatedIdentityEndpoint.endsWith("/")
|
|
104
|
-
? validatedIdentityEndpoint.slice(0, -1)
|
|
105
|
-
: validatedIdentityEndpoint;
|
|
106
|
-
|
|
107
|
-
AzureArc.getValidatedEnvVariableUrlString(
|
|
108
|
-
ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT,
|
|
109
|
-
imdsEndpoint,
|
|
110
|
-
ManagedIdentitySourceNames.AZURE_ARC,
|
|
111
|
-
logger
|
|
112
|
-
);
|
|
113
165
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
166
|
+
logger.info(
|
|
167
|
+
`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.AZURE_ARC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity.`
|
|
168
|
+
);
|
|
169
|
+
}
|
|
117
170
|
|
|
118
171
|
if (
|
|
119
172
|
managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED
|
|
@@ -186,9 +239,11 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
186
239
|
);
|
|
187
240
|
}
|
|
188
241
|
|
|
189
|
-
// get the expected Windows or Linux file path
|
|
242
|
+
// get the expected Windows or Linux file path
|
|
190
243
|
const expectedSecretFilePath: string =
|
|
191
|
-
SUPPORTED_AZURE_ARC_PLATFORMS[
|
|
244
|
+
SUPPORTED_AZURE_ARC_PLATFORMS[
|
|
245
|
+
process.platform as keyof FilePathMap
|
|
246
|
+
];
|
|
192
247
|
|
|
193
248
|
// throw an error if the file in the file path is not a .key file
|
|
194
249
|
const fileName: string = path.basename(secretFilePath);
|
|
@@ -65,10 +65,16 @@ export class LoopbackClient implements ILoopbackClient {
|
|
|
65
65
|
}); // Prevent auth code from being saved in the browser history
|
|
66
66
|
res.end();
|
|
67
67
|
}
|
|
68
|
+
if (authCodeResponse.error) {
|
|
69
|
+
res.end(
|
|
70
|
+
errorTemplate ||
|
|
71
|
+
`Error occurred: ${authCodeResponse.error}`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
68
74
|
resolve(authCodeResponse);
|
|
69
75
|
}
|
|
70
76
|
);
|
|
71
|
-
this.server.listen(0); // Listen on any available port
|
|
77
|
+
this.server.listen(0, "127.0.0.1"); // Listen on any available port
|
|
72
78
|
}
|
|
73
79
|
);
|
|
74
80
|
}
|
package/src/packageMetadata.ts
CHANGED