@azure/identity 2.0.0-alpha.20210930.2 → 2.0.0-alpha.20211007.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.

Files changed (55) hide show
  1. package/CHANGELOG.md +106 -4
  2. package/README.md +4 -0
  3. package/dist/index.js +131 -113
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/src/client/identityClient.js +1 -1
  6. package/dist-esm/src/client/identityClient.js.map +1 -1
  7. package/dist-esm/src/credentials/applicationCredential.browser.js +6 -1
  8. package/dist-esm/src/credentials/applicationCredential.browser.js.map +1 -1
  9. package/dist-esm/src/credentials/applicationCredential.js +11 -9
  10. package/dist-esm/src/credentials/applicationCredential.js.map +1 -1
  11. package/dist-esm/src/credentials/authorizationCodeCredential.browser.js.map +1 -1
  12. package/dist-esm/src/credentials/azureCliCredential.browser.js +7 -0
  13. package/dist-esm/src/credentials/azureCliCredential.browser.js.map +1 -1
  14. package/dist-esm/src/credentials/azureCliCredential.js +6 -5
  15. package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
  16. package/dist-esm/src/credentials/azurePowerShellCredential.browser.js +3 -1
  17. package/dist-esm/src/credentials/azurePowerShellCredential.browser.js.map +1 -1
  18. package/dist-esm/src/credentials/azurePowerShellCredential.js +6 -6
  19. package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -1
  20. package/dist-esm/src/credentials/clientCertificateCredential.browser.js +7 -0
  21. package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -1
  22. package/dist-esm/src/credentials/clientCertificateCredentialOptions.js.map +1 -1
  23. package/dist-esm/src/credentials/clientSecretCredentialOptions.js.map +1 -1
  24. package/dist-esm/src/credentials/defaultAzureCredential.js +15 -11
  25. package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
  26. package/dist-esm/src/credentials/deviceCodeCredential.browser.js +7 -0
  27. package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -1
  28. package/dist-esm/src/credentials/deviceCodeCredential.js +14 -0
  29. package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -1
  30. package/dist-esm/src/credentials/environmentCredential.browser.js +7 -0
  31. package/dist-esm/src/credentials/environmentCredential.browser.js.map +1 -1
  32. package/dist-esm/src/credentials/environmentCredential.js +1 -17
  33. package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
  34. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +7 -7
  35. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -1
  36. package/dist-esm/src/credentials/interactiveBrowserCredential.js +7 -7
  37. package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -1
  38. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +31 -22
  39. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
  40. package/dist-esm/src/credentials/onBehalfOfCredential.browser.js +6 -0
  41. package/dist-esm/src/credentials/onBehalfOfCredential.browser.js.map +1 -1
  42. package/dist-esm/src/credentials/usernamePasswordCredential.js +0 -2
  43. package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
  44. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js +6 -0
  45. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -1
  46. package/dist-esm/src/credentials/visualStudioCodeCredential.js +1 -1
  47. package/dist-esm/src/credentials/visualStudioCodeCredential.js.map +1 -1
  48. package/dist-esm/src/index.js +0 -1
  49. package/dist-esm/src/index.js.map +1 -1
  50. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js +1 -1
  51. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js.map +1 -1
  52. package/dist-esm/src/msal/nodeFlows/nodeCommon.js +1 -1
  53. package/dist-esm/src/msal/nodeFlows/nodeCommon.js.map +1 -1
  54. package/package.json +1 -1
  55. package/types/identity.d.ts +58 -177
