@azure/identity 2.1.0-alpha.20220318.2 → 2.1.0-alpha.20220330.3
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 +4 -5
- package/README.md +1 -1
- package/dist/index.js +233 -179
- package/dist/index.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/package.json +2 -2
- package/types/identity.d.ts +123 -55
package/types/identity.d.ts
CHANGED
|
@@ -358,11 +358,22 @@ export declare class ClientCertificateCredential implements TokenCredential {
|
|
|
358
358
|
*
|
|
359
359
|
* @param tenantId - The Azure Active Directory tenant (directory) ID.
|
|
360
360
|
* @param clientId - The client (application) ID of an App Registration in the tenant.
|
|
361
|
-
* @param configuration - Other parameters required, including the
|
|
362
|
-
* 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.
|
|
363
363
|
* @param options - Options for configuring the client which makes the authentication request.
|
|
364
364
|
*/
|
|
365
|
-
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);
|
|
366
377
|
/**
|
|
367
378
|
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
368
379
|
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
@@ -388,25 +399,27 @@ export declare interface ClientCertificateCredentialOptions extends TokenCredent
|
|
|
388
399
|
/**
|
|
389
400
|
* Required configuration options for the {@link ClientCertificateCredential}, with either the string contents of a PEM certificate, or the path to a PEM certificate.
|
|
390
401
|
*/
|
|
391
|
-
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 {
|
|
392
408
|
/**
|
|
393
409
|
* The PEM-encoded public/private key certificate on the filesystem.
|
|
394
410
|
*/
|
|
395
411
|
certificate: string;
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
* The PEM-encoded public/private key certificate on the filesystem should not be provided if `certificatePath` is provided.
|
|
403
|
-
*/
|
|
404
|
-
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 {
|
|
405
418
|
/**
|
|
406
419
|
* The path to the PEM-encoded public/private key certificate on the filesystem.
|
|
407
420
|
*/
|
|
408
421
|
certificatePath: string;
|
|
409
|
-
}
|
|
422
|
+
}
|
|
410
423
|
|
|
411
424
|
/**
|
|
412
425
|
* Enables authentication to Azure Active Directory using a client secret
|
|
@@ -503,7 +516,55 @@ export declare const CredentialUnavailableErrorName = "CredentialUnavailableErro
|
|
|
503
516
|
*/
|
|
504
517
|
export declare class DefaultAzureCredential extends ChainedTokenCredential {
|
|
505
518
|
/**
|
|
506
|
-
* 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}
|
|
507
568
|
*
|
|
508
569
|
* This credential provides a default {@link ChainedTokenCredential} configuration that should
|
|
509
570
|
* work for most applications that use the Azure SDK.
|
|
@@ -533,12 +594,7 @@ export declare class DefaultAzureCredential extends ChainedTokenCredential {
|
|
|
533
594
|
* Provides options to configure the {@link DefaultAzureCredential} class.
|
|
534
595
|
* This variation supports `managedIdentityClientId` and not `managedIdentityResourceId`, since only one of both is supported.
|
|
535
596
|
*/
|
|
536
|
-
export declare interface DefaultAzureCredentialClientIdOptions extends
|
|
537
|
-
/**
|
|
538
|
-
* Optionally pass in a Tenant ID to be used as part of the credential.
|
|
539
|
-
* By default it may use a generic tenant ID depending on the underlying credential.
|
|
540
|
-
*/
|
|
541
|
-
tenantId?: string;
|
|
597
|
+
export declare interface DefaultAzureCredentialClientIdOptions extends DefaultAzureCredentialOptions {
|
|
542
598
|
/**
|
|
543
599
|
* Optionally pass in a user assigned client ID to be used by the {@link ManagedIdentityCredential}.
|
|
544
600
|
* This client ID can also be passed through to the {@link ManagedIdentityCredential} through the environment variable: AZURE_CLIENT_ID.
|
|
@@ -549,18 +605,19 @@ export declare interface DefaultAzureCredentialClientIdOptions extends TokenCred
|
|
|
549
605
|
/**
|
|
550
606
|
* Provides options to configure the {@link DefaultAzureCredential} class.
|
|
551
607
|
*/
|
|
552
|
-
export declare
|
|
553
|
-
|
|
554
|
-
/**
|
|
555
|
-
* Provides options to configure the {@link DefaultAzureCredential} class.
|
|
556
|
-
* This variation supports `managedIdentityResourceId` and not `managedIdentityClientId`, since only one of both is supported.
|
|
557
|
-
*/
|
|
558
|
-
export declare interface DefaultAzureCredentialResourceIdOptions extends TokenCredentialOptions {
|
|
608
|
+
export declare interface DefaultAzureCredentialOptions extends TokenCredentialOptions {
|
|
559
609
|
/**
|
|
560
610
|
* Optionally pass in a Tenant ID to be used as part of the credential.
|
|
561
611
|
* By default it may use a generic tenant ID depending on the underlying credential.
|
|
562
612
|
*/
|
|
563
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 {
|
|
564
621
|
/**
|
|
565
622
|
* Optionally pass in a resource ID to be used by the {@link ManagedIdentityCredential}.
|
|
566
623
|
* In scenarios such as when user assigned identities are created using an ARM template,
|
|
@@ -568,7 +625,7 @@ export declare interface DefaultAzureCredentialResourceIdOptions extends TokenCr
|
|
|
568
625
|
* this parameter allows programs to use these user assigned identities
|
|
569
626
|
* without having to first determine the client Id of the created identity.
|
|
570
627
|
*/
|
|
571
|
-
managedIdentityResourceId
|
|
628
|
+
managedIdentityResourceId: string;
|
|
572
629
|
}
|
|
573
630
|
|
|
574
631
|
/**
|
|
@@ -941,11 +998,17 @@ export declare class ManagedIdentityCredential implements TokenCredential {
|
|
|
941
998
|
*/
|
|
942
999
|
constructor(clientId: string, options?: TokenCredentialOptions);
|
|
943
1000
|
/**
|
|
944
|
-
* Creates an instance of ManagedIdentityCredential
|
|
1001
|
+
* Creates an instance of ManagedIdentityCredential with clientId
|
|
945
1002
|
*
|
|
946
1003
|
* @param options - Options for configuring the client which makes the access token request.
|
|
947
1004
|
*/
|
|
948
|
-
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);
|
|
949
1012
|
private cachedMSI;
|
|
950
1013
|
private cachedAvailableMSI;
|
|
951
1014
|
private authenticateManagedIdentity;
|
|
@@ -972,11 +1035,6 @@ export declare interface ManagedIdentityCredentialClientIdOptions extends TokenC
|
|
|
972
1035
|
clientId?: string;
|
|
973
1036
|
}
|
|
974
1037
|
|
|
975
|
-
/**
|
|
976
|
-
* Options to send on the {@link ManagedIdentityCredential} constructor.
|
|
977
|
-
*/
|
|
978
|
-
export declare type ManagedIdentityCredentialOptions = ManagedIdentityCredentialClientIdOptions | ManagedIdentityCredentialResourceIdOptions;
|
|
979
|
-
|
|
980
1038
|
/**
|
|
981
1039
|
* Options to send on the {@link ManagedIdentityCredential} constructor.
|
|
982
1040
|
* This variation supports `resourceId` and not `clientId`, since only one of both is supported.
|
|
@@ -989,7 +1047,7 @@ export declare interface ManagedIdentityCredentialResourceIdOptions extends Toke
|
|
|
989
1047
|
* this parameter allows programs to use these user assigned identities
|
|
990
1048
|
* without having to first determine the client Id of the created identity.
|
|
991
1049
|
*/
|
|
992
|
-
resourceId
|
|
1050
|
+
resourceId: string;
|
|
993
1051
|
}
|
|
994
1052
|
|
|
995
1053
|
/**
|
|
@@ -998,10 +1056,32 @@ export declare interface ManagedIdentityCredentialResourceIdOptions extends Toke
|
|
|
998
1056
|
export declare class OnBehalfOfCredential implements TokenCredential {
|
|
999
1057
|
private options;
|
|
1000
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);
|
|
1001
1081
|
/**
|
|
1002
1082
|
* Creates an instance of the {@link OnBehalfOfCredential} with the details
|
|
1003
1083
|
* needed to authenticate against Azure Active Directory with a client
|
|
1004
|
-
* secret
|
|
1084
|
+
* secret and an user assertion.
|
|
1005
1085
|
*
|
|
1006
1086
|
* Example using the `KeyClient` from [\@azure/keyvault-keys](https://www.npmjs.com/package/\@azure/keyvault-keys):
|
|
1007
1087
|
*
|
|
@@ -1009,7 +1089,7 @@ export declare class OnBehalfOfCredential implements TokenCredential {
|
|
|
1009
1089
|
* const tokenCredential = new OnBehalfOfCredential({
|
|
1010
1090
|
* tenantId,
|
|
1011
1091
|
* clientId,
|
|
1012
|
-
* clientSecret,
|
|
1092
|
+
* clientSecret,
|
|
1013
1093
|
* userAssertionToken: "access-token"
|
|
1014
1094
|
* });
|
|
1015
1095
|
* const client = new KeyClient("vault-url", tokenCredential);
|
|
@@ -1019,7 +1099,7 @@ export declare class OnBehalfOfCredential implements TokenCredential {
|
|
|
1019
1099
|
*
|
|
1020
1100
|
* @param options - Optional parameters, generally common across credentials.
|
|
1021
1101
|
*/
|
|
1022
|
-
constructor(options:
|
|
1102
|
+
constructor(options: OnBehalfOfCredentialSecretOptions & TokenCredentialOptions & CredentialPersistenceOptions);
|
|
1023
1103
|
/**
|
|
1024
1104
|
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
1025
1105
|
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
@@ -1046,19 +1126,15 @@ export declare interface OnBehalfOfCredentialCertificateOptions {
|
|
|
1046
1126
|
* The path to a PEM-encoded public/private key certificate on the filesystem.
|
|
1047
1127
|
*/
|
|
1048
1128
|
certificatePath: string;
|
|
1049
|
-
/**
|
|
1050
|
-
* Option to include x5c header for SubjectName and Issuer name authorization.
|
|
1051
|
-
* Set this option to send base64 encoded public certificate in the client assertion header as an x5c claim
|
|
1052
|
-
*/
|
|
1053
|
-
sendCertificateChain?: boolean;
|
|
1054
1129
|
/**
|
|
1055
1130
|
* The user assertion for the On-Behalf-Of flow.
|
|
1056
1131
|
*/
|
|
1057
1132
|
userAssertionToken: string;
|
|
1058
1133
|
/**
|
|
1059
|
-
*
|
|
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
|
|
1060
1136
|
*/
|
|
1061
|
-
|
|
1137
|
+
sendCertificateChain?: boolean;
|
|
1062
1138
|
}
|
|
1063
1139
|
|
|
1064
1140
|
/**
|
|
@@ -1086,14 +1162,6 @@ export declare interface OnBehalfOfCredentialSecretOptions {
|
|
|
1086
1162
|
* The user assertion for the On-Behalf-Of flow.
|
|
1087
1163
|
*/
|
|
1088
1164
|
userAssertionToken: string;
|
|
1089
|
-
/**
|
|
1090
|
-
* The path to a PEM-encoded certificate should not be provided when the secret options are provided.
|
|
1091
|
-
*/
|
|
1092
|
-
certificatePath?: never;
|
|
1093
|
-
/**
|
|
1094
|
-
* Option to include x5c header should not be provided when the secret options are provided.
|
|
1095
|
-
*/
|
|
1096
|
-
sendCertificateChain?: never;
|
|
1097
1165
|
}
|
|
1098
1166
|
|
|
1099
1167
|
/**
|