@azure/msal-node 2.2.0-alpha.0 → 2.3.0-alpha.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/dist/cache/NodeStorage.cjs +3 -3
- package/dist/cache/NodeStorage.cjs.map +1 -1
- package/dist/cache/NodeStorage.d.ts +2 -2
- package/dist/cache/NodeStorage.d.ts.map +1 -1
- package/dist/cache/NodeStorage.mjs +3 -3
- package/dist/cache/NodeStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.cjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.cjs +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
- package/dist/cache/serializer/Deserializer.cjs +1 -1
- package/dist/cache/serializer/Deserializer.mjs +1 -1
- package/dist/cache/serializer/Serializer.cjs +1 -1
- package/dist/cache/serializer/Serializer.mjs +1 -1
- package/dist/client/ClientApplication.cjs +2 -2
- package/dist/client/ClientApplication.cjs.map +1 -1
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.mjs +3 -3
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.cjs +1 -1
- package/dist/client/ClientAssertion.mjs +1 -1
- package/dist/client/ClientCredentialClient.cjs +27 -23
- package/dist/client/ClientCredentialClient.cjs.map +1 -1
- package/dist/client/ClientCredentialClient.d.ts +3 -3
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.mjs +28 -24
- package/dist/client/ClientCredentialClient.mjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.cjs +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +1 -1
- package/dist/client/DeviceCodeClient.cjs +1 -1
- package/dist/client/DeviceCodeClient.mjs +1 -1
- package/dist/client/ManagedIdentityApplication.cjs +96 -0
- package/dist/client/ManagedIdentityApplication.cjs.map +1 -0
- package/dist/client/ManagedIdentityApplication.d.ts +24 -0
- package/dist/client/ManagedIdentityApplication.d.ts.map +1 -0
- package/dist/client/ManagedIdentityApplication.mjs +94 -0
- package/dist/client/ManagedIdentityApplication.mjs.map +1 -0
- package/dist/client/ManagedIdentityClient.cjs +49 -0
- package/dist/client/ManagedIdentityClient.cjs.map +1 -0
- package/dist/client/ManagedIdentityClient.d.ts +25 -0
- package/dist/client/ManagedIdentityClient.d.ts.map +1 -0
- package/dist/client/ManagedIdentityClient.mjs +47 -0
- package/dist/client/ManagedIdentityClient.mjs.map +1 -0
- package/dist/client/ManagedIdentitySources/AppService.cjs +79 -0
- package/dist/client/ManagedIdentitySources/AppService.cjs.map +1 -0
- package/dist/client/ManagedIdentitySources/AppService.d.ts +17 -0
- package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -0
- package/dist/client/ManagedIdentitySources/AppService.mjs +77 -0
- package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -0
- package/dist/client/ManagedIdentitySources/AzureArc.cjs +107 -0
- package/dist/client/ManagedIdentitySources/AzureArc.cjs.map +1 -0
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts +19 -0
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -0
- package/dist/client/ManagedIdentitySources/AzureArc.mjs +104 -0
- package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -0
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs +87 -0
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs.map +1 -0
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +19 -0
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -0
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +85 -0
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -0
- package/dist/client/ManagedIdentitySources/CloudShell.d.ts +7 -0
- package/dist/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -0
- package/dist/client/ManagedIdentitySources/Imds.cjs +63 -0
- package/dist/client/ManagedIdentitySources/Imds.cjs.map +1 -0
- package/dist/client/ManagedIdentitySources/Imds.d.ts +13 -0
- package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -0
- package/dist/client/ManagedIdentitySources/Imds.mjs +61 -0
- package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -0
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +7 -0
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -0
- package/dist/client/OnBehalfOfClient.cjs +1 -1
- package/dist/client/OnBehalfOfClient.mjs +1 -1
- package/dist/client/PublicClientApplication.cjs +1 -1
- package/dist/client/PublicClientApplication.mjs +1 -1
- package/dist/client/UsernamePasswordClient.cjs +1 -1
- package/dist/client/UsernamePasswordClient.mjs +1 -1
- package/dist/config/Configuration.cjs +18 -2
- package/dist/config/Configuration.cjs.map +1 -1
- package/dist/config/Configuration.d.ts +15 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +18 -3
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/config/ManagedIdentityId.cjs +59 -0
- package/dist/config/ManagedIdentityId.cjs.map +1 -0
- package/dist/config/ManagedIdentityId.d.ts +12 -0
- package/dist/config/ManagedIdentityId.d.ts.map +1 -0
- package/dist/config/ManagedIdentityId.mjs +57 -0
- package/dist/config/ManagedIdentityId.mjs.map +1 -0
- package/dist/config/ManagedIdentityRequestParameters.cjs +38 -0
- package/dist/config/ManagedIdentityRequestParameters.cjs.map +1 -0
- package/dist/config/ManagedIdentityRequestParameters.d.ts +12 -0
- package/dist/config/ManagedIdentityRequestParameters.d.ts.map +1 -0
- package/dist/config/ManagedIdentityRequestParameters.mjs +36 -0
- package/dist/config/ManagedIdentityRequestParameters.mjs.map +1 -0
- package/dist/crypto/CryptoProvider.cjs +1 -1
- package/dist/crypto/CryptoProvider.mjs +1 -1
- package/dist/crypto/GuidGenerator.cjs +1 -1
- package/dist/crypto/GuidGenerator.mjs +1 -1
- package/dist/crypto/HashUtils.cjs +1 -1
- package/dist/crypto/HashUtils.mjs +1 -1
- package/dist/crypto/PkceGenerator.cjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/error/ManagedIdentityError.cjs +40 -0
- package/dist/error/ManagedIdentityError.cjs.map +1 -0
- package/dist/error/ManagedIdentityError.d.ts +22 -0
- package/dist/error/ManagedIdentityError.d.ts.map +1 -0
- package/dist/error/ManagedIdentityError.mjs +36 -0
- package/dist/error/ManagedIdentityError.mjs.map +1 -0
- package/dist/error/ManagedIdentityErrorCodes.cjs +28 -0
- package/dist/error/ManagedIdentityErrorCodes.cjs.map +1 -0
- package/dist/error/ManagedIdentityErrorCodes.d.ts +10 -0
- package/dist/error/ManagedIdentityErrorCodes.d.ts.map +1 -0
- package/dist/error/ManagedIdentityErrorCodes.mjs +18 -0
- package/dist/error/ManagedIdentityErrorCodes.mjs.map +1 -0
- package/dist/error/NodeAuthError.cjs +1 -1
- package/dist/error/NodeAuthError.mjs +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internals.cjs +1 -1
- package/dist/internals.mjs +1 -1
- package/dist/network/HttpClient.cjs +13 -6
- package/dist/network/HttpClient.cjs.map +1 -1
- package/dist/network/HttpClient.d.ts +2 -1
- package/dist/network/HttpClient.d.ts.map +1 -1
- package/dist/network/HttpClient.mjs +13 -6
- package/dist/network/HttpClient.mjs.map +1 -1
- package/dist/network/LoopbackClient.cjs +2 -1
- package/dist/network/LoopbackClient.cjs.map +1 -1
- package/dist/network/LoopbackClient.d.ts.map +1 -1
- package/dist/network/LoopbackClient.mjs +2 -1
- package/dist/network/LoopbackClient.mjs.map +1 -1
- package/dist/packageMetadata.cjs +2 -2
- package/dist/packageMetadata.cjs.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/packageMetadata.mjs.map +1 -1
- package/dist/request/ManagedIdentityRequest.d.ts +9 -0
- package/dist/request/ManagedIdentityRequest.d.ts.map +1 -0
- package/dist/request/ManagedIdentityRequestParams.d.ts +10 -0
- package/dist/request/ManagedIdentityRequestParams.d.ts.map +1 -0
- package/dist/response/ManagedIdentityTokenResponse.d.ts +25 -0
- package/dist/response/ManagedIdentityTokenResponse.d.ts.map +1 -0
- package/dist/utils/Constants.cjs +30 -1
- package/dist/utils/Constants.cjs.map +1 -1
- package/dist/utils/Constants.d.ts +20 -0
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +21 -2
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/EncodingUtils.cjs +1 -1
- package/dist/utils/EncodingUtils.mjs +1 -1
- package/dist/utils/NetworkUtils.cjs +1 -1
- package/dist/utils/NetworkUtils.mjs +1 -1
- package/package.json +2 -2
- package/src/cache/NodeStorage.ts +8 -2
- package/src/client/ClientApplication.ts +3 -1
- package/src/client/ClientCredentialClient.ts +65 -25
- package/src/client/ManagedIdentityApplication.ts +194 -0
- package/src/client/ManagedIdentityClient.ts +111 -0
- package/src/client/ManagedIdentitySources/AppService.ts +151 -0
- package/src/client/ManagedIdentitySources/AzureArc.ts +208 -0
- package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +169 -0
- package/src/client/ManagedIdentitySources/CloudShell.ts +19 -0
- package/src/client/ManagedIdentitySources/Imds.ts +112 -0
- package/src/client/ManagedIdentitySources/ServiceFabric.ts +19 -0
- package/src/config/Configuration.ts +47 -1
- package/src/config/ManagedIdentityId.ts +73 -0
- package/src/config/ManagedIdentityRequestParameters.ts +53 -0
- package/src/error/ManagedIdentityError.ts +46 -0
- package/src/error/ManagedIdentityErrorCodes.ts +15 -0
- package/src/index.ts +3 -0
- package/src/network/HttpClient.ts +17 -5
- package/src/network/LoopbackClient.ts +1 -0
- package/src/packageMetadata.ts +1 -1
- package/src/request/ManagedIdentityRequest.ts +15 -0
- package/src/request/ManagedIdentityRequestParams.ts +14 -0
- package/src/response/ManagedIdentityTokenResponse.ts +33 -0
- package/src/utils/Constants.ts +27 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { INetworkModule, Logger, UrlString } from "@azure/msal-common";
|
|
7
|
+
import { BaseManagedIdentitySource } from "./BaseManagedIdentitySource";
|
|
8
|
+
import {
|
|
9
|
+
HttpMethod,
|
|
10
|
+
MANAGED_IDENTITY_CLIENT_ID,
|
|
11
|
+
MANAGED_IDENTITY_OBJECT_ID,
|
|
12
|
+
MANAGED_IDENTITY_RESOURCE_ID,
|
|
13
|
+
ManagedIdentityIdType,
|
|
14
|
+
SECRET_HEADER_NAME,
|
|
15
|
+
} from "../../utils/Constants";
|
|
16
|
+
import { CryptoProvider } from "../../crypto/CryptoProvider";
|
|
17
|
+
import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters";
|
|
18
|
+
import { ManagedIdentityId } from "../../config/ManagedIdentityId";
|
|
19
|
+
import {
|
|
20
|
+
ManagedIdentityErrorCodes,
|
|
21
|
+
createManagedIdentityError,
|
|
22
|
+
} from "../../error/ManagedIdentityError";
|
|
23
|
+
import { NodeStorage } from "../../cache/NodeStorage";
|
|
24
|
+
|
|
25
|
+
// MSI Constants. Docs for MSI are available here https://docs.microsoft.com/azure/app-service/overview-managed-identity
|
|
26
|
+
const APP_SERVICE_MSI_API_VERSION: string = "2019-08-01";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Original source of code: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/src/AppServiceManagedIdentitySource.cs
|
|
30
|
+
*/
|
|
31
|
+
export class AppService extends BaseManagedIdentitySource {
|
|
32
|
+
private endpoint: string;
|
|
33
|
+
private secret: string;
|
|
34
|
+
|
|
35
|
+
constructor(
|
|
36
|
+
logger: Logger,
|
|
37
|
+
nodeStorage: NodeStorage,
|
|
38
|
+
networkClient: INetworkModule,
|
|
39
|
+
cryptoProvider: CryptoProvider,
|
|
40
|
+
endpoint: string,
|
|
41
|
+
secret: string
|
|
42
|
+
) {
|
|
43
|
+
super(logger, nodeStorage, networkClient, cryptoProvider);
|
|
44
|
+
|
|
45
|
+
this.endpoint = endpoint;
|
|
46
|
+
this.secret = secret;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public static tryCreate(
|
|
50
|
+
logger: Logger,
|
|
51
|
+
nodeStorage: NodeStorage,
|
|
52
|
+
networkClient: INetworkModule,
|
|
53
|
+
cryptoProvider: CryptoProvider
|
|
54
|
+
): AppService | null {
|
|
55
|
+
const secret: string | undefined = process.env["IDENTITY_HEADER"];
|
|
56
|
+
|
|
57
|
+
const [areEnvironmentVariablesValidated, endpoint]: [
|
|
58
|
+
boolean,
|
|
59
|
+
string | undefined
|
|
60
|
+
] = validateEnvironmentVariables(
|
|
61
|
+
process.env["IDENTITY_ENDPOINT"] || undefined,
|
|
62
|
+
secret,
|
|
63
|
+
logger
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
return areEnvironmentVariablesValidated
|
|
67
|
+
? new AppService(
|
|
68
|
+
logger,
|
|
69
|
+
nodeStorage,
|
|
70
|
+
networkClient,
|
|
71
|
+
cryptoProvider,
|
|
72
|
+
endpoint as string,
|
|
73
|
+
secret as string
|
|
74
|
+
)
|
|
75
|
+
: null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public createRequest(
|
|
79
|
+
resource: string,
|
|
80
|
+
managedIdentityId: ManagedIdentityId
|
|
81
|
+
): ManagedIdentityRequestParameters {
|
|
82
|
+
const request: ManagedIdentityRequestParameters =
|
|
83
|
+
new ManagedIdentityRequestParameters(HttpMethod.GET, this.endpoint);
|
|
84
|
+
|
|
85
|
+
request.headers[SECRET_HEADER_NAME] = this.secret;
|
|
86
|
+
request.queryParameters["api-version"] = APP_SERVICE_MSI_API_VERSION;
|
|
87
|
+
request.queryParameters["resource"] = resource;
|
|
88
|
+
// bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
|
|
89
|
+
|
|
90
|
+
switch (managedIdentityId.idType) {
|
|
91
|
+
case ManagedIdentityIdType.USER_ASSIGNED_CLIENT_ID:
|
|
92
|
+
this.logger.info(
|
|
93
|
+
"[Managed Identity] Adding user assigned client id to the request."
|
|
94
|
+
);
|
|
95
|
+
request.queryParameters[MANAGED_IDENTITY_CLIENT_ID] =
|
|
96
|
+
managedIdentityId.id;
|
|
97
|
+
break;
|
|
98
|
+
|
|
99
|
+
case ManagedIdentityIdType.USER_ASSIGNED_RESOURCE_ID:
|
|
100
|
+
this.logger.info(
|
|
101
|
+
"[Managed Identity] Adding user assigned resource id to the request."
|
|
102
|
+
);
|
|
103
|
+
request.queryParameters[MANAGED_IDENTITY_RESOURCE_ID] =
|
|
104
|
+
managedIdentityId.id;
|
|
105
|
+
break;
|
|
106
|
+
|
|
107
|
+
case ManagedIdentityIdType.USER_ASSIGNED_OBJECT_ID:
|
|
108
|
+
this.logger.info(
|
|
109
|
+
"[Managed Identity] Adding user assigned object id to the request."
|
|
110
|
+
);
|
|
111
|
+
request.queryParameters[MANAGED_IDENTITY_OBJECT_ID] =
|
|
112
|
+
managedIdentityId.id;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return request;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const validateEnvironmentVariables = (
|
|
121
|
+
endpoint: string | undefined,
|
|
122
|
+
secret: string | undefined,
|
|
123
|
+
logger: Logger
|
|
124
|
+
): [boolean, string | undefined] => {
|
|
125
|
+
let endpointUrlString: string | undefined;
|
|
126
|
+
|
|
127
|
+
// if either of the endpoint or secret environment variables are undefined, this MSI provider is unavailable.
|
|
128
|
+
if (!endpoint || !secret) {
|
|
129
|
+
logger.info(
|
|
130
|
+
"[Managed Identity] App Service managed identity is unavailable because one or both of the 'IDENTITY_HEADER' and 'IDENTITY_ENDPOINT' environment variables are missing."
|
|
131
|
+
);
|
|
132
|
+
return [false, endpointUrlString];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
endpointUrlString = new UrlString(endpoint).urlString;
|
|
137
|
+
} catch (error) {
|
|
138
|
+
logger.info(
|
|
139
|
+
"[Managed Identity] App Service managed identity is unavailable because the 'IDENTITY_ENDPOINT' environment variable is malformed."
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
throw createManagedIdentityError(
|
|
143
|
+
ManagedIdentityErrorCodes.urlParseError
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
logger.info(
|
|
148
|
+
`[Managed Identity] Environment variables validation passed for App Service managed identity. Endpoint URI: ${endpointUrlString}. Creating App Service managed identity.`
|
|
149
|
+
);
|
|
150
|
+
return [true, endpointUrlString];
|
|
151
|
+
};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
AuthError,
|
|
8
|
+
ClientAuthErrorCodes,
|
|
9
|
+
createClientAuthError,
|
|
10
|
+
HttpStatus,
|
|
11
|
+
INetworkModule,
|
|
12
|
+
NetworkResponse,
|
|
13
|
+
NetworkRequestOptions,
|
|
14
|
+
Logger,
|
|
15
|
+
UrlString,
|
|
16
|
+
ServerAuthorizationTokenResponse,
|
|
17
|
+
} from "@azure/msal-common";
|
|
18
|
+
import { ManagedIdentityId } from "../../config/ManagedIdentityId";
|
|
19
|
+
import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters";
|
|
20
|
+
import { BaseManagedIdentitySource } from "./BaseManagedIdentitySource";
|
|
21
|
+
import { CryptoProvider } from "../../crypto/CryptoProvider";
|
|
22
|
+
import {
|
|
23
|
+
ManagedIdentityErrorCodes,
|
|
24
|
+
createManagedIdentityError,
|
|
25
|
+
} from "../../error/ManagedIdentityError";
|
|
26
|
+
import {
|
|
27
|
+
AUTHORIZATION_HEADER_NAME,
|
|
28
|
+
HttpMethod,
|
|
29
|
+
METADATA_HEADER_NAME,
|
|
30
|
+
ManagedIdentityIdType,
|
|
31
|
+
} from "../../utils/Constants";
|
|
32
|
+
import { NodeStorage } from "../../cache/NodeStorage";
|
|
33
|
+
import { readFileSync } from "fs";
|
|
34
|
+
import { ManagedIdentityTokenResponse } from "../../response/ManagedIdentityTokenResponse";
|
|
35
|
+
|
|
36
|
+
export const ARC_API_VERSION: string = "2019-11-01";
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Original source of code: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/src/AzureArcManagedIdentitySource.cs
|
|
40
|
+
*/
|
|
41
|
+
export class AzureArc extends BaseManagedIdentitySource {
|
|
42
|
+
private endpoint: string;
|
|
43
|
+
|
|
44
|
+
constructor(
|
|
45
|
+
logger: Logger,
|
|
46
|
+
nodeStorage: NodeStorage,
|
|
47
|
+
networkClient: INetworkModule,
|
|
48
|
+
cryptoProvider: CryptoProvider,
|
|
49
|
+
endpoint: string
|
|
50
|
+
) {
|
|
51
|
+
super(logger, nodeStorage, networkClient, cryptoProvider);
|
|
52
|
+
|
|
53
|
+
this.endpoint = endpoint;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public static tryCreate(
|
|
57
|
+
logger: Logger,
|
|
58
|
+
nodeStorage: NodeStorage,
|
|
59
|
+
networkClient: INetworkModule,
|
|
60
|
+
cryptoProvider: CryptoProvider
|
|
61
|
+
): AzureArc | null {
|
|
62
|
+
const imdsEndpoint: string | undefined = process.env["IMDS_ENDPOINT"];
|
|
63
|
+
|
|
64
|
+
const [areEnvironmentVariablesValidated, endpoint]: [
|
|
65
|
+
boolean,
|
|
66
|
+
string | undefined
|
|
67
|
+
] = validateEnvironmentVariables(
|
|
68
|
+
process.env["IDENTITY_ENDPOINT"] || undefined,
|
|
69
|
+
imdsEndpoint,
|
|
70
|
+
logger
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return areEnvironmentVariablesValidated
|
|
74
|
+
? new AzureArc(
|
|
75
|
+
logger,
|
|
76
|
+
nodeStorage,
|
|
77
|
+
networkClient,
|
|
78
|
+
cryptoProvider,
|
|
79
|
+
endpoint as string
|
|
80
|
+
)
|
|
81
|
+
: null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public createRequest(
|
|
85
|
+
resource: string,
|
|
86
|
+
managedIdentityId: ManagedIdentityId
|
|
87
|
+
): ManagedIdentityRequestParameters {
|
|
88
|
+
if (
|
|
89
|
+
managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED
|
|
90
|
+
) {
|
|
91
|
+
throw createManagedIdentityError(
|
|
92
|
+
ManagedIdentityErrorCodes.unableToCreateAzureArc
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const request: ManagedIdentityRequestParameters =
|
|
97
|
+
new ManagedIdentityRequestParameters(
|
|
98
|
+
HttpMethod.GET,
|
|
99
|
+
this.endpoint.replace("localhost", "127.0.0.1")
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
request.headers[METADATA_HEADER_NAME] = "true";
|
|
103
|
+
request.queryParameters["api-version"] = ARC_API_VERSION;
|
|
104
|
+
request.queryParameters["resource"] = resource;
|
|
105
|
+
// bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
|
|
106
|
+
|
|
107
|
+
return request;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
public async getServerTokenResponseAsync(
|
|
111
|
+
originalResponse: NetworkResponse<ManagedIdentityTokenResponse>,
|
|
112
|
+
networkClient: INetworkModule,
|
|
113
|
+
networkRequest: ManagedIdentityRequestParameters,
|
|
114
|
+
networkRequestOptions: NetworkRequestOptions
|
|
115
|
+
): Promise<ServerAuthorizationTokenResponse> {
|
|
116
|
+
let retryResponse:
|
|
117
|
+
| NetworkResponse<ManagedIdentityTokenResponse>
|
|
118
|
+
| undefined;
|
|
119
|
+
|
|
120
|
+
if (originalResponse.status === HttpStatus.UNAUTHORIZED) {
|
|
121
|
+
const wwwAuthHeader: string =
|
|
122
|
+
originalResponse.headers["www-authenticate"];
|
|
123
|
+
if (!wwwAuthHeader) {
|
|
124
|
+
throw createManagedIdentityError(
|
|
125
|
+
ManagedIdentityErrorCodes.wwwAuthenticateHeaderMissing
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
if (!wwwAuthHeader.includes("Basic realm=")) {
|
|
129
|
+
throw createManagedIdentityError(
|
|
130
|
+
ManagedIdentityErrorCodes.wwwAuthenticateHeaderUnsupportedFormat
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const secretFile = wwwAuthHeader.split("Basic realm=")[1];
|
|
135
|
+
let secret;
|
|
136
|
+
try {
|
|
137
|
+
secret = readFileSync(secretFile, "utf-8");
|
|
138
|
+
} catch (e) {
|
|
139
|
+
throw createManagedIdentityError(
|
|
140
|
+
ManagedIdentityErrorCodes.unableToReadSecretFile
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
const authHeaderValue = `Basic ${secret}`;
|
|
144
|
+
|
|
145
|
+
this.logger.info(
|
|
146
|
+
`[Managed Identity] Adding authorization header to the request.`
|
|
147
|
+
);
|
|
148
|
+
networkRequest.headers[AUTHORIZATION_HEADER_NAME] = authHeaderValue;
|
|
149
|
+
|
|
150
|
+
try {
|
|
151
|
+
retryResponse =
|
|
152
|
+
await networkClient.sendGetRequestAsync<ManagedIdentityTokenResponse>(
|
|
153
|
+
networkRequest.computeUri(),
|
|
154
|
+
networkRequestOptions
|
|
155
|
+
);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
if (error instanceof AuthError) {
|
|
158
|
+
throw error;
|
|
159
|
+
} else {
|
|
160
|
+
throw createClientAuthError(
|
|
161
|
+
ClientAuthErrorCodes.networkError
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return this.getServerTokenResponse(retryResponse || originalResponse);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const validateEnvironmentVariables = (
|
|
172
|
+
identityEndpoint: string | undefined,
|
|
173
|
+
imdsEndpoint: string | undefined,
|
|
174
|
+
logger: Logger
|
|
175
|
+
): [boolean, string | undefined] => {
|
|
176
|
+
let endpointUrlString: string | undefined;
|
|
177
|
+
|
|
178
|
+
// if either of the identity or imds endpoints are undefined, this MSI provider is unavailable.
|
|
179
|
+
if (!identityEndpoint || !imdsEndpoint) {
|
|
180
|
+
logger.info(
|
|
181
|
+
"[Managed Identity] Azure Arc managed identity is unavailable because one or both of the 'IDENTITY_ENDPOINT' and 'IMDS_ENDPOINT' environment variables are missing."
|
|
182
|
+
);
|
|
183
|
+
return [false, endpointUrlString];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
try {
|
|
187
|
+
endpointUrlString = new UrlString(identityEndpoint).urlString;
|
|
188
|
+
} catch (error) {
|
|
189
|
+
logger.info(
|
|
190
|
+
"[Managed Identity] App service managed identity is unavailable because the 'IDENTITY_ENDPOINT' environment variable is malformed."
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
throw createManagedIdentityError(
|
|
194
|
+
ManagedIdentityErrorCodes.urlParseError
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
logger.info(
|
|
199
|
+
`[Managed Identity] Environment variables validation passed for Azure Arc managed identity. Endpoint URI: ${endpointUrlString}. Creating Azure Arc managed identity.`
|
|
200
|
+
);
|
|
201
|
+
return [
|
|
202
|
+
true,
|
|
203
|
+
// remove trailing slash
|
|
204
|
+
endpointUrlString.endsWith("/")
|
|
205
|
+
? endpointUrlString.slice(0, -1)
|
|
206
|
+
: endpointUrlString,
|
|
207
|
+
];
|
|
208
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
AuthError,
|
|
8
|
+
Authority,
|
|
9
|
+
ClientAuthErrorCodes,
|
|
10
|
+
Constants,
|
|
11
|
+
HeaderNames,
|
|
12
|
+
INetworkModule,
|
|
13
|
+
Logger,
|
|
14
|
+
NetworkRequestOptions,
|
|
15
|
+
NetworkResponse,
|
|
16
|
+
ResponseHandler,
|
|
17
|
+
ServerAuthorizationTokenResponse,
|
|
18
|
+
TimeUtils,
|
|
19
|
+
createClientAuthError,
|
|
20
|
+
AuthenticationResult,
|
|
21
|
+
} from "@azure/msal-common";
|
|
22
|
+
import { ManagedIdentityId } from "../../config/ManagedIdentityId";
|
|
23
|
+
import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters";
|
|
24
|
+
import { CryptoProvider } from "../../crypto/CryptoProvider";
|
|
25
|
+
import { ManagedIdentityRequest } from "../../request/ManagedIdentityRequest";
|
|
26
|
+
import { HttpMethod } from "../../utils/Constants";
|
|
27
|
+
import { ManagedIdentityTokenResponse } from "../../response/ManagedIdentityTokenResponse";
|
|
28
|
+
import { NodeStorage } from "../../cache/NodeStorage";
|
|
29
|
+
|
|
30
|
+
export abstract class BaseManagedIdentitySource {
|
|
31
|
+
protected logger: Logger;
|
|
32
|
+
private nodeStorage: NodeStorage;
|
|
33
|
+
private networkClient: INetworkModule;
|
|
34
|
+
private cryptoProvider: CryptoProvider;
|
|
35
|
+
|
|
36
|
+
constructor(
|
|
37
|
+
logger: Logger,
|
|
38
|
+
nodeStorage: NodeStorage,
|
|
39
|
+
networkClient: INetworkModule,
|
|
40
|
+
cryptoProvider: CryptoProvider
|
|
41
|
+
) {
|
|
42
|
+
this.logger = logger;
|
|
43
|
+
this.nodeStorage = nodeStorage;
|
|
44
|
+
this.networkClient = networkClient;
|
|
45
|
+
this.cryptoProvider = cryptoProvider;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
abstract createRequest(
|
|
49
|
+
request: string,
|
|
50
|
+
managedIdentityId: ManagedIdentityId
|
|
51
|
+
): ManagedIdentityRequestParameters;
|
|
52
|
+
|
|
53
|
+
public async getServerTokenResponseAsync(
|
|
54
|
+
response: NetworkResponse<ManagedIdentityTokenResponse>,
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
56
|
+
_networkClient: INetworkModule,
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
58
|
+
_networkRequest: ManagedIdentityRequestParameters,
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
60
|
+
_networkRequestOptions: NetworkRequestOptions
|
|
61
|
+
): Promise<ServerAuthorizationTokenResponse> {
|
|
62
|
+
return await this.getServerTokenResponse(response);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public getServerTokenResponse(
|
|
66
|
+
response: NetworkResponse<ManagedIdentityTokenResponse>
|
|
67
|
+
): ServerAuthorizationTokenResponse {
|
|
68
|
+
const serverTokenResponse: ServerAuthorizationTokenResponse = {
|
|
69
|
+
status: response.status,
|
|
70
|
+
|
|
71
|
+
// success
|
|
72
|
+
access_token: response.body.access_token,
|
|
73
|
+
expires_in: response.body.expires_on,
|
|
74
|
+
scope: response.body.resource,
|
|
75
|
+
token_type: response.body.token_type,
|
|
76
|
+
|
|
77
|
+
// error
|
|
78
|
+
error: response.body.message,
|
|
79
|
+
correlation_id: response.body.correlationId,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// compute refresh_in as 1/2 of expires_in, but only if expires_in > 2h
|
|
83
|
+
if (
|
|
84
|
+
serverTokenResponse.expires_in &&
|
|
85
|
+
serverTokenResponse.expires_in > 2 * 3600
|
|
86
|
+
) {
|
|
87
|
+
serverTokenResponse.refresh_in = serverTokenResponse.expires_in / 2;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return serverTokenResponse;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public async acquireTokenWithManagedIdentity(
|
|
94
|
+
managedIdentityRequest: ManagedIdentityRequest,
|
|
95
|
+
managedIdentityId: ManagedIdentityId,
|
|
96
|
+
fakeAuthority: Authority,
|
|
97
|
+
refreshAccessToken?: boolean
|
|
98
|
+
): Promise<AuthenticationResult> {
|
|
99
|
+
const networkRequest: ManagedIdentityRequestParameters =
|
|
100
|
+
this.createRequest(
|
|
101
|
+
managedIdentityRequest.resource,
|
|
102
|
+
managedIdentityId
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const headers: Record<string, string> = networkRequest.headers;
|
|
106
|
+
headers[HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;
|
|
107
|
+
const networkRequestOptions: NetworkRequestOptions = { headers };
|
|
108
|
+
if (managedIdentityRequest.forceRefresh) {
|
|
109
|
+
networkRequestOptions.body =
|
|
110
|
+
networkRequest.computeParametersBodyString();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const reqTimestamp = TimeUtils.nowSeconds();
|
|
114
|
+
let response: NetworkResponse<ManagedIdentityTokenResponse>;
|
|
115
|
+
try {
|
|
116
|
+
// Sources that send POST requests: Cloud Shell
|
|
117
|
+
if (networkRequest.httpMethod === HttpMethod.POST) {
|
|
118
|
+
response =
|
|
119
|
+
await this.networkClient.sendPostRequestAsync<ManagedIdentityTokenResponse>(
|
|
120
|
+
networkRequest.computeUri(),
|
|
121
|
+
networkRequestOptions
|
|
122
|
+
);
|
|
123
|
+
// Sources that send GET requests: App Service, Azure Arc, IMDS, Service Fabric
|
|
124
|
+
} else {
|
|
125
|
+
response =
|
|
126
|
+
await this.networkClient.sendGetRequestAsync<ManagedIdentityTokenResponse>(
|
|
127
|
+
networkRequest.computeUri(),
|
|
128
|
+
networkRequestOptions
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
} catch (error) {
|
|
132
|
+
if (error instanceof AuthError) {
|
|
133
|
+
throw error;
|
|
134
|
+
} else {
|
|
135
|
+
throw createClientAuthError(ClientAuthErrorCodes.networkError);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const responseHandler = new ResponseHandler(
|
|
140
|
+
managedIdentityId.id,
|
|
141
|
+
this.nodeStorage,
|
|
142
|
+
this.cryptoProvider,
|
|
143
|
+
this.logger,
|
|
144
|
+
null,
|
|
145
|
+
null
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
const serverTokenResponse: ServerAuthorizationTokenResponse =
|
|
149
|
+
await this.getServerTokenResponseAsync(
|
|
150
|
+
response,
|
|
151
|
+
this.networkClient,
|
|
152
|
+
networkRequest,
|
|
153
|
+
networkRequestOptions
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
responseHandler.validateTokenResponse(
|
|
157
|
+
serverTokenResponse,
|
|
158
|
+
refreshAccessToken
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
// caches the token
|
|
162
|
+
return await responseHandler.handleServerTokenResponse(
|
|
163
|
+
serverTokenResponse,
|
|
164
|
+
fakeAuthority,
|
|
165
|
+
reqTimestamp,
|
|
166
|
+
managedIdentityRequest
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ManagedIdentityId } from "../../config/ManagedIdentityId";
|
|
7
|
+
import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters";
|
|
8
|
+
import { BaseManagedIdentitySource } from "./BaseManagedIdentitySource";
|
|
9
|
+
|
|
10
|
+
export class CloudShell extends BaseManagedIdentitySource {
|
|
11
|
+
public createRequest(
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
|
+
_resource: string,
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
+
_managedIdentityId: ManagedIdentityId
|
|
16
|
+
): ManagedIdentityRequestParameters {
|
|
17
|
+
throw new Error("Method not implemented.");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { INetworkModule, Logger } from "@azure/msal-common";
|
|
7
|
+
import { ManagedIdentityId } from "../../config/ManagedIdentityId";
|
|
8
|
+
import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters";
|
|
9
|
+
import { BaseManagedIdentitySource } from "./BaseManagedIdentitySource";
|
|
10
|
+
import { CryptoProvider } from "../../crypto/CryptoProvider";
|
|
11
|
+
import {
|
|
12
|
+
HttpMethod,
|
|
13
|
+
MANAGED_IDENTITY_CLIENT_ID,
|
|
14
|
+
MANAGED_IDENTITY_OBJECT_ID,
|
|
15
|
+
MANAGED_IDENTITY_RESOURCE_ID,
|
|
16
|
+
METADATA_HEADER_NAME,
|
|
17
|
+
ManagedIdentityIdType,
|
|
18
|
+
} from "../../utils/Constants";
|
|
19
|
+
import { NodeStorage } from "../../cache/NodeStorage";
|
|
20
|
+
|
|
21
|
+
// IMDS constants. Docs for IMDS are available here https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/how-to-use-vm-token#get-a-token-using-http
|
|
22
|
+
const IMDS_TOKEN_PATH: string = "/metadata/identity/oauth2/token";
|
|
23
|
+
const DEFAULT_IMDS_ENDPOINT: string = `http://169.254.169.254${IMDS_TOKEN_PATH}`;
|
|
24
|
+
|
|
25
|
+
const IMDS_API_VERSION: string = "2018-02-01";
|
|
26
|
+
|
|
27
|
+
// Original source of code: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/src/ImdsManagedIdentitySource.cs
|
|
28
|
+
export class Imds extends BaseManagedIdentitySource {
|
|
29
|
+
private endpoint: string;
|
|
30
|
+
|
|
31
|
+
constructor(
|
|
32
|
+
logger: Logger,
|
|
33
|
+
nodeStorage: NodeStorage,
|
|
34
|
+
networkClient: INetworkModule,
|
|
35
|
+
cryptoProvider: CryptoProvider,
|
|
36
|
+
endpoint: string
|
|
37
|
+
) {
|
|
38
|
+
super(logger, nodeStorage, networkClient, cryptoProvider);
|
|
39
|
+
|
|
40
|
+
this.endpoint = endpoint;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public static tryCreate(
|
|
44
|
+
logger: Logger,
|
|
45
|
+
nodeStorage: NodeStorage,
|
|
46
|
+
networkClient: INetworkModule,
|
|
47
|
+
cryptoProvider: CryptoProvider
|
|
48
|
+
): Imds {
|
|
49
|
+
let endpoint: string;
|
|
50
|
+
|
|
51
|
+
if (process.env["AZURE_POD_IDENTITY_AUTHORITY_HOST"]) {
|
|
52
|
+
logger.info(
|
|
53
|
+
`[Managed Identity] Environment variable AZURE_POD_IDENTITY_AUTHORITY_HOST for IMDS returned endpoint: ${process.env["AZURE_POD_IDENTITY_AUTHORITY_HOST"]}`
|
|
54
|
+
);
|
|
55
|
+
endpoint = `${process.env["AZURE_POD_IDENTITY_AUTHORITY_HOST"]}${IMDS_TOKEN_PATH}`;
|
|
56
|
+
} else {
|
|
57
|
+
logger.info(
|
|
58
|
+
"[Managed Identity] Unable to find AZURE_POD_IDENTITY_AUTHORITY_HOST environment variable for IMDS, using the default endpoint."
|
|
59
|
+
);
|
|
60
|
+
endpoint = DEFAULT_IMDS_ENDPOINT;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return new Imds(
|
|
64
|
+
logger,
|
|
65
|
+
nodeStorage,
|
|
66
|
+
networkClient,
|
|
67
|
+
cryptoProvider,
|
|
68
|
+
endpoint
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public createRequest(
|
|
73
|
+
resource: string,
|
|
74
|
+
managedIdentityId: ManagedIdentityId
|
|
75
|
+
): ManagedIdentityRequestParameters {
|
|
76
|
+
const request: ManagedIdentityRequestParameters =
|
|
77
|
+
new ManagedIdentityRequestParameters(HttpMethod.GET, this.endpoint);
|
|
78
|
+
|
|
79
|
+
request.headers[METADATA_HEADER_NAME] = "true";
|
|
80
|
+
request.queryParameters["api-version"] = IMDS_API_VERSION;
|
|
81
|
+
request.queryParameters["resource"] = resource;
|
|
82
|
+
// bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
|
|
83
|
+
|
|
84
|
+
switch (managedIdentityId.idType) {
|
|
85
|
+
case ManagedIdentityIdType.USER_ASSIGNED_CLIENT_ID:
|
|
86
|
+
this.logger.info(
|
|
87
|
+
"[Managed Identity] Adding user assigned client id to the request."
|
|
88
|
+
);
|
|
89
|
+
request.queryParameters[MANAGED_IDENTITY_CLIENT_ID] =
|
|
90
|
+
managedIdentityId.id;
|
|
91
|
+
break;
|
|
92
|
+
|
|
93
|
+
case ManagedIdentityIdType.USER_ASSIGNED_RESOURCE_ID:
|
|
94
|
+
this.logger.info(
|
|
95
|
+
"[Managed Identity] Adding user assigned resource id to the request."
|
|
96
|
+
);
|
|
97
|
+
request.queryParameters[MANAGED_IDENTITY_RESOURCE_ID] =
|
|
98
|
+
managedIdentityId.id;
|
|
99
|
+
break;
|
|
100
|
+
|
|
101
|
+
case ManagedIdentityIdType.USER_ASSIGNED_OBJECT_ID:
|
|
102
|
+
this.logger.info(
|
|
103
|
+
"[Managed Identity] Adding user assigned object id to the request."
|
|
104
|
+
);
|
|
105
|
+
request.queryParameters[MANAGED_IDENTITY_OBJECT_ID] =
|
|
106
|
+
managedIdentityId.id;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return request;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ManagedIdentityId } from "../../config/ManagedIdentityId";
|
|
7
|
+
import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters";
|
|
8
|
+
import { BaseManagedIdentitySource } from "./BaseManagedIdentitySource";
|
|
9
|
+
|
|
10
|
+
export class ServiceFabric extends BaseManagedIdentitySource {
|
|
11
|
+
public createRequest(
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
|
+
_resource: string,
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
+
_managedIdentityId: ManagedIdentityId
|
|
16
|
+
): ManagedIdentityRequestParameters {
|
|
17
|
+
throw new Error("Method not implemented.");
|
|
18
|
+
}
|
|
19
|
+
}
|