@@ -1 +1 @@
1
- {"version":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C1B,8BAA8B,EAC/B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD;;GAEG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO,IAAI,sBAAsB,EAAE,CAAC;AACtC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport * from \"./plugins/consumer\";\n\nexport { IdentityPlugin } from \"./plugins/provider\";\n\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { DefaultAzureCredential } from \"./credentials/defaultAzureCredential\";\n\nexport { AuthenticationRecord } from \"./msal/types\";\nexport { AuthenticationRequiredError } from \"./msal/errors\";\nexport { serializeAuthenticationRecord, deserializeAuthenticationRecord } from \"./msal/utils\";\nexport { TokenCredentialOptions } from \"./client/identityClient\";\nexport { RegionalAuthority } from \"./regionalAuthority\";\nexport { InteractiveCredentialOptions } from \"./credentials/interactiveCredentialOptions\";\n\nexport { ChainedTokenCredential } from \"./credentials/chainedTokenCredential\";\nexport {\n DefaultAzureCredential,\n DefaultAzureCredentialOptions\n} from \"./credentials/defaultAzureCredential\";\nexport {\n EnvironmentCredential,\n EnvironmentCredentialOptions\n} from \"./credentials/environmentCredential\";\nexport { ClientSecretCredential } from \"./credentials/clientSecretCredential\";\nexport { ClientSecretCredentialOptions } from \"./credentials/clientSecretCredentialOptions\";\nexport { ClientCertificateCredential } from \"./credentials/clientCertificateCredential\";\nexport { ClientCertificateCredentialOptions } from \"./credentials/clientCertificateCredentialOptions\";\nexport { CredentialPersistenceOptions } from \"./credentials/credentialPersistenceOptions\";\nexport { AzureCliCredential } from \"./credentials/azureCliCredential\";\nexport { AzureCliCredentialOptions } from \"./credentials/azureCliCredentialOptions\";\nexport { InteractiveBrowserCredential } from \"./credentials/interactiveBrowserCredential\";\nexport {\n InteractiveBrowserCredentialOptions,\n InteractiveBrowserCredentialBrowserOptions,\n BrowserLoginStyle\n} from \"./credentials/interactiveBrowserCredentialOptions\";\nexport { ManagedIdentityCredential } from \"./credentials/managedIdentityCredential\";\nexport { DeviceCodeCredential } from \"./credentials/deviceCodeCredential\";\nexport {\n DeviceCodePromptCallback,\n DeviceCodeInfo\n} from \"./credentials/deviceCodeCredentialOptions\";\nexport { DeviceCodeCredentialOptions } from \"./credentials/deviceCodeCredentialOptions\";\nexport { UsernamePasswordCredential } from \"./credentials/usernamePasswordCredential\";\nexport { UsernamePasswordCredentialOptions } from \"./credentials/usernamePasswordCredentialOptions\";\nexport { AuthorizationCodeCredential } from \"./credentials/authorizationCodeCredential\";\nexport { AzurePowerShellCredential } from \"./credentials/azurePowerShellCredential\";\nexport { AzurePowerShellCredentialOptions } from \"./credentials/azurePowerShellCredentialOptions\";\nexport {\n ApplicationCredential,\n ApplicationCredentialOptions\n} from \"./credentials/applicationCredential\";\n\nexport {\n VisualStudioCodeCredential,\n VisualStudioCodeCredentialOptions\n} from \"./credentials/visualStudioCodeCredential\";\n\nexport {\n OnBehalfOfCredential,\n OnBehalfOfCredentialSecretConfiguration,\n OnBehalfOfCredentialCertificateConfiguration\n} from \"./credentials/onBehalfOfCredential\";\nexport { OnBehalfOfCredentialOptions } from \"./credentials/onBehalfOfCredentialOptions\";\n\nexport { TokenCachePersistenceOptions } from \"./msal/nodeFlows/tokenCachePersistenceOptions\";\n\nexport {\n AuthenticationError,\n ErrorResponse,\n AggregateAuthenticationError,\n AuthenticationErrorName,\n AggregateAuthenticationErrorName,\n CredentialUnavailableError,\n CredentialUnavailableErrorName\n} from \"./client/errors\";\n\nexport { TokenCredential, GetTokenOptions, AccessToken } from \"@azure/core-auth\";\nexport { logger } from \"./util/logging\";\n\nexport { AzureAuthorityHosts } from \"./constants\";\n\n/**\n * Returns a new instance of the {@link DefaultAzureCredential}.\n */\nexport function getDefaultAzureCredential(): TokenCredential {\n return new DefaultAzureCredential();\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"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AM,gBAAgB,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD;;GAEG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO,IAAI,sBAAsB,EAAE,CAAC;AACtC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport * from \"./plugins/consumer\";\n\nexport { IdentityPlugin } from \"./plugins/provider\";\n\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { DefaultAzureCredential } from \"./credentials/defaultAzureCredential\";\n\nexport { AuthenticationRecord } from \"./msal/types\";\nexport { AuthenticationRequiredError } from \"./msal/errors\";\nexport { serializeAuthenticationRecord, deserializeAuthenticationRecord } from \"./msal/utils\";\nexport { TokenCredentialOptions } from \"./client/identityClient\";\n\n// TODO: Export again once we're ready to release this feature.\n// export { RegionalAuthority } from \"./regionalAuthority\";\n\nexport { InteractiveCredentialOptions } from \"./credentials/interactiveCredentialOptions\";\n\nexport { ChainedTokenCredential } from \"./credentials/chainedTokenCredential\";\nexport {\n DefaultAzureCredential,\n DefaultAzureCredentialOptions\n} from \"./credentials/defaultAzureCredential\";\nexport {\n EnvironmentCredential,\n EnvironmentCredentialOptions\n} from \"./credentials/environmentCredential\";\nexport { ClientSecretCredential } from \"./credentials/clientSecretCredential\";\nexport { ClientSecretCredentialOptions } from \"./credentials/clientSecretCredentialOptions\";\nexport { ClientCertificateCredential } from \"./credentials/clientCertificateCredential\";\nexport { ClientCertificateCredentialOptions } from \"./credentials/clientCertificateCredentialOptions\";\nexport { CredentialPersistenceOptions } from \"./credentials/credentialPersistenceOptions\";\nexport { AzureCliCredential } from \"./credentials/azureCliCredential\";\nexport { AzureCliCredentialOptions } from \"./credentials/azureCliCredentialOptions\";\nexport { InteractiveBrowserCredential } from \"./credentials/interactiveBrowserCredential\";\nexport {\n InteractiveBrowserCredentialOptions,\n InteractiveBrowserCredentialBrowserOptions,\n BrowserLoginStyle\n} from \"./credentials/interactiveBrowserCredentialOptions\";\nexport { ManagedIdentityCredential } from \"./credentials/managedIdentityCredential\";\nexport { DeviceCodeCredential } from \"./credentials/deviceCodeCredential\";\nexport {\n DeviceCodePromptCallback,\n DeviceCodeInfo\n} from \"./credentials/deviceCodeCredentialOptions\";\nexport { DeviceCodeCredentialOptions } from \"./credentials/deviceCodeCredentialOptions\";\nexport { UsernamePasswordCredential } from \"./credentials/usernamePasswordCredential\";\nexport { UsernamePasswordCredentialOptions } from \"./credentials/usernamePasswordCredentialOptions\";\nexport { AuthorizationCodeCredential } from \"./credentials/authorizationCodeCredential\";\nexport { AzurePowerShellCredential } from \"./credentials/azurePowerShellCredential\";\nexport { AzurePowerShellCredentialOptions } from \"./credentials/azurePowerShellCredentialOptions\";\nexport {\n ApplicationCredential,\n ApplicationCredentialOptions\n} from \"./credentials/applicationCredential\";\n\nexport {\n VisualStudioCodeCredential,\n VisualStudioCodeCredentialOptions\n} from \"./credentials/visualStudioCodeCredential\";\n\nexport {\n OnBehalfOfCredential,\n OnBehalfOfCredentialSecretConfiguration,\n OnBehalfOfCredentialCertificateConfiguration\n} from \"./credentials/onBehalfOfCredential\";\nexport { OnBehalfOfCredentialOptions } from \"./credentials/onBehalfOfCredentialOptions\";\n\nexport { TokenCachePersistenceOptions } from \"./msal/nodeFlows/tokenCachePersistenceOptions\";\n\nexport {\n AuthenticationError,\n ErrorResponse,\n AggregateAuthenticationError,\n AuthenticationErrorName,\n AggregateAuthenticationErrorName,\n CredentialUnavailableError,\n CredentialUnavailableErrorName\n} from \"./client/errors\";\n\nexport { TokenCredential, GetTokenOptions, AccessToken } from \"@azure/core-auth\";\nexport { logger } from \"./util/logging\";\n\nexport { AzureAuthorityHosts } from \"./constants\";\n\n/**\n * Returns a new instance of the {@link DefaultAzureCredential}.\n */\nexport function getDefaultAzureCredential(): TokenCredential {\n return new DefaultAzureCredential();\n}\n"]}
@@ -10,7 +10,7 @@ import { MsalNode } from "./nodeCommon";
10
10
  export class MsalAuthorizationCode extends MsalNode {
11
11
  constructor(options) {
12
12
  super(options);
13
- this.logger = credentialLogger("NodeJS MSAL Authorization Code");
13
+ this.logger = credentialLogger("Node.js MSAL Authorization Code");
14
14
  this.redirectUri = options.redirectUri;
15
15
  this.authorizationCode = options.authorizationCode;
16
16
  if (options.clientSecret) {
@@ -1 +1 @@
1
- {"version":3,"file":"msalAuthorizationCode.js","sourceRoot":"","sources":["../../../../src/msal/nodeFlows/msalAuthorizationCode.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAmB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAYzD;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,QAAQ;IAIjD,YAAY,OAAqC;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,gBAAgB,CAAC,gCAAgC,CAAC,CAAC;QACjE,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACnD,IAAI,OAAO,CAAC,YAAY,EAAE;YACxB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;SAC1D;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAkD;QACrE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,eAAgB,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;IAES,KAAK,CAAC,UAAU,CACxB,MAAgB,EAChB,OAAuC;;QAEvC,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,CAAA,MAAA,IAAI,CAAC,eAAe,0CAAE,kBAAkB,CAAC;gBAC5D,MAAM;gBACN,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,IAAI,EAAE,IAAI,CAAC,iBAAiB;aAC7B,CAAC,CAAA,CAAC;YACH,yDAAyD;YACzD,8FAA8F;YAC9F,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,IAAI,SAAS,CAAC,CAAC;SACtE;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;SAC9C;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken } from \"@azure/core-auth\";\nimport { credentialLogger } from \"../../util/logging\";\nimport { CredentialFlowGetTokenOptions } from \"../credentials\";\nimport { MsalNodeOptions, MsalNode } from \"./nodeCommon\";\n\n/**\n * Options that can be passed to configure MSAL to handle authentication through opening a browser window.\n * @internal\n */\nexport interface MSALAuthorizationCodeOptions extends MsalNodeOptions {\n redirectUri: string;\n authorizationCode: string;\n clientSecret?: string;\n}\n\n/**\n * This MSAL client sets up a web server to listen for redirect callbacks, then calls to the MSAL's public application's `acquireTokenByDeviceCode` during `doGetToken`\n * to trigger the authentication flow, and then respond based on the values obtained from the redirect callback\n * @internal\n */\nexport class MsalAuthorizationCode extends MsalNode {\n private redirectUri: string;\n private authorizationCode: string;\n\n constructor(options: MSALAuthorizationCodeOptions) {\n super(options);\n this.logger = credentialLogger(\"NodeJS MSAL Authorization Code\");\n this.redirectUri = options.redirectUri;\n this.authorizationCode = options.authorizationCode;\n if (options.clientSecret) {\n this.msalConfig.auth.clientSecret = options.clientSecret;\n }\n }\n\n async getAuthCodeUrl(options: { scopes: string[]; redirectUri: string }): Promise<string> {\n await this.init();\n return this.confidentialApp!.getAuthCodeUrl(options);\n }\n\n protected async doGetToken(\n scopes: string[],\n options?: CredentialFlowGetTokenOptions\n ): Promise<AccessToken> {\n try {\n const result = await this.confidentialApp?.acquireTokenByCode({\n scopes,\n redirectUri: this.redirectUri,\n code: this.authorizationCode\n });\n // The Client Credential flow does not return an account,\n // so each time getToken gets called, we will have to acquire a new token through the service.\n return this.handleResult(scopes, this.clientId, result || undefined);\n } catch (err) {\n throw this.handleError(scopes, err, options);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"msalAuthorizationCode.js","sourceRoot":"","sources":["../../../../src/msal/nodeFlows/msalAuthorizationCode.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAmB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAYzD;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,QAAQ;IAIjD,YAAY,OAAqC;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,gBAAgB,CAAC,iCAAiC,CAAC,CAAC;QAClE,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACnD,IAAI,OAAO,CAAC,YAAY,EAAE;YACxB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;SAC1D;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAkD;QACrE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,eAAgB,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;IAES,KAAK,CAAC,UAAU,CACxB,MAAgB,EAChB,OAAuC;;QAEvC,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,CAAA,MAAA,IAAI,CAAC,eAAe,0CAAE,kBAAkB,CAAC;gBAC5D,MAAM;gBACN,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,IAAI,EAAE,IAAI,CAAC,iBAAiB;aAC7B,CAAC,CAAA,CAAC;YACH,yDAAyD;YACzD,8FAA8F;YAC9F,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,IAAI,SAAS,CAAC,CAAC;SACtE;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;SAC9C;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken } from \"@azure/core-auth\";\nimport { credentialLogger } from \"../../util/logging\";\nimport { CredentialFlowGetTokenOptions } from \"../credentials\";\nimport { MsalNodeOptions, MsalNode } from \"./nodeCommon\";\n\n/**\n * Options that can be passed to configure MSAL to handle authentication through opening a browser window.\n * @internal\n */\nexport interface MSALAuthorizationCodeOptions extends MsalNodeOptions {\n redirectUri: string;\n authorizationCode: string;\n clientSecret?: string;\n}\n\n/**\n * This MSAL client sets up a web server to listen for redirect callbacks, then calls to the MSAL's public application's `acquireTokenByDeviceCode` during `doGetToken`\n * to trigger the authentication flow, and then respond based on the values obtained from the redirect callback\n * @internal\n */\nexport class MsalAuthorizationCode extends MsalNode {\n private redirectUri: string;\n private authorizationCode: string;\n\n constructor(options: MSALAuthorizationCodeOptions) {\n super(options);\n this.logger = credentialLogger(\"Node.js MSAL Authorization Code\");\n this.redirectUri = options.redirectUri;\n this.authorizationCode = options.authorizationCode;\n if (options.clientSecret) {\n this.msalConfig.auth.clientSecret = options.clientSecret;\n }\n }\n\n async getAuthCodeUrl(options: { scopes: string[]; redirectUri: string }): Promise<string> {\n await this.init();\n return this.confidentialApp!.getAuthCodeUrl(options);\n }\n\n protected async doGetToken(\n scopes: string[],\n options?: CredentialFlowGetTokenOptions\n ): Promise<AccessToken> {\n try {\n const result = await this.confidentialApp?.acquireTokenByCode({\n scopes,\n redirectUri: this.redirectUri,\n code: this.authorizationCode\n });\n // The Client Credential flow does not return an account,\n // so each time getToken gets called, we will have to acquire a new token through the service.\n return this.handleResult(scopes, this.clientId, result || undefined);\n } catch (err) {\n throw this.handleError(scopes, err, options);\n }\n }\n}\n"]}
@@ -6,8 +6,8 @@ import { IdentityClient } from "../../client/identityClient";
6
6
  import { resolveTenantId } from "../../util/resolveTenantId";
7
7
  import { AuthenticationRequiredError } from "../errors";
8
8
  import { defaultLoggerCallback, getAuthority, getKnownAuthorities, MsalBaseUtilities, msalToPublic, publicToMsal } from "../utils";
9
- import { RegionalAuthority } from "../../regionalAuthority";
10
9
  import { processMultiTenantRequest } from "../../util/validateMultiTenant";
10
+ import { RegionalAuthority } from "../../regionalAuthority";
11
11
  /**
12
12
  * The current persistence provider, undefined by default.
13
13
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"nodeCommon.js","sourceRoot":"","sources":["../../../../src/msal/nodeFlows/nodeCommon.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAM7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAA0B,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACb,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAiB3E;;;GAGG;AACH,IAAI,mBAAmB,GAEP,SAAS,CAAC;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,cAAc,CAAC,cAA8D;QAC3E,mBAAmB,GAAG,cAAc,CAAC;IACvC,CAAC;CACF,CAAC;AAEF;;;;;;;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ed under the MIT license.\n\nimport * as msalNode from \"@azure/msal-node\";\nimport * as msalCommon from \"@azure/msal-common\";\n\nimport { AccessToken, GetTokenOptions } from \"@azure/core-auth\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\n\nimport { DeveloperSignOnClientId } from \"../../constants\";\nimport { IdentityClient, TokenCredentialOptions } from \"../../client/identityClient\";\nimport { resolveTenantId } from \"../../util/resolveTenantId\";\nimport { CredentialFlowGetTokenOptions } from \"../credentials\";\nimport { MsalFlow, MsalFlowOptions } from \"../flows\";\nimport { AuthenticationRequiredError } from \"../errors\";\nimport { AuthenticationRecord } from \"../types\";\nimport {\n defaultLoggerCallback,\n getAuthority,\n getKnownAuthorities,\n MsalBaseUtilities,\n msalToPublic,\n publicToMsal\n} from \"../utils\";\nimport { TokenCachePersistenceOptions } from \"./tokenCachePersistenceOptions\";\nimport { RegionalAuthority } from \"../../regionalAuthority\";\nimport { processMultiTenantRequest } from \"../../util/validateMultiTenant\";\n\n/**\n * Union of the constructor parameters that all MSAL flow types for Node.\n * @internal\n */\nexport interface MsalNodeOptions extends MsalFlowOptions {\n tokenCachePersistenceOptions?: TokenCachePersistenceOptions;\n tokenCredentialOptions: TokenCredentialOptions;\n /**\n * Specifies a regional authority. Please refer to the {@link RegionalAuthority} type for the accepted values.\n * If {@link RegionalAuthority.AutoDiscoverRegion} is specified, we will try to discover the regional authority endpoint.\n * If the property is not specified, uses a non-regional authority endpoint.\n */\n regionalAuthority?: string;\n}\n\n/**\n * The current persistence provider, undefined by default.\n * @internal\n */\nlet persistenceProvider:\n | ((options?: TokenCachePersistenceOptions) => Promise<msalCommon.ICachePlugin>)\n | undefined = undefined;\n\n/**\n * An object that allows setting the persistence provider.\n * @internal\n */\nexport const msalNodeFlowCacheControl = {\n setPersistence(pluginProvider: Exclude<typeof persistenceProvider, undefined>): void {\n persistenceProvider = pluginProvider;\n }\n};\n\n/**\n * MSAL partial base client for Node.js.\n *\n * It completes the input configuration with some default values.\n * It also provides with utility protected methods that can be used from any of the clients,\n * which includes handlers for successful responses and errors.\n *\n * @internal\n */\nexport abstract class MsalNode extends MsalBaseUtilities implements MsalFlow {\n protected publicApp: msalNode.PublicClientApplication | undefined;\n protected confidentialApp: msalNode.ConfidentialClientApplication | undefined;\n protected msalConfig: msalNode.Configuration;\n protected clientId: string;\n protected tenantId: string;\n protected authorityHost?: string;\n protected identityClient?: IdentityClient;\n protected requiresConfidential: boolean = false;\n protected azureRegion?: string;\n protected createCachePlugin: (() => Promise<msalCommon.ICachePlugin>) | undefined;\n\n constructor(options: MsalNodeOptions) {\n super(options);\n this.msalConfig = this.defaultNodeMsalConfig(options);\n this.tenantId = resolveTenantId(options.logger, options.tenantId, options.clientId);\n this.clientId = this.msalConfig.auth.clientId;\n\n // If persistence has been configured\n if (persistenceProvider !== undefined && options.tokenCachePersistenceOptions?.enabled) {\n this.createCachePlugin = () => persistenceProvider!(options.tokenCachePersistenceOptions);\n } else if (options.tokenCachePersistenceOptions?.enabled) {\n throw new Error(\n [\n \"Persistent token caching was requested, but no persistence provider was configured.\",\n \"You must install the identity-cache-persistence plugin package (`npm install --save @azure/identity-cache-persistence`)\",\n \"and enable it by importing `useIdentityPlugin` from `@azure/identity` and calling\",\n \"`useIdentityPlugin(cachePersistencePlugin)` before using `tokenCachePersistenceOptions`.\"\n ].join(\" \")\n );\n }\n\n this.azureRegion = options.regionalAuthority ?? process.env.AZURE_REGIONAL_AUTHORITY_NAME;\n if (this.azureRegion === RegionalAuthority.AutoDiscoverRegion) {\n this.azureRegion = \"AUTO_DISCOVER\";\n }\n }\n\n /**\n * Generates a MSAL configuration that generally works for Node.js\n */\n protected defaultNodeMsalConfig(options: MsalNodeOptions): msalNode.Configuration {\n const clientId = options.clientId || DeveloperSignOnClientId;\n const tenantId = resolveTenantId(options.logger, options.tenantId, options.clientId);\n\n this.authorityHost = options.authorityHost || process.env.AZURE_AUTHORITY_HOST;\n const authority = getAuthority(tenantId, this.authorityHost);\n\n this.identityClient = new IdentityClient({\n ...options.tokenCredentialOptions,\n authorityHost: authority\n });\n\n let clientCapabilities: string[] = [\"CP1\"];\n if (process.env.AZURE_IDENTITY_DISABLE_CP1) {\n clientCapabilities = [];\n }\n\n return {\n auth: {\n clientId,\n authority,\n knownAuthorities: getKnownAuthorities(tenantId, authority),\n clientCapabilities\n },\n // Cache is defined in this.prepare();\n system: {\n networkClient: this.identityClient,\n loggerOptions: {\n loggerCallback: defaultLoggerCallback(options.logger)\n }\n }\n };\n }\n\n /**\n * Prepares the MSAL applications.\n */\n async init(options?: CredentialFlowGetTokenOptions): Promise<void> {\n if (options?.abortSignal) {\n options.abortSignal.addEventListener(\"abort\", () => {\n // This will abort any pending request in the IdentityClient,\n // based on the received or generated correlationId\n this.identityClient!.abortRequests(options.correlationId);\n });\n }\n\n if (this.publicApp || this.confidentialApp) {\n return;\n }\n\n if (this.createCachePlugin !== undefined) {\n this.msalConfig.cache = {\n cachePlugin: await this.createCachePlugin()\n };\n }\n\n this.publicApp = new msalNode.PublicClientApplication(this.msalConfig);\n // The confidential client requires either a secret, assertion or certificate.\n if (\n this.msalConfig.auth.clientSecret ||\n this.msalConfig.auth.clientAssertion ||\n this.msalConfig.auth.clientCertificate\n ) {\n this.confidentialApp = new msalNode.ConfidentialClientApplication(this.msalConfig);\n } else {\n if (this.requiresConfidential) {\n throw new Error(\n \"Unable to generate the MSAL confidential client. Missing either the client's secret, certificate or assertion.\"\n );\n }\n }\n }\n\n /**\n * Allows the cancellation of a MSAL request.\n */\n protected withCancellation(\n promise: Promise<msalCommon.AuthenticationResult | null>,\n abortSignal?: AbortSignalLike,\n onCancel?: () => void\n ): Promise<msalCommon.AuthenticationResult | null> {\n return new Promise((resolve, reject) => {\n promise\n .then((msalToken) => {\n return resolve(msalToken!);\n })\n .catch(reject);\n if (abortSignal) {\n abortSignal.addEventListener(\"abort\", () => {\n onCancel?.();\n });\n }\n });\n }\n\n /**\n * Returns the existing account, attempts to load the account from MSAL.\n */\n async getActiveAccount(): Promise<AuthenticationRecord | undefined> {\n if (this.account) {\n return this.account;\n }\n const cache = this.confidentialApp?.getTokenCache() ?? this.publicApp?.getTokenCache();\n const accountsByTenant = await cache?.getAllAccounts();\n\n if (!accountsByTenant) {\n return;\n }\n\n if (accountsByTenant.length === 1) {\n this.account = msalToPublic(this.clientId, accountsByTenant[0]);\n } else {\n this.logger\n .info(`More than one account was found authenticated for this Client ID and Tenant ID.\nHowever, no \"authenticationRecord\" has been provided for this credential,\ntherefore we're unable to pick between these accounts.\nA new login attempt will be requested, to ensure the correct account is picked.\nTo work with multiple accounts for the same Client ID and Tenant ID, please provide an \"authenticationRecord\" when initializing a credential to prevent this from happening.`);\n return;\n }\n\n return this.account;\n }\n\n /**\n * Attempts to retrieve a token from cache.\n */\n async getTokenSilent(\n scopes: string[],\n options?: CredentialFlowGetTokenOptions\n ): Promise<AccessToken> {\n await this.getActiveAccount();\n if (!this.account) {\n throw new AuthenticationRequiredError(scopes, options);\n }\n\n const silentRequest: msalNode.SilentFlowRequest = {\n // To be able to re-use the account, the Token Cache must also have been provided.\n account: publicToMsal(this.account),\n correlationId: options?.correlationId,\n scopes,\n authority: options?.authority\n };\n\n try {\n this.logger.info(\"Attempting to acquire token silently\");\n const response =\n (await this.confidentialApp?.acquireTokenSilent(silentRequest)) ??\n (await this.publicApp!.acquireTokenSilent(silentRequest));\n return this.handleResult(scopes, this.clientId, response || undefined);\n } catch (err) {\n throw this.handleError(scopes, err, options);\n }\n }\n\n /**\n * Attempts to retrieve an authenticated token from MSAL.\n */\n protected abstract doGetToken(scopes: string[], options?: GetTokenOptions): Promise<AccessToken>;\n\n /**\n * Wrapper around each MSAL flow get token operation: doGetToken.\n * If disableAutomaticAuthentication is sent through the constructor, it will prevent MSAL from requesting the user input.\n */\n public async getToken(\n scopes: string[],\n options: CredentialFlowGetTokenOptions = {}\n ): Promise<AccessToken> {\n const tenantId = processMultiTenantRequest(this.tenantId, options) || this.tenantId;\n\n options.authority = getAuthority(tenantId, this.authorityHost);\n\n options.correlationId = options?.correlationId || this.generateUuid();\n await this.init(options);\n\n try {\n return await this.getTokenSilent(scopes, options);\n } catch (err) {\n if (err.name !== \"AuthenticationRequiredError\") {\n throw err;\n }\n if (options?.disableAutomaticAuthentication) {\n throw new AuthenticationRequiredError(\n scopes,\n options,\n \"Automatic authentication has been disabled. You may call the authentication() method.\"\n );\n }\n this.logger.info(`Silent authentication failed, falling back to interactive method.`);\n return this.doGetToken(scopes, options);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"nodeCommon.js","sourceRoot":"","sources":["../../../../src/msal/nodeFlows/nodeCommon.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAM7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAA0B,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACb,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAiB5D;;;GAGG;AACH,IAAI,mBAAmB,GAEP,SAAS,CAAC;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,cAAc,CAAC,cAA8D;QAC3E,mBAAmB,GAAG,cAAc,CAAC;IACvC,CAAC;CACF,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,OAAgB,QAAS,SAAQ,iBAAiB;IAYtD,YAAY,OAAwB;;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC;QALP,yBAAoB,GAAY,KAAK,CAAC;QAM9C,I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;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;SAC9C;IACH,CAAC;IAOD;;;OAGG;IACI,KAAK,CAAC,QAAQ,CACnB,MAAgB,EAChB,UAAyC,EAAE;QAE3C,MAAM,QAAQ,GAAG,yBAAyB,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC;QAEpF,OAAO,CAAC,SAAS,GAAG,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE/D,OAAO,CAAC,aAAa,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,KAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QACtE,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEzB,IAAI;YACF,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACnD;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,6BAA6B,EAAE;gBAC9C,MAAM,GAAG,CAAC;aACX;YACD,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,8BAA8B,EAAE;gBAC3C,MAAM,IAAI,2BAA2B,CACnC,MAAM,EACN,OAAO,EACP,uFAAuF,CACxF,CAAC;aACH;YACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;YACtF,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACzC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as msalNode from \"@azure/msal-node\";\nimport * as msalCommon from \"@azure/msal-common\";\n\nimport { AccessToken, GetTokenOptions } from \"@azure/core-auth\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\n\nimport { DeveloperSignOnClientId } from \"../../constants\";\nimport { IdentityClient, TokenCredentialOptions } from \"../../client/identityClient\";\nimport { resolveTenantId } from \"../../util/resolveTenantId\";\nimport { CredentialFlowGetTokenOptions } from \"../credentials\";\nimport { MsalFlow, MsalFlowOptions } from \"../flows\";\nimport { AuthenticationRequiredError } from \"../errors\";\nimport { AuthenticationRecord } from \"../types\";\nimport {\n defaultLoggerCallback,\n getAuthority,\n getKnownAuthorities,\n MsalBaseUtilities,\n msalToPublic,\n publicToMsal\n} from \"../utils\";\nimport { TokenCachePersistenceOptions } from \"./tokenCachePersistenceOptions\";\nimport { processMultiTenantRequest } from \"../../util/validateMultiTenant\";\nimport { RegionalAuthority } from \"../../regionalAuthority\";\n\n/**\n * Union of the constructor parameters that all MSAL flow types for Node.\n * @internal\n */\nexport interface MsalNodeOptions extends MsalFlowOptions {\n tokenCachePersistenceOptions?: TokenCachePersistenceOptions;\n tokenCredentialOptions: TokenCredentialOptions;\n /**\n * Specifies a regional authority. Please refer to the {@link RegionalAuthority} type for the accepted values.\n * If {@link RegionalAuthority.AutoDiscoverRegion} is specified, we will try to discover the regional authority endpoint.\n * If the property is not specified, uses a non-regional authority endpoint.\n */\n regionalAuthority?: string;\n}\n\n/**\n * The current persistence provider, undefined by default.\n * @internal\n */\nlet persistenceProvider:\n | ((options?: TokenCachePersistenceOptions) => Promise<msalCommon.ICachePlugin>)\n | undefined = undefined;\n\n/**\n * An object that allows setting the persistence provider.\n * @internal\n */\nexport const msalNodeFlowCacheControl = {\n setPersistence(pluginProvider: Exclude<typeof persistenceProvider, undefined>): void {\n persistenceProvider = pluginProvider;\n }\n};\n\n/**\n * MSAL partial base client for Node.js.\n *\n * It completes the input configuration with some default values.\n * It also provides with utility protected methods that can be used from any of the clients,\n * which includes handlers for successful responses and errors.\n *\n * @internal\n */\nexport abstract class MsalNode extends MsalBaseUtilities implements MsalFlow {\n protected publicApp: msalNode.PublicClientApplication | undefined;\n protected confidentialApp: msalNode.ConfidentialClientApplication | undefined;\n protected msalConfig: msalNode.Configuration;\n protected clientId: string;\n protected tenantId: string;\n protected authorityHost?: string;\n protected identityClient?: IdentityClient;\n protected requiresConfidential: boolean = false;\n protected azureRegion?: string;\n protected createCachePlugin: (() => Promise<msalCommon.ICachePlugin>) | undefined;\n\n constructor(options: MsalNodeOptions) {\n super(options);\n this.msalConfig = this.defaultNodeMsalConfig(options);\n this.tenantId = resolveTenantId(options.logger, options.tenantId, options.clientId);\n this.clientId = this.msalConfig.auth.clientId;\n\n // If persistence has been configured\n if (persistenceProvider !== undefined && options.tokenCachePersistenceOptions?.enabled) {\n this.createCachePlugin = () => persistenceProvider!(options.tokenCachePersistenceOptions);\n } else if (options.tokenCachePersistenceOptions?.enabled) {\n throw new Error(\n [\n \"Persistent token caching was requested, but no persistence provider was configured.\",\n \"You must install the identity-cache-persistence plugin package (`npm install --save @azure/identity-cache-persistence`)\",\n \"and enable it by importing `useIdentityPlugin` from `@azure/identity` and calling\",\n \"`useIdentityPlugin(cachePersistencePlugin)` before using `tokenCachePersistenceOptions`.\"\n ].join(\" \")\n );\n }\n\n this.azureRegion = options.regionalAuthority ?? process.env.AZURE_REGIONAL_AUTHORITY_NAME;\n if (this.azureRegion === RegionalAuthority.AutoDiscoverRegion) {\n this.azureRegion = \"AUTO_DISCOVER\";\n }\n }\n\n /**\n * Generates a MSAL configuration that generally works for Node.js\n */\n protected defaultNodeMsalConfig(options: MsalNodeOptions): msalNode.Configuration {\n const clientId = options.clientId || DeveloperSignOnClientId;\n const tenantId = resolveTenantId(options.logger, options.tenantId, options.clientId);\n\n this.authorityHost = options.authorityHost || process.env.AZURE_AUTHORITY_HOST;\n const authority = getAuthority(tenantId, this.authorityHost);\n\n this.identityClient = new IdentityClient({\n ...options.tokenCredentialOptions,\n authorityHost: authority\n });\n\n let clientCapabilities: string[] = [\"CP1\"];\n if (process.env.AZURE_IDENTITY_DISABLE_CP1) {\n clientCapabilities = [];\n }\n\n return {\n auth: {\n clientId,\n authority,\n knownAuthorities: getKnownAuthorities(tenantId, authority),\n clientCapabilities\n },\n // Cache is defined in this.prepare();\n system: {\n networkClient: this.identityClient,\n loggerOptions: {\n loggerCallback: defaultLoggerCallback(options.logger)\n }\n }\n };\n }\n\n /**\n * Prepares the MSAL applications.\n */\n async init(options?: CredentialFlowGetTokenOptions): Promise<void> {\n if (options?.abortSignal) {\n options.abortSignal.addEventListener(\"abort\", () => {\n // This will abort any pending request in the IdentityClient,\n // based on the received or generated correlationId\n this.identityClient!.abortRequests(options.correlationId);\n });\n }\n\n if (this.publicApp || this.confidentialApp) {\n return;\n }\n\n if (this.createCachePlugin !== undefined) {\n this.msalConfig.cache = {\n cachePlugin: await this.createCachePlugin()\n };\n }\n\n this.publicApp = new msalNode.PublicClientApplication(this.msalConfig);\n // The confidential client requires either a secret, assertion or certificate.\n if (\n this.msalConfig.auth.clientSecret ||\n this.msalConfig.auth.clientAssertion ||\n this.msalConfig.auth.clientCertificate\n ) {\n this.confidentialApp = new msalNode.ConfidentialClientApplication(this.msalConfig);\n } else {\n if (this.requiresConfidential) {\n throw new Error(\n \"Unable to generate the MSAL confidential client. Missing either the client's secret, certificate or assertion.\"\n );\n }\n }\n }\n\n /**\n * Allows the cancellation of a MSAL request.\n */\n protected withCancellation(\n promise: Promise<msalCommon.AuthenticationResult | null>,\n abortSignal?: AbortSignalLike,\n onCancel?: () => void\n ): Promise<msalCommon.AuthenticationResult | null> {\n return new Promise((resolve, reject) => {\n promise\n .then((msalToken) => {\n return resolve(msalToken!);\n })\n .catch(reject);\n if (abortSignal) {\n abortSignal.addEventListener(\"abort\", () => {\n onCancel?.();\n });\n }\n });\n }\n\n /**\n * Returns the existing account, attempts to load the account from MSAL.\n */\n async getActiveAccount(): Promise<AuthenticationRecord | undefined> {\n if (this.account) {\n return this.account;\n }\n const cache = this.confidentialApp?.getTokenCache() ?? this.publicApp?.getTokenCache();\n const accountsByTenant = await cache?.getAllAccounts();\n\n if (!accountsByTenant) {\n return;\n }\n\n if (accountsByTenant.length === 1) {\n this.account = msalToPublic(this.clientId, accountsByTenant[0]);\n } else {\n this.logger\n .info(`More than one account was found authenticated for this Client ID and Tenant ID.\nHowever, no \"authenticationRecord\" has been provided for this credential,\ntherefore we're unable to pick between these accounts.\nA new login attempt will be requested, to ensure the correct account is picked.\nTo work with multiple accounts for the same Client ID and Tenant ID, please provide an \"authenticationRecord\" when initializing a credential to prevent this from happening.`);\n return;\n }\n\n return this.account;\n }\n\n /**\n * Attempts to retrieve a token from cache.\n */\n async getTokenSilent(\n scopes: string[],\n options?: CredentialFlowGetTokenOptions\n ): Promise<AccessToken> {\n await this.getActiveAccount();\n if (!this.account) {\n throw new AuthenticationRequiredError(scopes, options);\n }\n\n const silentRequest: msalNode.SilentFlowRequest = {\n // To be able to re-use the account, the Token Cache must also have been provided.\n account: publicToMsal(this.account),\n correlationId: options?.correlationId,\n scopes,\n authority: options?.authority\n };\n\n try {\n this.logger.info(\"Attempting to acquire token silently\");\n const response =\n (await this.confidentialApp?.acquireTokenSilent(silentRequest)) ??\n (await this.publicApp!.acquireTokenSilent(silentRequest));\n return this.handleResult(scopes, this.clientId, response || undefined);\n } catch (err) {\n throw this.handleError(scopes, err, options);\n }\n }\n\n /**\n * Attempts to retrieve an authenticated token from MSAL.\n */\n protected abstract doGetToken(scopes: string[], options?: GetTokenOptions): Promise<AccessToken>;\n\n /**\n * Wrapper around each MSAL flow get token operation: doGetToken.\n * If disableAutomaticAuthentication is sent through the constructor, it will prevent MSAL from requesting the user input.\n */\n public async getToken(\n scopes: string[],\n options: CredentialFlowGetTokenOptions = {}\n ): Promise<AccessToken> {\n const tenantId = processMultiTenantRequest(this.tenantId, options) || this.tenantId;\n\n options.authority = getAuthority(tenantId, this.authorityHost);\n\n options.correlationId = options?.correlationId || this.generateUuid();\n await this.init(options);\n\n try {\n return await this.getTokenSilent(scopes, options);\n } catch (err) {\n if (err.name !== \"AuthenticationRequiredError\") {\n throw err;\n }\n if (options?.disableAutomaticAuthentication) {\n throw new AuthenticationRequiredError(\n scopes,\n options,\n \"Automatic authentication has been disabled. You may call the authentication() method.\"\n );\n }\n this.logger.info(`Silent authentication failed, falling back to interactive method.`);\n return this.doGetToken(scopes, options);\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@azure/identity",
3
3
  "sdk-type": "client",
4
- "version": "2.0.0-alpha.20210930.2",
4
+ "version": "2.0.0-alpha.20211007.2",
5
5
  "description": "Provides credential implementations for Azure SDK libraries that can authenticate with Azure Active Directory",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist-esm/src/index.js",
@@ -26,20 +26,22 @@ export declare const AggregateAuthenticationErrorName = "AggregateAuthentication
26
26
 
27
27
  /**
28
28
  * Provides a default {@link ChainedTokenCredential} configuration that should
29
- * work for most applications that use the Azure SDK. The following credential
30
- * types will be tried, in order:
31
- *
32
- * - {@link EnvironmentCredential}
33
- * - {@link ManagedIdentityCredential}
34
-
35
- *
36
- * Consult the documentation of these credential types for more information
37
- * on how they attempt authentication.
29
+ * work for most applications that use the Azure SDK.
38
30
  */
39
31
  export declare class ApplicationCredential extends ChainedTokenCredential {
40
32
  /**
41
33
  * Creates an instance of the ApplicationCredential class.
42
34
  *
35
+ * The ApplicationCredential provides a default {@link ChainedTokenCredential} configuration that should
36
+ * work for most applications that use the Azure SDK. The following credential
37
+ * types will be tried, in order:
38
+ *
39
+ * - {@link EnvironmentCredential}
40
+ * - {@link ManagedIdentityCredential}
41
+ *
42
+ * Consult the documentation of these credential types for more information
43
+ * on how they attempt authentication.
44
+ *
43
45
  * @param options - Optional parameters. See {@link ApplicationCredentialOptions}.
44
46
  */
45
47
  constructor(options?: ApplicationCredentialOptions);
@@ -222,14 +224,15 @@ export declare enum AzureAuthorityHosts {
222
224
  * via the Azure CLI ('az') commandline tool.
223
225
  * To do so, it will read the user access token and expire time
224
226
  * with Azure CLI command "az account get-access-token".
225
- * To be able to use this credential, ensure that you have already logged
226
- * in via the 'az' tool using the command "az login" from the commandline.
227
227
  */
228
228
  export declare class AzureCliCredential implements TokenCredential {
229
229
  private tenantId?;
230
230
  /**
231
231
  * Creates an instance of the {@link AzureCliCredential}.
232
232
  *
233
+ * To use this credential, ensure that you have already logged
234
+ * in via the 'az' tool using the command "az login" from the commandline.
235
+ *
233
236
  * @param options - Options, to optionally allow multi-tenant requests.
234
237
  */
235
238
  constructor(options?: AzureCliCredentialOptions);
@@ -258,18 +261,18 @@ export declare interface AzureCliCredentialOptions extends TokenCredentialOption
258
261
  * This credential will use the currently logged-in user information from the
259
262
  * Azure PowerShell module. To do so, it will read the user access token and
260
263
  * expire time with Azure PowerShell command `Get-AzAccessToken -ResourceUrl {ResourceScope}`
261
- *
262
- * To be able to use this credential:
263
- * - Install the Azure Az PowerShell module with:
264
- * `Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force`.
265
- * - You have already logged in to Azure PowerShell using the command
266
- * `Connect-AzAccount` from the command line.
267
264
  */
268
265
  export declare class AzurePowerShellCredential implements TokenCredential {
269
266
  private tenantId?;
270
267
  /**
271
268
  * Creates an instance of the {@link AzurePowershellCredential}.
272
269
  *
270
+ * To use this credential:
271
+ * - Install the Azure Az PowerShell module with:
272
+ * `Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force`.
273
+ * - You have already logged in to Azure PowerShell using the command
274
+ * `Connect-AzAccount` from the command line.
275
+ *
273
276
  * @param options - Options, to optionally allow multi-tenant requests.
274
277
  */
275
278
  constructor(options?: AzurePowerShellCredentialOptions);
@@ -388,12 +391,6 @@ export declare interface ClientCertificateCredentialOptions extends TokenCredent
388
391
  * Set this option to send base64 encoded public certificate in the client assertion header as an x5c claim
389
392
  */
390
393
  sendCertificateChain?: boolean;
391
- /**
392
- * Specifies a regional authority. Please refer to the {@link RegionalAuthority} type for the accepted values.
393
- * If {@link RegionalAuthority.AutoDiscoverRegion} is specified, we will try to discover the regional authority endpoint.
394
- * If the property is not specified, the credential uses the global authority endpoint.
395
- */
396
- regionalAuthority?: string;
397
394
  }
398
395
 
399
396
  /**
@@ -432,12 +429,6 @@ export declare class ClientSecretCredential implements TokenCredential {
432
429
  * Optional parameters for the {@link ClientSecretCredential} class.
433
430
  */
434
431
  export declare interface ClientSecretCredentialOptions extends TokenCredentialOptions, CredentialPersistenceOptions {
435
- /**
436
- * Specifies a regional authority. Please refer to the {@link RegionalAuthority} type for the accepted values.
437
- * If {@link RegionalAuthority.AutoDiscoverRegion} is specified, we will try to discover the regional authority endpoint.
438
- * If the property is not specified, the credential uses the global authority endpoint.
439
- */
440
- regionalAuthority?: string;
441
432
  }
442
433
 
443
434
  /**
@@ -493,22 +484,26 @@ export declare const CredentialUnavailableErrorName = "CredentialUnavailableErro
493
484
 
494
485
  /**
495
486
  * Provides a default {@link ChainedTokenCredential} configuration that should
496
- * work for most applications that use the Azure SDK. The following credential
497
- * types will be tried, in order:
498
- *
499
- * - {@link EnvironmentCredential}
500
- * - {@link ManagedIdentityCredential}
501
- * - {@link VisualStudioCodeCredential}
502
- * - {@link AzureCliCredential}
503
- * - {@link AzurePowerShellCredential}
504
- *
505
- * Consult the documentation of these credential types for more information
506
- * on how they attempt authentication.
487
+ * work for most applications that use the Azure SDK.
507
488
  */
508
489
  export declare class DefaultAzureCredential extends ChainedTokenCredential {
509
490
  /**
510
491
  * Creates an instance of the DefaultAzureCredential class.
511
492
  *
493
+ * This credential provides a default {@link ChainedTokenCredential} configuration that should
494
+ * work for most applications that use the Azure SDK.
495
+ *
496
+ * The following credential types will be tried, in order:
497
+ *
498
+ * - {@link EnvironmentCredential}
499
+ * - {@link ManagedIdentityCredential}
500
+ * - {@link VisualStudioCodeCredential}
501
+ * - {@link AzureCliCredential}
502
+ * - {@link AzurePowerShellCredential}
503
+ *
504
+ * Consult the documentation of these credential types for more information
505
+ * on how they attempt authentication.
506
+ *
512
507
  * **Note**: `VisualStudioCodeCredential` is provided by a plugin package:
513
508
  * `@azure/identity-vscode`. If this package is not installed and registered
514
509
  * using the plugin API (`useIdentityPlugin`), then authentication using
@@ -567,6 +562,20 @@ export declare class DeviceCodeCredential implements TokenCredential {
567
562
  * Creates an instance of DeviceCodeCredential with the details needed
568
563
  * to initiate the device code authorization flow with Azure Active Directory.
569
564
  *
565
+ * A message will be logged, giving users a code that they can use to authenticate once they go to https://microsoft.com/devicelogin
566
+ *
567
+ * Developers can configure how this message is shown by passing a custom `userPromptCallback`:
568
+ *
569
+ * ```js
570
+ * const credential = new DeviceCodeCredential({
571
+ * tenantId: env.AZURE_TENANT_ID,
572
+ * clientId: env.AZURE_CLIENT_ID,
573
+ * userPromptCallback: (info) => {
574
+ * console.log("CUSTOMIZED PROMPT CALLBACK", info.message);
575
+ * }
576
+ * });
577
+ * ```
578
+ *
570
579
  * @param options - Options for configuring the client which makes the authentication requests.
571
580
  */
572
581
  constructor(options?: DeviceCodeCredentialOptions);
@@ -647,23 +656,7 @@ export declare type DeviceCodePromptCallback = (deviceCodeInfo: DeviceCodeInfo)
647
656
 
648
657
  /**
649
658
  * Enables authentication to Azure Active Directory using client secret
650
- * details configured in the following environment variables:
651
- *
652
- * Required environment variables:
653
- * - `AZURE_TENANT_ID`: The Azure Active Directory tenant (directory) ID.
654
- * - `AZURE_CLIENT_ID`: The client (application) ID of an App Registration in the tenant.
655
- *
656
- * Environment variables used for client credential authentication:
657
- * - `AZURE_CLIENT_SECRET`: A client secret that was generated for the App Registration.
658
- * - `AZURE_CLIENT_CERTIFICATE_PATH`: The path to a PEM certificate to use during the authentication, instead of the client secret.
659
- *
660
- * Alternatively, users can provide environment variables for username and password authentication:
661
- * - `AZURE_USERNAME`: Username to authenticate with.
662
- * - `AZURE_PASSWORD`: Password to authenticate with.
663
- *
664
- * This credential ultimately uses a {@link ClientSecretCredential} to
665
- * perform the authentication using these details. Please consult the
666
- * documentation of that class for more details.
659
+ * details configured in environment variables
667
660
  */
668
661
  export declare class EnvironmentCredential implements TokenCredential {
669
662
  private _credential?;
@@ -755,13 +748,6 @@ export declare type IdentityPlugin = (context: unknown) => void;
755
748
  /**
756
749
  * Enables authentication to Azure Active Directory inside of the web browser
757
750
  * using the interactive login flow.
758
- *
759
- * This credential uses the [Authorization Code Flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow).
760
- * On Node.js, it will open a browser window while it listens for a redirect response from the authentication service.
761
- * On browsers, it authenticates via popups. The `loginStyle` optional parameter can be set to `redirect` to authenticate by redirecting the user to an Azure secure login page, which then will redirect the user back to the web application where the authentication started.
762
- *
763
- * For Node.js, if a `clientId` is provided, the Azure Active Directory application will need to be configured to have a "Mobile and desktop applications" redirect endpoint.
764
- * Follow our guide on [setting up Redirect URIs for Desktop apps that calls to web APIs](https://docs.microsoft.com/azure/active-directory/develop/scenario-desktop-app-registration#redirect-uris).
765
751
  */
766
752
  export declare class InteractiveBrowserCredential implements TokenCredential {
767
753
  private msalFlow;
@@ -769,6 +755,13 @@ export declare class InteractiveBrowserCredential implements TokenCredential {
769
755
  /**
770
756
  * Creates an instance of InteractiveBrowserCredential with the details needed.
771
757
  *
758
+ * This credential uses the [Authorization Code Flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow).
759
+ * On Node.js, it will open a browser window while it listens for a redirect response from the authentication service.
760
+ * On browsers, it authenticates via popups. The `loginStyle` optional parameter can be set to `redirect` to authenticate by redirecting the user to an Azure secure login page, which then will redirect the user back to the web application where the authentication started.
761
+ *
762
+ * For Node.js, if a `clientId` is provided, the Azure Active Directory application will need to be configured to have a "Mobile and desktop applications" redirect endpoint.
763
+ * Follow our guide on [setting up Redirect URIs for Desktop apps that calls to web APIs](https://docs.microsoft.com/azure/active-directory/develop/scenario-desktop-app-registration#redirect-uris).
764
+ *
772
765
  * @param options - Options for configuring the client which makes the authentication requests.
773
766
  */
774
767
  constructor(options?: InteractiveBrowserCredentialOptions | InteractiveBrowserCredentialBrowserOptions);
@@ -1021,118 +1014,6 @@ export declare interface OnBehalfOfCredentialSecretConfiguration {
1021
1014
  userAssertionToken: string;
1022
1015
  }
1023
1016
 
1024
- /**
1025
- * Helps specify a regional authority, or "AutoDiscoverRegion" to auto-detect the region.
1026
- */
1027
- export declare enum RegionalAuthority {
1028
- /** Instructs MSAL to attempt to discover the region */
1029
- AutoDiscoverRegion = "AutoDiscoverRegion",
1030
- /** Uses the {@link RegionalAuthority} for the Azure 'westus' region. */
1031
- USWest = "westus",
1032
- /** Uses the {@link RegionalAuthority} for the Azure 'westus2' region. */
1033
- USWest2 = "westus2",
1034
- /** Uses the {@link RegionalAuthority} for the Azure 'centralus' region. */
1035
- USCentral = "centralus",
1036
- /** Uses the {@link RegionalAuthority} for the Azure 'eastus' region. */
1037
- USEast = "eastus",
1038
- /** Uses the {@link RegionalAuthority} for the Azure 'eastus2' region. */
1039
- USEast2 = "eastus2",
1040
- /** Uses the {@link RegionalAuthority} for the Azure 'northcentralus' region. */
1041
- USNorthCentral = "northcentralus",
1042
- /** Uses the {@link RegionalAuthority} for the Azure 'southcentralus' region. */
1043
- USSouthCentral = "southcentralus",
1044
- /** Uses the {@link RegionalAuthority} for the Azure 'westcentralus' region. */
1045
- USWestCentral = "westcentralus",
1046
- /** Uses the {@link RegionalAuthority} for the Azure 'canadacentral' region. */
1047
- CanadaCentral = "canadacentral",
1048
- /** Uses the {@link RegionalAuthority} for the Azure 'canadaeast' region. */
1049
- CanadaEast = "canadaeast",
1050
- /** Uses the {@link RegionalAuthority} for the Azure 'brazilsouth' region. */
1051
- BrazilSouth = "brazilsouth",
1052
- /** Uses the {@link RegionalAuthority} for the Azure 'northeurope' region. */
1053
- EuropeNorth = "northeurope",
1054
- /** Uses the {@link RegionalAuthority} for the Azure 'westeurope' region. */
1055
- EuropeWest = "westeurope",
1056
- /** Uses the {@link RegionalAuthority} for the Azure 'uksouth' region. */
1057
- UKSouth = "uksouth",
1058
- /** Uses the {@link RegionalAuthority} for the Azure 'ukwest' region. */
1059
- UKWest = "ukwest",
1060
- /** Uses the {@link RegionalAuthority} for the Azure 'francecentral' region. */
1061
- FranceCentral = "francecentral",
1062
- /** Uses the {@link RegionalAuthority} for the Azure 'francesouth' region. */
1063
- FranceSouth = "francesouth",
1064
- /** Uses the {@link RegionalAuthority} for the Azure 'switzerlandnorth' region. */
1065
- SwitzerlandNorth = "switzerlandnorth",
1066
- /** Uses the {@link RegionalAuthority} for the Azure 'switzerlandwest' region. */
1067
- SwitzerlandWest = "switzerlandwest",
1068
- /** Uses the {@link RegionalAuthority} for the Azure 'germanynorth' region. */
1069
- GermanyNorth = "germanynorth",
1070
- /** Uses the {@link RegionalAuthority} for the Azure 'germanywestcentral' region. */
1071
- GermanyWestCentral = "germanywestcentral",
1072
- /** Uses the {@link RegionalAuthority} for the Azure 'norwaywest' region. */
1073
- NorwayWest = "norwaywest",
1074
- /** Uses the {@link RegionalAuthority} for the Azure 'norwayeast' region. */
1075
- NorwayEast = "norwayeast",
1076
- /** Uses the {@link RegionalAuthority} for the Azure 'eastasia' region. */
1077
- AsiaEast = "eastasia",
1078
- /** Uses the {@link RegionalAuthority} for the Azure 'southeastasia' region. */
1079
- AsiaSouthEast = "southeastasia",
1080
- /** Uses the {@link RegionalAuthority} for the Azure 'japaneast' region. */
1081
- JapanEast = "japaneast",
1082
- /** Uses the {@link RegionalAuthority} for the Azure 'japanwest' region. */
1083
- JapanWest = "japanwest",
1084
- /** Uses the {@link RegionalAuthority} for the Azure 'australiaeast' region. */
1085
- AustraliaEast = "australiaeast",
1086
- /** Uses the {@link RegionalAuthority} for the Azure 'australiasoutheast' region. */
1087
- AustraliaSouthEast = "australiasoutheast",
1088
- /** Uses the {@link RegionalAuthority} for the Azure 'australiacentral' region. */
1089
- AustraliaCentral = "australiacentral",
1090
- /** Uses the {@link RegionalAuthority} for the Azure 'australiacentral2' region. */
1091
- AustraliaCentral2 = "australiacentral2",
1092
- /** Uses the {@link RegionalAuthority} for the Azure 'centralindia' region. */
1093
- IndiaCentral = "centralindia",
1094
- /** Uses the {@link RegionalAuthority} for the Azure 'southindia' region. */
1095
- IndiaSouth = "southindia",
1096
- /** Uses the {@link RegionalAuthority} for the Azure 'westindia' region. */
1097
- IndiaWest = "westindia",
1098
- /** Uses the {@link RegionalAuthority} for the Azure 'koreasouth' region. */
1099
- KoreaSouth = "koreasouth",
1100
- /** Uses the {@link RegionalAuthority} for the Azure 'koreacentral' region. */
1101
- KoreaCentral = "koreacentral",
1102
- /** Uses the {@link RegionalAuthority} for the Azure 'uaecentral' region. */
1103
- UAECentral = "uaecentral",
1104
- /** Uses the {@link RegionalAuthority} for the Azure 'uaenorth' region. */
1105
- UAENorth = "uaenorth",
1106
- /** Uses the {@link RegionalAuthority} for the Azure 'southafricanorth' region. */
1107
- SouthAfricaNorth = "southafricanorth",
1108
- /** Uses the {@link RegionalAuthority} for the Azure 'southafricawest' region. */
1109
- SouthAfricaWest = "southafricawest",
1110
- /** Uses the {@link RegionalAuthority} for the Azure 'chinanorth' region. */
1111
- ChinaNorth = "chinanorth",
1112
- /** Uses the {@link RegionalAuthority} for the Azure 'chinaeast' region. */
1113
- ChinaEast = "chinaeast",
1114
- /** Uses the {@link RegionalAuthority} for the Azure 'chinanorth2' region. */
1115
- ChinaNorth2 = "chinanorth2",
1116
- /** Uses the {@link RegionalAuthority} for the Azure 'chinaeast2' region. */
1117
- ChinaEast2 = "chinaeast2",
1118
- /** Uses the {@link RegionalAuthority} for the Azure 'germanycentral' region. */
1119
- GermanyCentral = "germanycentral",
1120
- /** Uses the {@link RegionalAuthority} for the Azure 'germanynortheast' region. */
1121
- GermanyNorthEast = "germanynortheast",
1122
- /** Uses the {@link RegionalAuthority} for the Azure 'usgovvirginia' region. */
1123
- GovernmentUSVirginia = "usgovvirginia",
1124
- /** Uses the {@link RegionalAuthority} for the Azure 'usgoviowa' region. */
1125
- GovernmentUSIowa = "usgoviowa",
1126
- /** Uses the {@link RegionalAuthority} for the Azure 'usgovarizona' region. */
1127
- GovernmentUSArizona = "usgovarizona",
1128
- /** Uses the {@link RegionalAuthority} for the Azure 'usgovtexas' region. */
1129
- GovernmentUSTexas = "usgovtexas",
1130
- /** Uses the {@link RegionalAuthority} for the Azure 'usdodeast' region. */
1131
- GovernmentUSDodEast = "usdodeast",
1132
- /** Uses the {@link RegionalAuthority} for the Azure 'usdodcentral' region. */
1133
- GovernmentUSDodCentral = "usdodcentral"
1134
- }
1135
-
1136
1017
  /**
1137
1018
  * Serializes an `AuthenticationRecord` into a string.
1138
1019
  *
@@ -1259,7 +1140,7 @@ export declare interface UsernamePasswordCredentialOptions extends TokenCredenti
1259
1140
  }
1260
1141
 
1261
1142
  /**
1262
- * Connect to Azure using the credential provided by the VSCode extension 'Azure Account'.
1143
+ * Connects to Azure using the credential provided by the VSCode extension 'Azure Account'.
1263
1144
  * Once the user has logged in via the extension, this credential can share the same refresh token
1264
1145
  * that is cached by the extension.
1265
1146
  */