@azure/identity 2.1.0-beta.1 → 2.1.0-beta.2
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.
Potentially problematic release.
This version of @azure/identity might be problematic. Click here for more details.
- package/CHANGELOG.md +16 -2
- package/README.md +4 -3
- package/dist/index.js +281 -182
- package/dist/index.js.map +1 -1
- package/dist-esm/src/client/identityClient.js +38 -2
- package/dist-esm/src/client/identityClient.js.map +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.js +5 -2
- package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
- package/dist-esm/src/credentials/defaultAzureCredential.js +13 -26
- package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js +77 -0
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js.map +1 -0
- package/dist-esm/src/credentials/managedIdentityCredential/index.js +10 -1
- package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredential.js +0 -21
- package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js.map +1 -1
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js +5 -1
- package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js +0 -2
- package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalNodeCommon.js +12 -1
- package/dist-esm/src/msal/nodeFlows/msalNodeCommon.js.map +1 -1
- package/dist-esm/src/tokenCredentialOptions.js.map +1 -1
- package/package.json +7 -7
- package/types/identity.d.ts +132 -57
package/types/identity.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { AccessToken } from '@azure/core-auth';
|
|
|
2
2
|
import { AzureLogger } from '@azure/logger';
|
|
3
3
|
import { CommonClientOptions } from '@azure/core-client';
|
|
4
4
|
import { GetTokenOptions } from '@azure/core-auth';
|
|
5
|
+
import { LogPolicyOptions } from '@azure/core-rest-pipeline';
|
|
5
6
|
import { TokenCredential } from '@azure/core-auth';
|
|
6
7
|
|
|
7
8
|
export { AccessToken }
|
|
@@ -122,7 +123,7 @@ export declare class AuthorizationCodeCredential implements TokenCredential {
|
|
|
122
123
|
private authorizationCode;
|
|
123
124
|
private redirectUri;
|
|
124
125
|
/**
|
|
125
|
-
* Creates an instance of
|
|
126
|
+
* Creates an instance of AuthorizationCodeCredential with the details needed
|
|
126
127
|
* to request an access token using an authentication that was obtained
|
|
127
128
|
* from Azure Active Directory.
|
|
128
129
|
*
|
|
@@ -145,7 +146,7 @@ export declare class AuthorizationCodeCredential implements TokenCredential {
|
|
|
145
146
|
*/
|
|
146
147
|
constructor(tenantId: string | "common", clientId: string, clientSecret: string, authorizationCode: string, redirectUri: string, options?: TokenCredentialOptions);
|
|
147
148
|
/**
|
|
148
|
-
* Creates an instance of
|
|
149
|
+
* Creates an instance of AuthorizationCodeCredential with the details needed
|
|
149
150
|
* to request an access token using an authentication that was obtained
|
|
150
151
|
* from Azure Active Directory.
|
|
151
152
|
*
|
|
@@ -357,11 +358,22 @@ export declare class ClientCertificateCredential implements TokenCredential {
|
|
|
357
358
|
*
|
|
358
359
|
* @param tenantId - The Azure Active Directory tenant (directory) ID.
|
|
359
360
|
* @param clientId - The client (application) ID of an App Registration in the tenant.
|
|
360
|
-
* @param configuration - Other parameters required, including the
|
|
361
|
-
* If the type is ignored, we will throw
|
|
361
|
+
* @param configuration - Other parameters required, including the path of the certificate on the filesystem.
|
|
362
|
+
* If the type is ignored, we will throw the value of the path to a PEM certificate.
|
|
362
363
|
* @param options - Options for configuring the client which makes the authentication request.
|
|
363
364
|
*/
|
|
364
|
-
constructor(tenantId: string, clientId: string, configuration:
|
|
365
|
+
constructor(tenantId: string, clientId: string, configuration: ClientCertificatePEMCertificatePath, options?: ClientCertificateCredentialOptions);
|
|
366
|
+
/**
|
|
367
|
+
* Creates an instance of the ClientCertificateCredential with the details
|
|
368
|
+
* needed to authenticate against Azure Active Directory with a certificate.
|
|
369
|
+
*
|
|
370
|
+
* @param tenantId - The Azure Active Directory tenant (directory) ID.
|
|
371
|
+
* @param clientId - The client (application) ID of an App Registration in the tenant.
|
|
372
|
+
* @param configuration - Other parameters required, including the PEM-encoded certificate as a string.
|
|
373
|
+
* If the type is ignored, we will throw the value of the PEM-encoded certificate.
|
|
374
|
+
* @param options - Options for configuring the client which makes the authentication request.
|
|
375
|
+
*/
|
|
376
|
+
constructor(tenantId: string, clientId: string, configuration: ClientCertificatePEMCertificate, options?: ClientCertificateCredentialOptions);
|
|
365
377
|
/**
|
|
366
378
|
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
367
379
|
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
@@ -387,25 +399,27 @@ export declare interface ClientCertificateCredentialOptions extends TokenCredent
|
|
|
387
399
|
/**
|
|
388
400
|
* Required configuration options for the {@link ClientCertificateCredential}, with either the string contents of a PEM certificate, or the path to a PEM certificate.
|
|
389
401
|
*/
|
|
390
|
-
export declare type ClientCertificateCredentialPEMConfiguration =
|
|
402
|
+
export declare type ClientCertificateCredentialPEMConfiguration = ClientCertificatePEMCertificate | ClientCertificatePEMCertificatePath;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Required configuration options for the {@link ClientCertificateCredential}, with the string contents of a PEM certificate
|
|
406
|
+
*/
|
|
407
|
+
export declare interface ClientCertificatePEMCertificate {
|
|
391
408
|
/**
|
|
392
409
|
* The PEM-encoded public/private key certificate on the filesystem.
|
|
393
410
|
*/
|
|
394
411
|
certificate: string;
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
* The PEM-encoded public/private key certificate on the filesystem should not be provided if `certificatePath` is provided.
|
|
402
|
-
*/
|
|
403
|
-
certificate?: never;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Required configuration options for the {@link ClientCertificateCredential}, with the path to a PEM certificate.
|
|
416
|
+
*/
|
|
417
|
+
export declare interface ClientCertificatePEMCertificatePath {
|
|
404
418
|
/**
|
|
405
419
|
* The path to the PEM-encoded public/private key certificate on the filesystem.
|
|
406
420
|
*/
|
|
407
421
|
certificatePath: string;
|
|
408
|
-
}
|
|
422
|
+
}
|
|
409
423
|
|
|
410
424
|
/**
|
|
411
425
|
* Enables authentication to Azure Active Directory using a client secret
|
|
@@ -502,7 +516,55 @@ export declare const CredentialUnavailableErrorName = "CredentialUnavailableErro
|
|
|
502
516
|
*/
|
|
503
517
|
export declare class DefaultAzureCredential extends ChainedTokenCredential {
|
|
504
518
|
/**
|
|
505
|
-
* Creates an instance of the DefaultAzureCredential class
|
|
519
|
+
* Creates an instance of the DefaultAzureCredential class with {@link DefaultAzureCredentialClientIdOptions}
|
|
520
|
+
*
|
|
521
|
+
* This credential provides a default {@link ChainedTokenCredential} configuration that should
|
|
522
|
+
* work for most applications that use the Azure SDK.
|
|
523
|
+
*
|
|
524
|
+
* The following credential types will be tried, in order:
|
|
525
|
+
*
|
|
526
|
+
* - {@link EnvironmentCredential}
|
|
527
|
+
* - {@link ManagedIdentityCredential}
|
|
528
|
+
* - {@link VisualStudioCodeCredential}
|
|
529
|
+
* - {@link AzureCliCredential}
|
|
530
|
+
* - {@link AzurePowerShellCredential}
|
|
531
|
+
*
|
|
532
|
+
* Consult the documentation of these credential types for more information
|
|
533
|
+
* on how they attempt authentication.
|
|
534
|
+
*
|
|
535
|
+
* **Note**: `VisualStudioCodeCredential` is provided by a plugin package:
|
|
536
|
+
* `@azure/identity-vscode`. If this package is not installed and registered
|
|
537
|
+
* using the plugin API (`useIdentityPlugin`), then authentication using
|
|
538
|
+
* `VisualStudioCodeCredential` will not be available.
|
|
539
|
+
* @param options - Optional parameters. See {@link DefaultAzureCredentialClientIdOptions}.
|
|
540
|
+
*/
|
|
541
|
+
constructor(options?: DefaultAzureCredentialClientIdOptions);
|
|
542
|
+
/**
|
|
543
|
+
* Creates an instance of the DefaultAzureCredential class with {@link DefaultAzureCredentialResourceIdOptions}
|
|
544
|
+
*
|
|
545
|
+
* This credential provides a default {@link ChainedTokenCredential} configuration that should
|
|
546
|
+
* work for most applications that use the Azure SDK.
|
|
547
|
+
*
|
|
548
|
+
* The following credential types will be tried, in order:
|
|
549
|
+
*
|
|
550
|
+
* - {@link EnvironmentCredential}
|
|
551
|
+
* - {@link ManagedIdentityCredential}
|
|
552
|
+
* - {@link VisualStudioCodeCredential}
|
|
553
|
+
* - {@link AzureCliCredential}
|
|
554
|
+
* - {@link AzurePowerShellCredential}
|
|
555
|
+
*
|
|
556
|
+
* Consult the documentation of these credential types for more information
|
|
557
|
+
* on how they attempt authentication.
|
|
558
|
+
*
|
|
559
|
+
* **Note**: `VisualStudioCodeCredential` is provided by a plugin package:
|
|
560
|
+
* `@azure/identity-vscode`. If this package is not installed and registered
|
|
561
|
+
* using the plugin API (`useIdentityPlugin`), then authentication using
|
|
562
|
+
* `VisualStudioCodeCredential` will not be available.
|
|
563
|
+
* @param options - Optional parameters. See {@link DefaultAzureCredentialResourceIdOptions}.
|
|
564
|
+
*/
|
|
565
|
+
constructor(options?: DefaultAzureCredentialResourceIdOptions);
|
|
566
|
+
/**
|
|
567
|
+
* Creates an instance of the DefaultAzureCredential class with {@link DefaultAzureCredentialOptions}
|
|
506
568
|
*
|
|
507
569
|
* This credential provides a default {@link ChainedTokenCredential} configuration that should
|
|
508
570
|
* work for most applications that use the Azure SDK.
|
|
@@ -532,12 +594,7 @@ export declare class DefaultAzureCredential extends ChainedTokenCredential {
|
|
|
532
594
|
* Provides options to configure the {@link DefaultAzureCredential} class.
|
|
533
595
|
* This variation supports `managedIdentityClientId` and not `managedIdentityResourceId`, since only one of both is supported.
|
|
534
596
|
*/
|
|
535
|
-
export declare interface DefaultAzureCredentialClientIdOptions extends
|
|
536
|
-
/**
|
|
537
|
-
* Optionally pass in a Tenant ID to be used as part of the credential.
|
|
538
|
-
* By default it may use a generic tenant ID depending on the underlying credential.
|
|
539
|
-
*/
|
|
540
|
-
tenantId?: string;
|
|
597
|
+
export declare interface DefaultAzureCredentialClientIdOptions extends DefaultAzureCredentialOptions {
|
|
541
598
|
/**
|
|
542
599
|
* Optionally pass in a user assigned client ID to be used by the {@link ManagedIdentityCredential}.
|
|
543
600
|
* This client ID can also be passed through to the {@link ManagedIdentityCredential} through the environment variable: AZURE_CLIENT_ID.
|
|
@@ -548,18 +605,19 @@ export declare interface DefaultAzureCredentialClientIdOptions extends TokenCred
|
|
|
548
605
|
/**
|
|
549
606
|
* Provides options to configure the {@link DefaultAzureCredential} class.
|
|
550
607
|
*/
|
|
551
|
-
export declare
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* Provides options to configure the {@link DefaultAzureCredential} class.
|
|
555
|
-
* This variation supports `managedIdentityResourceId` and not `managedIdentityClientId`, since only one of both is supported.
|
|
556
|
-
*/
|
|
557
|
-
export declare interface DefaultAzureCredentialResourceIdOptions extends TokenCredentialOptions {
|
|
608
|
+
export declare interface DefaultAzureCredentialOptions extends TokenCredentialOptions {
|
|
558
609
|
/**
|
|
559
610
|
* Optionally pass in a Tenant ID to be used as part of the credential.
|
|
560
611
|
* By default it may use a generic tenant ID depending on the underlying credential.
|
|
561
612
|
*/
|
|
562
613
|
tenantId?: string;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Provides options to configure the {@link DefaultAzureCredential} class.
|
|
618
|
+
* This variation supports `managedIdentityResourceId` and not `managedIdentityClientId`, since only one of both is supported.
|
|
619
|
+
*/
|
|
620
|
+
export declare interface DefaultAzureCredentialResourceIdOptions extends DefaultAzureCredentialOptions {
|
|
563
621
|
/**
|
|
564
622
|
* Optionally pass in a resource ID to be used by the {@link ManagedIdentityCredential}.
|
|
565
623
|
* In scenarios such as when user assigned identities are created using an ARM template,
|
|
@@ -567,7 +625,7 @@ export declare interface DefaultAzureCredentialResourceIdOptions extends TokenCr
|
|
|
567
625
|
* this parameter allows programs to use these user assigned identities
|
|
568
626
|
* without having to first determine the client Id of the created identity.
|
|
569
627
|
*/
|
|
570
|
-
managedIdentityResourceId
|
|
628
|
+
managedIdentityResourceId: string;
|
|
571
629
|
}
|
|
572
630
|
|
|
573
631
|
/**
|
|
@@ -940,11 +998,17 @@ export declare class ManagedIdentityCredential implements TokenCredential {
|
|
|
940
998
|
*/
|
|
941
999
|
constructor(clientId: string, options?: TokenCredentialOptions);
|
|
942
1000
|
/**
|
|
943
|
-
* Creates an instance of ManagedIdentityCredential
|
|
1001
|
+
* Creates an instance of ManagedIdentityCredential with clientId
|
|
944
1002
|
*
|
|
945
1003
|
* @param options - Options for configuring the client which makes the access token request.
|
|
946
1004
|
*/
|
|
947
|
-
constructor(options?:
|
|
1005
|
+
constructor(options?: ManagedIdentityCredentialClientIdOptions);
|
|
1006
|
+
/**
|
|
1007
|
+
* Creates an instance of ManagedIdentityCredential with Resource Id
|
|
1008
|
+
*
|
|
1009
|
+
* @param options - Options for configuring the resource which makes the access token request.
|
|
1010
|
+
*/
|
|
1011
|
+
constructor(options?: ManagedIdentityCredentialResourceIdOptions);
|
|
948
1012
|
private cachedMSI;
|
|
949
1013
|
private cachedAvailableMSI;
|
|
950
1014
|
private authenticateManagedIdentity;
|
|
@@ -971,11 +1035,6 @@ export declare interface ManagedIdentityCredentialClientIdOptions extends TokenC
|
|
|
971
1035
|
clientId?: string;
|
|
972
1036
|
}
|
|
973
1037
|
|
|
974
|
-
/**
|
|
975
|
-
* Options to send on the {@link ManagedIdentityCredential} constructor.
|
|
976
|
-
*/
|
|
977
|
-
export declare type ManagedIdentityCredentialOptions = ManagedIdentityCredentialClientIdOptions | ManagedIdentityCredentialResourceIdOptions;
|
|
978
|
-
|
|
979
1038
|
/**
|
|
980
1039
|
* Options to send on the {@link ManagedIdentityCredential} constructor.
|
|
981
1040
|
* This variation supports `resourceId` and not `clientId`, since only one of both is supported.
|
|
@@ -988,7 +1047,7 @@ export declare interface ManagedIdentityCredentialResourceIdOptions extends Toke
|
|
|
988
1047
|
* this parameter allows programs to use these user assigned identities
|
|
989
1048
|
* without having to first determine the client Id of the created identity.
|
|
990
1049
|
*/
|
|
991
|
-
resourceId
|
|
1050
|
+
resourceId: string;
|
|
992
1051
|
}
|
|
993
1052
|
|
|
994
1053
|
/**
|
|
@@ -997,10 +1056,32 @@ export declare interface ManagedIdentityCredentialResourceIdOptions extends Toke
|
|
|
997
1056
|
export declare class OnBehalfOfCredential implements TokenCredential {
|
|
998
1057
|
private options;
|
|
999
1058
|
private msalFlow;
|
|
1059
|
+
/**
|
|
1060
|
+
* Creates an instance of the {@link OnBehalfOfCredential} with the details
|
|
1061
|
+
* needed to authenticate against Azure Active Directory with path to a PEM certificate,
|
|
1062
|
+
* and an user assertion.
|
|
1063
|
+
*
|
|
1064
|
+
* Example using the `KeyClient` from [\@azure/keyvault-keys](https://www.npmjs.com/package/\@azure/keyvault-keys):
|
|
1065
|
+
*
|
|
1066
|
+
* ```ts
|
|
1067
|
+
* const tokenCredential = new OnBehalfOfCredential({
|
|
1068
|
+
* tenantId,
|
|
1069
|
+
* clientId,
|
|
1070
|
+
* certificatePath: "/path/to/certificate.pem",
|
|
1071
|
+
* userAssertionToken: "access-token"
|
|
1072
|
+
* });
|
|
1073
|
+
* const client = new KeyClient("vault-url", tokenCredential);
|
|
1074
|
+
*
|
|
1075
|
+
* await client.getKey("key-name");
|
|
1076
|
+
* ```
|
|
1077
|
+
*
|
|
1078
|
+
* @param options - Optional parameters, generally common across credentials.
|
|
1079
|
+
*/
|
|
1080
|
+
constructor(options: OnBehalfOfCredentialCertificateOptions & TokenCredentialOptions & CredentialPersistenceOptions);
|
|
1000
1081
|
/**
|
|
1001
1082
|
* Creates an instance of the {@link OnBehalfOfCredential} with the details
|
|
1002
1083
|
* needed to authenticate against Azure Active Directory with a client
|
|
1003
|
-
* secret
|
|
1084
|
+
* secret and an user assertion.
|
|
1004
1085
|
*
|
|
1005
1086
|
* Example using the `KeyClient` from [\@azure/keyvault-keys](https://www.npmjs.com/package/\@azure/keyvault-keys):
|
|
1006
1087
|
*
|
|
@@ -1008,7 +1089,7 @@ export declare class OnBehalfOfCredential implements TokenCredential {
|
|
|
1008
1089
|
* const tokenCredential = new OnBehalfOfCredential({
|
|
1009
1090
|
* tenantId,
|
|
1010
1091
|
* clientId,
|
|
1011
|
-
* clientSecret,
|
|
1092
|
+
* clientSecret,
|
|
1012
1093
|
* userAssertionToken: "access-token"
|
|
1013
1094
|
* });
|
|
1014
1095
|
* const client = new KeyClient("vault-url", tokenCredential);
|
|
@@ -1018,7 +1099,7 @@ export declare class OnBehalfOfCredential implements TokenCredential {
|
|
|
1018
1099
|
*
|
|
1019
1100
|
* @param options - Optional parameters, generally common across credentials.
|
|
1020
1101
|
*/
|
|
1021
|
-
constructor(options:
|
|
1102
|
+
constructor(options: OnBehalfOfCredentialSecretOptions & TokenCredentialOptions & CredentialPersistenceOptions);
|
|
1022
1103
|
/**
|
|
1023
1104
|
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
1024
1105
|
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
@@ -1045,19 +1126,15 @@ export declare interface OnBehalfOfCredentialCertificateOptions {
|
|
|
1045
1126
|
* The path to a PEM-encoded public/private key certificate on the filesystem.
|
|
1046
1127
|
*/
|
|
1047
1128
|
certificatePath: string;
|
|
1048
|
-
/**
|
|
1049
|
-
* Option to include x5c header for SubjectName and Issuer name authorization.
|
|
1050
|
-
* Set this option to send base64 encoded public certificate in the client assertion header as an x5c claim
|
|
1051
|
-
*/
|
|
1052
|
-
sendCertificateChain?: boolean;
|
|
1053
1129
|
/**
|
|
1054
1130
|
* The user assertion for the On-Behalf-Of flow.
|
|
1055
1131
|
*/
|
|
1056
1132
|
userAssertionToken: string;
|
|
1057
1133
|
/**
|
|
1058
|
-
*
|
|
1134
|
+
* Option to include x5c header for SubjectName and Issuer name authorization.
|
|
1135
|
+
* Set this option to send base64 encoded public certificate in the client assertion header as an x5c claim
|
|
1059
1136
|
*/
|
|
1060
|
-
|
|
1137
|
+
sendCertificateChain?: boolean;
|
|
1061
1138
|
}
|
|
1062
1139
|
|
|
1063
1140
|
/**
|
|
@@ -1085,14 +1162,6 @@ export declare interface OnBehalfOfCredentialSecretOptions {
|
|
|
1085
1162
|
* The user assertion for the On-Behalf-Of flow.
|
|
1086
1163
|
*/
|
|
1087
1164
|
userAssertionToken: string;
|
|
1088
|
-
/**
|
|
1089
|
-
* The path to a PEM-encoded certificate should not be provided when the secret options are provided.
|
|
1090
|
-
*/
|
|
1091
|
-
certificatePath?: never;
|
|
1092
|
-
/**
|
|
1093
|
-
* Option to include x5c header should not be provided when the secret options are provided.
|
|
1094
|
-
*/
|
|
1095
|
-
sendCertificateChain?: never;
|
|
1096
1165
|
}
|
|
1097
1166
|
|
|
1098
1167
|
/**
|
|
@@ -1148,6 +1217,12 @@ export declare interface TokenCredentialOptions extends CommonClientOptions {
|
|
|
1148
1217
|
* The default is "https://login.microsoftonline.com".
|
|
1149
1218
|
*/
|
|
1150
1219
|
authorityHost?: string;
|
|
1220
|
+
/**
|
|
1221
|
+
* Allows logging account information once the authentication flow succeeds.
|
|
1222
|
+
*/
|
|
1223
|
+
loggingOptions?: LogPolicyOptions & {
|
|
1224
|
+
allowLoggingAccountIdentifiers?: boolean;
|
|
1225
|
+
};
|
|
1151
1226
|
}
|
|
1152
1227
|
|
|
1153
1228
|
/**
|