@azure/msal-node 2.5.1 → 2.7.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/ITokenCache.d.ts +15 -15
- package/dist/cache/NodeStorage.cjs +423 -405
- package/dist/cache/NodeStorage.cjs.map +1 -1
- package/dist/cache/NodeStorage.d.ts +193 -182
- package/dist/cache/NodeStorage.d.ts.map +1 -1
- package/dist/cache/NodeStorage.mjs +424 -406
- package/dist/cache/NodeStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.cjs +265 -265
- package/dist/cache/TokenCache.cjs.map +1 -1
- package/dist/cache/TokenCache.d.ts +90 -90
- package/dist/cache/TokenCache.mjs +265 -265
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.cjs +26 -26
- package/dist/cache/distributed/DistributedCachePlugin.cjs.map +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.d.ts +10 -10
- package/dist/cache/distributed/DistributedCachePlugin.mjs +26 -26
- package/dist/cache/distributed/DistributedCachePlugin.mjs.map +1 -1
- package/dist/cache/distributed/ICacheClient.d.ts +17 -17
- package/dist/cache/distributed/IPartitionManager.d.ts +28 -28
- package/dist/cache/serializer/Deserializer.cjs +170 -167
- package/dist/cache/serializer/Deserializer.cjs.map +1 -1
- package/dist/cache/serializer/Deserializer.d.ts +42 -42
- package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
- package/dist/cache/serializer/Deserializer.mjs +170 -167
- package/dist/cache/serializer/Deserializer.mjs.map +1 -1
- package/dist/cache/serializer/Serializer.cjs +137 -134
- package/dist/cache/serializer/Serializer.cjs.map +1 -1
- package/dist/cache/serializer/Serializer.d.ts +39 -39
- package/dist/cache/serializer/Serializer.d.ts.map +1 -1
- package/dist/cache/serializer/Serializer.mjs +137 -134
- package/dist/cache/serializer/Serializer.mjs.map +1 -1
- package/dist/cache/serializer/SerializerTypes.d.ts +102 -101
- package/dist/cache/serializer/SerializerTypes.d.ts.map +1 -1
- package/dist/client/ClientApplication.cjs +333 -333
- package/dist/client/ClientApplication.cjs.map +1 -1
- package/dist/client/ClientApplication.d.ts +142 -142
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.mjs +333 -333
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.cjs +116 -116
- package/dist/client/ClientAssertion.cjs.map +1 -1
- package/dist/client/ClientAssertion.d.ts +46 -46
- package/dist/client/ClientAssertion.mjs +116 -116
- package/dist/client/ClientAssertion.mjs.map +1 -1
- package/dist/client/ClientCredentialClient.cjs +194 -189
- package/dist/client/ClientCredentialClient.cjs.map +1 -1
- package/dist/client/ClientCredentialClient.d.ts +33 -33
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.mjs +195 -190
- package/dist/client/ClientCredentialClient.mjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.cjs +163 -163
- package/dist/client/ConfidentialClientApplication.cjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.d.ts +58 -58
- package/dist/client/ConfidentialClientApplication.mjs +163 -163
- package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
- package/dist/client/DeviceCodeClient.cjs +207 -207
- package/dist/client/DeviceCodeClient.cjs.map +1 -1
- package/dist/client/DeviceCodeClient.d.ts +53 -53
- package/dist/client/DeviceCodeClient.mjs +207 -207
- package/dist/client/DeviceCodeClient.mjs.map +1 -1
- package/dist/client/IConfidentialClientApplication.d.ts +39 -39
- package/dist/client/IPublicClientApplication.d.ts +42 -42
- 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 +202 -202
- package/dist/client/OnBehalfOfClient.cjs.map +1 -1
- package/dist/client/OnBehalfOfClient.d.ts +47 -47
- package/dist/client/OnBehalfOfClient.mjs +202 -202
- package/dist/client/OnBehalfOfClient.mjs.map +1 -1
- package/dist/client/PublicClientApplication.cjs +229 -229
- package/dist/client/PublicClientApplication.cjs.map +1 -1
- package/dist/client/PublicClientApplication.d.ts +71 -71
- package/dist/client/PublicClientApplication.mjs +229 -229
- package/dist/client/PublicClientApplication.mjs.map +1 -1
- package/dist/client/UsernamePasswordClient.cjs +95 -95
- package/dist/client/UsernamePasswordClient.cjs.map +1 -1
- package/dist/client/UsernamePasswordClient.d.ts +25 -25
- package/dist/client/UsernamePasswordClient.mjs +95 -95
- package/dist/client/UsernamePasswordClient.mjs.map +1 -1
- package/dist/config/Configuration.cjs +88 -72
- package/dist/config/Configuration.cjs.map +1 -1
- package/dist/config/Configuration.d.ts +122 -107
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +88 -73
- 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 +75 -75
- package/dist/crypto/CryptoProvider.cjs.map +1 -1
- package/dist/crypto/CryptoProvider.d.ts +52 -52
- package/dist/crypto/CryptoProvider.mjs +75 -75
- package/dist/crypto/CryptoProvider.mjs.map +1 -1
- package/dist/crypto/GuidGenerator.cjs +22 -22
- package/dist/crypto/GuidGenerator.cjs.map +1 -1
- package/dist/crypto/GuidGenerator.d.ts +14 -14
- package/dist/crypto/GuidGenerator.mjs +22 -22
- package/dist/crypto/GuidGenerator.mjs.map +1 -1
- package/dist/crypto/HashUtils.cjs +13 -13
- package/dist/crypto/HashUtils.cjs.map +1 -1
- package/dist/crypto/HashUtils.d.ts +8 -8
- package/dist/crypto/HashUtils.mjs +13 -13
- package/dist/crypto/HashUtils.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.cjs +49 -49
- package/dist/crypto/PkceGenerator.cjs.map +1 -1
- package/dist/crypto/PkceGenerator.d.ts +22 -22
- package/dist/crypto/PkceGenerator.mjs +49 -49
- package/dist/crypto/PkceGenerator.mjs.map +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 +85 -85
- package/dist/error/NodeAuthError.cjs.map +1 -1
- package/dist/error/NodeAuthError.d.ts +65 -65
- package/dist/error/NodeAuthError.mjs +85 -85
- package/dist/error/NodeAuthError.mjs.map +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +44 -42
- 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 +8 -8
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.d.ts +6 -6
- package/dist/internals.mjs +8 -8
- package/dist/internals.mjs.map +1 -1
- package/dist/network/HttpClient.cjs +283 -276
- package/dist/network/HttpClient.cjs.map +1 -1
- package/dist/network/HttpClient.d.ts +26 -25
- package/dist/network/HttpClient.d.ts.map +1 -1
- package/dist/network/HttpClient.mjs +283 -276
- package/dist/network/HttpClient.mjs.map +1 -1
- package/dist/network/ILoopbackClient.d.ts +10 -10
- package/dist/network/LoopbackClient.cjs +77 -77
- package/dist/network/LoopbackClient.cjs.map +1 -1
- package/dist/network/LoopbackClient.d.ts +21 -21
- package/dist/network/LoopbackClient.mjs +77 -77
- package/dist/network/LoopbackClient.mjs.map +1 -1
- package/dist/packageMetadata.cjs +4 -4
- package/dist/packageMetadata.cjs.map +1 -1
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +4 -4
- package/dist/packageMetadata.mjs.map +1 -1
- 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 +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/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 +25 -0
- package/dist/response/ManagedIdentityTokenResponse.d.ts.map +1 -0
- package/dist/utils/Constants.cjs +109 -80
- package/dist/utils/Constants.cjs.map +1 -1
- package/dist/utils/Constants.d.ts +106 -86
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +100 -81
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/EncodingUtils.cjs +44 -44
- package/dist/utils/EncodingUtils.cjs.map +1 -1
- package/dist/utils/EncodingUtils.d.ts +26 -26
- package/dist/utils/EncodingUtils.mjs +44 -44
- package/dist/utils/EncodingUtils.mjs.map +1 -1
- package/dist/utils/NetworkUtils.cjs +38 -38
- package/dist/utils/NetworkUtils.cjs.map +1 -1
- package/dist/utils/NetworkUtils.d.ts +5 -5
- package/dist/utils/NetworkUtils.mjs +38 -38
- package/dist/utils/NetworkUtils.mjs.map +1 -1
- package/package.json +3 -3
- package/src/cache/NodeStorage.ts +24 -7
- package/src/cache/TokenCache.ts +1 -1
- package/src/cache/serializer/Deserializer.ts +5 -0
- package/src/cache/serializer/Serializer.ts +5 -0
- package/src/cache/serializer/SerializerTypes.ts +1 -0
- package/src/client/ClientApplication.ts +10 -9
- package/src/client/ClientCredentialClient.ts +72 -27
- package/src/client/ConfidentialClientApplication.ts +2 -2
- package/src/client/DeviceCodeClient.ts +1 -1
- 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/client/OnBehalfOfClient.ts +5 -5
- package/src/client/PublicClientApplication.ts +1 -1
- 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 +4 -0
- package/src/network/HttpClient.ts +17 -5
- 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
|
@@ -20,13 +20,16 @@ import https from "https";
|
|
|
20
20
|
export class HttpClient implements INetworkModule {
|
|
21
21
|
private proxyUrl: string;
|
|
22
22
|
private customAgentOptions: http.AgentOptions | https.AgentOptions;
|
|
23
|
+
private managedIdentity: boolean;
|
|
23
24
|
|
|
24
25
|
constructor(
|
|
25
26
|
proxyUrl?: string,
|
|
26
|
-
customAgentOptions?: http.AgentOptions | https.AgentOptions
|
|
27
|
+
customAgentOptions?: http.AgentOptions | https.AgentOptions,
|
|
28
|
+
managedIdentity?: boolean
|
|
27
29
|
) {
|
|
28
30
|
this.proxyUrl = proxyUrl || "";
|
|
29
31
|
this.customAgentOptions = customAgentOptions || {};
|
|
32
|
+
this.managedIdentity = managedIdentity || false;
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
/**
|
|
@@ -51,7 +54,9 @@ export class HttpClient implements INetworkModule {
|
|
|
51
54
|
url,
|
|
52
55
|
HttpMethod.GET,
|
|
53
56
|
options,
|
|
54
|
-
this.customAgentOptions as https.AgentOptions
|
|
57
|
+
this.customAgentOptions as https.AgentOptions,
|
|
58
|
+
undefined,
|
|
59
|
+
this.managedIdentity
|
|
55
60
|
);
|
|
56
61
|
}
|
|
57
62
|
}
|
|
@@ -81,7 +86,8 @@ export class HttpClient implements INetworkModule {
|
|
|
81
86
|
HttpMethod.POST,
|
|
82
87
|
options,
|
|
83
88
|
this.customAgentOptions as https.AgentOptions,
|
|
84
|
-
cancellationToken
|
|
89
|
+
cancellationToken,
|
|
90
|
+
this.managedIdentity
|
|
85
91
|
);
|
|
86
92
|
}
|
|
87
93
|
}
|
|
@@ -277,7 +283,8 @@ const networkRequestViaHttps = <T>(
|
|
|
277
283
|
httpMethod: string,
|
|
278
284
|
options?: NetworkRequestOptions,
|
|
279
285
|
agentOptions?: https.AgentOptions,
|
|
280
|
-
timeout?: number
|
|
286
|
+
timeout?: number,
|
|
287
|
+
managedIdentity?: boolean
|
|
281
288
|
): Promise<NetworkResponse<T>> => {
|
|
282
289
|
const isPostRequest = httpMethod === HttpMethod.POST;
|
|
283
290
|
const body: string = options?.body || "";
|
|
@@ -307,7 +314,12 @@ const networkRequestViaHttps = <T>(
|
|
|
307
314
|
}
|
|
308
315
|
|
|
309
316
|
return new Promise<NetworkResponse<T>>((resolve, reject) => {
|
|
310
|
-
|
|
317
|
+
let request: http.ClientRequest;
|
|
318
|
+
if (managedIdentity) {
|
|
319
|
+
request = http.request(customOptions);
|
|
320
|
+
} else {
|
|
321
|
+
request = https.request(customOptions);
|
|
322
|
+
}
|
|
311
323
|
|
|
312
324
|
if (timeout) {
|
|
313
325
|
request.on("timeout", () => {
|
package/src/packageMetadata.ts
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { CommonClientCredentialRequest } from "@azure/msal-common";
|
|
7
|
+
import { ManagedIdentityRequestParams } from "./ManagedIdentityRequestParams";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* ManagedIdentityRequest
|
|
11
|
+
* - forceRefresh - forces managed identity requests to skip the cache and make network calls if true
|
|
12
|
+
* - resource - resource requested to access the protected API. It should be of the form "{ResourceIdUri}" or {ResourceIdUri/.default}. For instance https://management.azure.net or, for Microsoft Graph, https://graph.microsoft.com/.default
|
|
13
|
+
*/
|
|
14
|
+
export type ManagedIdentityRequest = ManagedIdentityRequestParams &
|
|
15
|
+
CommonClientCredentialRequest;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ManagedIdentityRequest
|
|
8
|
+
* - forceRefresh - forces managed identity requests to skip the cache and make network calls if true
|
|
9
|
+
* - resource - resource requested to access the protected API. It should be of the form "{ResourceIdUri}" or {ResourceIdUri/.default}. For instance https://management.azure.net or, for Microsoft Graph, https://graph.microsoft.com/.default
|
|
10
|
+
*/
|
|
11
|
+
export type ManagedIdentityRequestParams = {
|
|
12
|
+
forceRefresh?: boolean;
|
|
13
|
+
resource: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { AuthenticationScheme } from "@azure/msal-common";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Deserialized response object from server managed identity request.
|
|
10
|
+
*
|
|
11
|
+
* In case of success:
|
|
12
|
+
* - access_token - The requested access token. When called via a secured REST API, the token is embedded in the Authorization request header field as a "bearer" token, allowing the API to authenticate the caller
|
|
13
|
+
* - client_id - A unique identifier generated by Azure AD for the Azure Resource. The Client ID is a GUID value that uniquely identifies the application and its configuration within the identity platform
|
|
14
|
+
* - expires_on - The timespan when the access token expires. The date is represented as the number of seconds from "1970-01-01T0:0:0Z UTC" (corresponds to the token's exp claim)
|
|
15
|
+
* - resource - The resource the access token was requested for. It matches the resource query string parameter of the request
|
|
16
|
+
* - token_type - The type of token returned by the Managed Identity endpoint. It's a "Bearer" access token, which means the resource can give access to the bearer of this token
|
|
17
|
+
*
|
|
18
|
+
* In case of error:
|
|
19
|
+
* - message: A specific error message that can help a developer identify the root cause of an authentication error.
|
|
20
|
+
* - correlationId: A unique identifier for the request that can help in diagnostics across components.
|
|
21
|
+
*/
|
|
22
|
+
export type ManagedIdentityTokenResponse = {
|
|
23
|
+
// success
|
|
24
|
+
access_token?: string;
|
|
25
|
+
client_id?: string;
|
|
26
|
+
expires_on?: number; // will be converted to expires_in
|
|
27
|
+
resource?: string; // equivalent to ServerAuthorizationTokenResponse's "scope" field
|
|
28
|
+
token_type?: AuthenticationScheme;
|
|
29
|
+
|
|
30
|
+
// error
|
|
31
|
+
message?: string; // will be converted to error
|
|
32
|
+
correlationId?: string; // will be converted to correlation_id
|
|
33
|
+
};
|
package/src/utils/Constants.ts
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
// MSI Constants. Docs for MSI are available here https://docs.microsoft.com/azure/app-service/overview-managed-identity
|
|
7
|
+
export const AUTHORIZATION_HEADER_NAME: string = "Authorization";
|
|
8
|
+
export const METADATA_HEADER_NAME: string = "Metadata";
|
|
9
|
+
export const SECRET_HEADER_NAME: string = "X-IDENTITY-HEADER";
|
|
10
|
+
|
|
11
|
+
export const MANAGED_IDENTITY_CLIENT_ID = "client_id";
|
|
12
|
+
export const MANAGED_IDENTITY_OBJECT_ID = "object_id";
|
|
13
|
+
export const MANAGED_IDENTITY_RESOURCE_ID = "mi_res_id";
|
|
14
|
+
export const DEFAULT_MANAGED_IDENTITY_ID = "system_assigned_managed_identity";
|
|
15
|
+
export const MANAGED_IDENTITY_DEFAULT_TENANT = "managed_identity";
|
|
16
|
+
export const DEFAULT_AUTHORITY_FOR_MANAGED_IDENTITY = `https://login.microsoftonline.com/${MANAGED_IDENTITY_DEFAULT_TENANT}/`;
|
|
17
|
+
|
|
18
|
+
export const MANAGED_IDENTITY_TIMEOUT_ERROR: string =
|
|
19
|
+
"[Managed Identity] Authentication unavailable. The request to the managed identity endpoint timed out.";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Managed Identity Ids
|
|
23
|
+
*/
|
|
24
|
+
export const ManagedIdentityIdType = {
|
|
25
|
+
SYSTEM_ASSIGNED: "system-assigned",
|
|
26
|
+
USER_ASSIGNED_CLIENT_ID: "user-assigned-client-id",
|
|
27
|
+
USER_ASSIGNED_RESOURCE_ID: "user-assigned-resource-id",
|
|
28
|
+
USER_ASSIGNED_OBJECT_ID: "user-assigned-object-id",
|
|
29
|
+
} as const;
|
|
30
|
+
export type ManagedIdentityIdType =
|
|
31
|
+
(typeof ManagedIdentityIdType)[keyof typeof ManagedIdentityIdType];
|
|
32
|
+
|
|
6
33
|
/**
|
|
7
34
|
* http methods
|
|
8
35
|
*/
|