@azure/identity 2.0.0-beta.5 → 2.0.1

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 (130) hide show
  1. package/CHANGELOG.md +189 -12
  2. package/README.md +77 -24
  3. package/dist/index.js +705 -386
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/src/client/identityClient.js +3 -7
  6. package/dist-esm/src/client/identityClient.js.map +1 -1
  7. package/dist-esm/src/credentials/authorizationCodeCredential.browser.js +1 -1
  8. package/dist-esm/src/credentials/authorizationCodeCredential.browser.js.map +1 -1
  9. package/dist-esm/src/credentials/authorizationCodeCredential.js +12 -76
  10. package/dist-esm/src/credentials/authorizationCodeCredential.js.map +1 -1
  11. package/dist-esm/src/credentials/{applicationCredential.browser.js → azureApplicationCredential.browser.js} +9 -4
  12. package/dist-esm/src/credentials/azureApplicationCredential.browser.js.map +1 -0
  13. package/dist-esm/src/credentials/azureApplicationCredential.js +36 -0
  14. package/dist-esm/src/credentials/azureApplicationCredential.js.map +1 -0
  15. package/dist-esm/src/credentials/azureCliCredential.browser.js +7 -0
  16. package/dist-esm/src/credentials/azureCliCredential.browser.js.map +1 -1
  17. package/dist-esm/src/credentials/azureCliCredential.js +10 -10
  18. package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
  19. package/dist-esm/src/credentials/azurePowerShellCredential.browser.js +3 -1
  20. package/dist-esm/src/credentials/azurePowerShellCredential.browser.js.map +1 -1
  21. package/dist-esm/src/credentials/azurePowerShellCredential.js +13 -13
  22. package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -1
  23. package/dist-esm/src/credentials/chainedTokenCredential.js +6 -5
  24. package/dist-esm/src/credentials/chainedTokenCredential.js.map +1 -1
  25. package/dist-esm/src/credentials/clientCertificateCredential.browser.js +7 -0
  26. package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -1
  27. package/dist-esm/src/credentials/clientCertificateCredential.js +19 -13
  28. package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
  29. package/dist-esm/src/credentials/clientCertificateCredentialOptions.js.map +1 -1
  30. package/dist-esm/src/credentials/clientSecretCredential.browser.js +2 -5
  31. package/dist-esm/src/credentials/clientSecretCredential.browser.js.map +1 -1
  32. package/dist-esm/src/credentials/clientSecretCredential.js +3 -0
  33. package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
  34. package/dist-esm/src/credentials/clientSecretCredentialOptions.js.map +1 -1
  35. package/dist-esm/src/credentials/credentialPersistenceOptions.js.map +1 -1
  36. package/dist-esm/src/credentials/defaultAzureCredential.js +21 -20
  37. package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
  38. package/dist-esm/src/credentials/deviceCodeCredential.browser.js +7 -0
  39. package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -1
  40. package/dist-esm/src/credentials/deviceCodeCredential.js +14 -0
  41. package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -1
  42. package/dist-esm/src/credentials/environmentCredential.browser.js +7 -0
  43. package/dist-esm/src/credentials/environmentCredential.browser.js.map +1 -1
  44. package/dist-esm/src/credentials/environmentCredential.js +5 -21
  45. package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
  46. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +7 -7
  47. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -1
  48. package/dist-esm/src/credentials/interactiveBrowserCredential.js +7 -7
  49. package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -1
  50. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  51. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js +21 -10
  52. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -1
  53. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js +24 -13
  54. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
  55. package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js +22 -11
  56. package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -1
  57. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js +24 -7
  58. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
  59. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +57 -39
  60. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
  61. package/dist-esm/src/credentials/managedIdentityCredential/index.js +16 -14
  62. package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
  63. package/dist-esm/src/credentials/managedIdentityCredential/models.js.map +1 -1
  64. package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js +82 -0
  65. package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -0
  66. package/dist-esm/src/credentials/managedIdentityCredential/utils.js +14 -6
  67. package/dist-esm/src/credentials/managedIdentityCredential/utils.js.map +1 -1
  68. package/dist-esm/src/credentials/onBehalfOfCredential.browser.js +23 -0
  69. package/dist-esm/src/credentials/onBehalfOfCredential.browser.js.map +1 -0
  70. package/dist-esm/src/credentials/onBehalfOfCredential.js +57 -0
  71. package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -0
  72. package/dist-esm/src/credentials/{visualStudioCodeCredentialExtension.js → onBehalfOfCredentialOptions.js} +1 -1
  73. package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js.map +1 -0
  74. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js +11 -14
  75. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js.map +1 -1
  76. package/dist-esm/src/credentials/usernamePasswordCredential.js +3 -2
  77. package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
  78. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js +7 -1
  79. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -1
  80. package/dist-esm/src/credentials/visualStudioCodeCredential.js +16 -8
  81. package/dist-esm/src/credentials/visualStudioCodeCredential.js.map +1 -1
  82. package/dist-esm/src/credentials/visualStudioCodeCredentialPlugin.js +4 -0
  83. package/dist-esm/src/credentials/visualStudioCodeCredentialPlugin.js.map +1 -0
  84. package/dist-esm/src/{client/errors.js → errors.js} +16 -1
  85. package/dist-esm/src/errors.js.map +1 -0
  86. package/dist-esm/src/index.js +3 -5
  87. package/dist-esm/src/index.js.map +1 -1
  88. package/dist-esm/src/msal/browserFlows/browserCommon.js +8 -7
  89. package/dist-esm/src/msal/browserFlows/browserCommon.js.map +1 -1
  90. package/dist-esm/src/msal/browserFlows/msalAuthCode.js +12 -4
  91. package/dist-esm/src/msal/browserFlows/msalAuthCode.js.map +1 -1
  92. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js +41 -0
  93. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js.map +1 -0
  94. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js +49 -29
  95. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js.map +1 -1
  96. package/dist-esm/src/msal/nodeFlows/msalClientSecret.js.map +1 -1
  97. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js +56 -0
  98. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js.map +1 -0
  99. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js +1 -1
  100. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js.map +1 -1
  101. package/dist-esm/src/msal/nodeFlows/nodeCommon.js +19 -8
  102. package/dist-esm/src/msal/nodeFlows/nodeCommon.js.map +1 -1
  103. package/dist-esm/src/msal/nodeFlows/tokenCachePersistenceOptions.js.map +1 -1
  104. package/dist-esm/src/msal/utils.js +7 -4
  105. package/dist-esm/src/msal/utils.js.map +1 -1
  106. package/dist-esm/src/plugins/consumer.browser.js +7 -0
  107. package/dist-esm/src/plugins/consumer.browser.js.map +1 -0
  108. package/dist-esm/src/{extensions → plugins}/consumer.js +12 -12
  109. package/dist-esm/src/plugins/consumer.js.map +1 -0
  110. package/dist-esm/src/{extensions → plugins}/provider.js +0 -0
  111. package/dist-esm/src/plugins/provider.js.map +1 -0
  112. package/dist-esm/src/util/tracing.js +1 -1
  113. package/dist-esm/src/util/tracing.js.map +1 -1
  114. package/dist-esm/src/util/validateMultiTenant.browser.js +22 -0
  115. package/dist-esm/src/util/validateMultiTenant.browser.js.map +1 -0
  116. package/dist-esm/src/util/validateMultiTenant.js +17 -12
  117. package/dist-esm/src/util/validateMultiTenant.js.map +1 -1
  118. package/package.json +16 -16
  119. package/types/identity.d.ts +246 -261
  120. package/dist-esm/src/client/errors.js.map +0 -1
  121. package/dist-esm/src/credentials/applicationCredential.browser.js.map +0 -1
  122. package/dist-esm/src/credentials/applicationCredential.js +0 -37
  123. package/dist-esm/src/credentials/applicationCredential.js.map +0 -1
  124. package/dist-esm/src/credentials/visualStudioCodeCredentialExtension.js.map +0 -1
  125. package/dist-esm/src/extensions/consumer.browser.js +0 -7
  126. package/dist-esm/src/extensions/consumer.browser.js.map +0 -1
  127. package/dist-esm/src/extensions/consumer.js.map +0 -1
  128. package/dist-esm/src/extensions/provider.js.map +0 -1
  129. package/dist-esm/src/msal/errors.js +0 -22
  130. package/dist-esm/src/msal/errors.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/client/errors.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAuDlC,SAAS,eAAe,CAAC,aAAkB;IACzC,OAAO,CACL,aAAa;QACb,OAAO,aAAa,CAAC,KAAK,KAAK,QAAQ;QACvC,OAAO,aAAa,CAAC,iBAAiB,KAAK,QAAQ,CACpD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,4BAA4B,CAAC;AAE3E;;;;GAIG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACnD,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;IAC7C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAW5C,wDAAwD;IACxD,YAAY,UAAkB,EAAE,SAA6C;QAC3E,IAAI,aAAa,GAAkB;YACjC,KAAK,EAAE,SAAS;YAChB,gBAAgB,EAAE,oEAAoE;SACvF,CAAC;QAEF,IAAI,eAAe,CAAC,SAAS,CAAC,EAAE;YAC9B,aAAa,GAAG,wCAAwC,CAAC,SAAS,CAAC,CAAC;SACrE;aAAM,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;YACxC,IAAI;gBACF,iEAAiE;gBACjE,uBAAuB;gBACvB,MAAM,kBAAkB,GAAuB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;gBACrE,aAAa,GAAG,wCAAwC,CAAC,kBAAkB,CAAC,CAAC;aAC9E;YAAC,OAAO,CAAC,EAAE;gBACV,IAAI,UAAU,KAAK,GAAG,EAAE;oBACtB,aAAa,GAAG;wBACd,KAAK,EAAE,qBAAqB;wBAC5B,gBAAgB,EAAE,4CAA4C;qBAC/D,CAAC;iBACH;qBAAM;oBACL,aAAa,GAAG;wBACd,KAAK,EAAE,eAAe;wBACtB,gBAAgB,EAAE,oDAAoD,SAAS,EAAE;qBAClF,CAAC;iBACH;aACF;SACF;aAAM;YACL,aAAa,GAAG;gBACd,KAAK,EAAE,eAAe;gBACtB,gBAAgB,EAAE,oEAAoE;aACvF,CAAC;SACH;QAED,KAAK,CACH,GAAG,aAAa,CAAC,KAAK,gBAAgB,UAAU,sBAAsB,aAAa,CAAC,gBAAgB,EAAE,CACvG,CAAC;QACF,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QAEnC,iDAAiD;QACjD,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,8BAA8B,CAAC;AAE/E;;;GAGG;AACH,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IAOrD,YAAY,MAAa,EAAE,YAAqB;QAC9C,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,KAAK,CAAC,GAAG,YAAY,OAAO,WAAW,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,iDAAiD;QACjD,IAAI,CAAC,IAAI,GAAG,gCAAgC,CAAC;IAC/C,CAAC;CACF;AAED,SAAS,wCAAwC,CAAC,SAA6B;IAC7E,OAAO;QACL,KAAK,EAAE,SAAS,CAAC,KAAK;QACtB,gBAAgB,EAAE,SAAS,CAAC,iBAAiB;QAC7C,aAAa,EAAE,SAAS,CAAC,cAAc;QACvC,UAAU,EAAE,SAAS,CAAC,WAAW;QACjC,SAAS,EAAE,SAAS,CAAC,SAAS;QAC9B,OAAO,EAAE,SAAS,CAAC,QAAQ;KAC5B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * See the official documentation for more details:\n *\n * https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-protocols-oauth-code#error-response-1\n *\n * NOTE: This documentation is for v1 OAuth support but the same error\n * response details still apply to v2.\n */\nexport interface ErrorResponse {\n /**\n * The string identifier for the error.\n */\n error: string;\n\n /**\n * The error's description.\n */\n errorDescription: string;\n\n /**\n * An array of codes pertaining to the error(s) that occurred.\n */\n errorCodes?: number[];\n\n /**\n * The timestamp at which the error occurred.\n */\n timestamp?: string;\n\n /**\n * The trace identifier for this error occurrence.\n */\n traceId?: string;\n\n /**\n * The correlation ID to be used for tracking the source of the error.\n */\n correlationId?: string;\n}\n\n/**\n * Used for internal deserialization of OAuth responses. Public model is ErrorResponse\n * @internal\n */\nexport interface OAuthErrorResponse {\n error: string;\n error_description: string;\n error_codes?: number[];\n timestamp?: string;\n trace_id?: string;\n correlation_id?: string;\n}\n\nfunction isErrorResponse(errorResponse: any): errorResponse is OAuthErrorResponse {\n return (\n errorResponse &&\n typeof errorResponse.error === \"string\" &&\n typeof errorResponse.error_description === \"string\"\n );\n}\n\n/**\n * The Error.name value of an CredentialUnavailable\n */\nexport const CredentialUnavailableErrorName = \"CredentialUnavailableError\";\n\n/**\n * This signifies that the credential that was tried in a chained credential\n * was not available to be used as the credential. Rather than treating this as\n * an error that should halt the chain, it's caught and the chain continues\n */\nexport class CredentialUnavailableError extends Error {\n constructor(message?: string) {\n super(message);\n this.name = CredentialUnavailableErrorName;\n }\n}\n\n/**\n * The Error.name value of an AuthenticationError\n */\nexport const AuthenticationErrorName = \"AuthenticationError\";\n\n/**\n * Provides details about a failure to authenticate with Azure Active\n * Directory. The `errorResponse` field contains more details about\n * the specific failure.\n */\nexport class AuthenticationError extends Error {\n /**\n * The HTTP status code returned from the authentication request.\n */\n public readonly statusCode: number;\n\n /**\n * The error response details.\n */\n public readonly errorResponse: ErrorResponse;\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n constructor(statusCode: number, errorBody: object | string | undefined | null) {\n let errorResponse: ErrorResponse = {\n error: \"unknown\",\n errorDescription: \"An unknown error occurred and no additional details are available.\"\n };\n\n if (isErrorResponse(errorBody)) {\n errorResponse = convertOAuthErrorResponseToErrorResponse(errorBody);\n } else if (typeof errorBody === \"string\") {\n try {\n // Most error responses will contain JSON-formatted error details\n // in the response body\n const oauthErrorResponse: OAuthErrorResponse = JSON.parse(errorBody);\n errorResponse = convertOAuthErrorResponseToErrorResponse(oauthErrorResponse);\n } catch (e) {\n if (statusCode === 400) {\n errorResponse = {\n error: \"authority_not_found\",\n errorDescription: \"The specified authority URL was not found.\"\n };\n } else {\n errorResponse = {\n error: \"unknown_error\",\n errorDescription: `An unknown error has occurred. Response body:\\n\\n${errorBody}`\n };\n }\n }\n } else {\n errorResponse = {\n error: \"unknown_error\",\n errorDescription: \"An unknown error occurred and no additional details are available.\"\n };\n }\n\n super(\n `${errorResponse.error}(status code ${statusCode}).\\nMore details:\\n${errorResponse.errorDescription}`\n );\n this.statusCode = statusCode;\n this.errorResponse = errorResponse;\n\n // Ensure that this type reports the correct name\n this.name = AuthenticationErrorName;\n }\n}\n\n/**\n * The Error.name value of an AggregateAuthenticationError\n */\nexport const AggregateAuthenticationErrorName = \"AggregateAuthenticationError\";\n\n/**\n * Provides an `errors` array containing {@link AuthenticationError} instance\n * for authentication failures from credentials in a {@link ChainedTokenCredential}.\n */\nexport class AggregateAuthenticationError extends Error {\n /**\n * The array of error objects that were thrown while trying to authenticate\n * with the credentials in a {@link ChainedTokenCredential}.\n */\n public errors: any[];\n\n constructor(errors: any[], errorMessage?: string) {\n const errorDetail = errors.join(\"\\n\");\n super(`${errorMessage}\\n\\n${errorDetail}`);\n this.errors = errors;\n\n // Ensure that this type reports the correct name\n this.name = AggregateAuthenticationErrorName;\n }\n}\n\nfunction convertOAuthErrorResponseToErrorResponse(errorBody: OAuthErrorResponse): ErrorResponse {\n return {\n error: errorBody.error,\n errorDescription: errorBody.error_description,\n correlationId: errorBody.correlation_id,\n errorCodes: errorBody.error_codes,\n timestamp: errorBody.timestamp,\n traceId: errorBody.trace_id\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"applicationCredential.browser.js","sourceRoot":"","sources":["../../../src/credentials/applicationCredential.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,wBAAwB,GAAG,IAAI,KAAK,CACxC,kGAAkG,CACnG,CAAC;AACF,MAAM,MAAM,GAAG,gBAAgB,CAAC,uBAAuB,CAAC,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,OAAO,qBAAsB,SAAQ,sBAAsB;IAC/D;;;;OAIG;IACH,YAAY,uBAAgD;QAC1D,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,wBAAwB,CAAC,CAAC,CAAC;QACvD,MAAM,wBAAwB,CAAC;IACjC,CAAC;IAEM,QAAQ;QACb,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,wBAAwB,CAAC,CAAC,CAAC;QAChE,MAAM,wBAAwB,CAAC;IACjC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken } from \"@azure/core-auth\";\n\nimport { TokenCredentialOptions } from \"../client/identityClient\";\nimport { credentialLogger, formatError } from \"../util/logging\";\nimport { ChainedTokenCredential } from \"./chainedTokenCredential\";\n\nconst BrowserNotSupportedError = new Error(\n \"ApplicationCredential is not supported in the browser. Use InteractiveBrowserCredential instead.\"\n);\nconst logger = credentialLogger(\"ApplicationCredential\");\n\n/**\n * Provides a default {@link ChainedTokenCredential} configuration for\n * applications that will be deployed to Azure.\n *\n * Only available in NodeJS.\n */\nexport class ApplicationCredential extends ChainedTokenCredential {\n /**\n * Creates an instance of the ApplicationCredential class.\n *\n * @param options - Options for configuring the client which makes the authentication request.\n */\n constructor(_tokenCredentialOptions?: TokenCredentialOptions) {\n super();\n logger.info(formatError(\"\", BrowserNotSupportedError));\n throw BrowserNotSupportedError;\n }\n\n public getToken(): Promise<AccessToken> {\n logger.getToken.info(formatError(\"\", BrowserNotSupportedError));\n throw BrowserNotSupportedError;\n }\n}\n"]}
@@ -1,37 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { ChainedTokenCredential } from "./chainedTokenCredential";
4
- import { EnvironmentCredential } from "./environmentCredential";
5
- import { DefaultManagedIdentityCredential } from "./defaultAzureCredential";
6
- export const ApplicationCredentials = [
7
- EnvironmentCredential,
8
- DefaultManagedIdentityCredential
9
- ];
10
- /**
11
- * Provides a default {@link ChainedTokenCredential} configuration that should
12
- * work for most applications that use the Azure SDK. The following credential
13
- * types will be tried, in order:
14
- *
15
- * - {@link EnvironmentCredential}
16
- * - {@link ManagedIdentityCredential}
17
-
18
- *
19
- * Consult the documentation of these credential types for more information
20
- * on how they attempt authentication.
21
- *
22
- * Azure Identity extensions may add credential types to the default credential
23
- * stack.
24
- */
25
- export class ApplicationCredential extends ChainedTokenCredential {
26
- /**
27
- * Creates an instance of the ApplicationCredential class.
28
- *
29
- * @param options - Optional parameters. See {@link ApplicationCredentialOptions}.
30
- */
31
- constructor(options) {
32
- super(...ApplicationCredentials.map((ctor) => new ctor(options)));
33
- this.UnavailableMessage =
34
- "ApplicationCredential => failed to retrieve a token from the included credentials";
35
- }
36
- }
37
- //# sourceMappingURL=applicationCredential.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"applicationCredential.js","sourceRoot":"","sources":["../../../src/credentials/applicationCredential.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AAuB5E,MAAM,CAAC,MAAM,sBAAsB,GAAuC;IACxE,qBAAqB;IACrB,gCAAgC;CACjC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,qBAAsB,SAAQ,sBAAsB;IAC/D;;;;OAIG;IACH,YAAY,OAAsC;QAChD,KAAK,CAAC,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAClE,IAAI,CAAC,kBAAkB;YACrB,mFAAmF,CAAC;IACxF,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { TokenCredentialOptions } from \"../client/identityClient\";\nimport { ChainedTokenCredential } from \"./chainedTokenCredential\";\nimport { EnvironmentCredential } from \"./environmentCredential\";\nimport { CredentialPersistenceOptions } from \"./credentialPersistenceOptions\";\nimport { DefaultManagedIdentityCredential } from \"./defaultAzureCredential\";\n\n/**\n * Provides options to configure the {@link ApplicationCredential} class.\n */\nexport interface ApplicationCredentialOptions\n extends TokenCredentialOptions,\n CredentialPersistenceOptions {\n /**\n * Optionally pass in a user assigned client ID to be used by the {@link ManagedIdentityCredential}.\n * This client ID can also be passed through to the {@link ManagedIdentityCredential} through the environment variable: AZURE_CLIENT_ID.\n */\n managedIdentityClientId?: string;\n}\n\n/**\n * The type of a class that implements TokenCredential and accepts\n * `ApplicationCredentialOptions`.\n */\ninterface ApplicationCredentialConstructor {\n new (options?: ApplicationCredentialOptions): TokenCredential;\n}\n\nexport const ApplicationCredentials: ApplicationCredentialConstructor[] = [\n EnvironmentCredential,\n DefaultManagedIdentityCredential\n];\n\n/**\n * Provides a default {@link ChainedTokenCredential} configuration that should\n * work for most applications that use the Azure SDK. The following credential\n * types will be tried, in order:\n *\n * - {@link EnvironmentCredential}\n * - {@link ManagedIdentityCredential}\n\n *\n * Consult the documentation of these credential types for more information\n * on how they attempt authentication.\n *\n * Azure Identity extensions may add credential types to the default credential\n * stack.\n */\nexport class ApplicationCredential extends ChainedTokenCredential {\n /**\n * Creates an instance of the ApplicationCredential class.\n *\n * @param options - Optional parameters. See {@link ApplicationCredentialOptions}.\n */\n constructor(options?: ApplicationCredentialOptions) {\n super(...ApplicationCredentials.map((ctor) => new ctor(options)));\n this.UnavailableMessage =\n \"ApplicationCredential => failed to retrieve a token from the included credentials\";\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"visualStudioCodeCredentialExtension.js","sourceRoot":"","sources":["../../../src/credentials/visualStudioCodeCredentialExtension.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// Copyright (c) Microsoft Corporation\n// Licensed under the MIT license.\n\n/**\n * A function that searches for credentials in the Visual Studio Code credential store.\n *\n * @returns an array of credentials (username and password)\n * @internal\n */\nexport type VSCodeCredentialFinder = () => Promise<Array<{ account: string; password: string }>>;\n"]}
@@ -1,7 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- // This module is a shim for the extension consumer in the browser
4
- export function useIdentityExtension(_extension) {
5
- throw new Error("Identity extensions are not supported in browser environments.");
6
- }
7
- //# sourceMappingURL=consumer.browser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"consumer.browser.js","sourceRoot":"","sources":["../../../src/extensions/consumer.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,kEAAkE;AAElE,MAAM,UAAU,oBAAoB,CAAC,UAAmB;IACtD,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;AACpF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// This module is a shim for the extension consumer in the browser\n\nexport function useIdentityExtension(_extension: unknown): void {\n throw new Error(\"Identity extensions are not supported in browser environments.\");\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"consumer.js","sourceRoot":"","sources":["../../../src/extensions/consumer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAEpF;;;;GAIG;AACH,MAAM,gBAAgB,GAA0B;IAC9C,kBAAkB,EAAE,wBAAwB;IAC5C,uBAAuB,EAAE,uBAAuB;CACjD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAA4B;IAC/D,SAAS,CAAC,gBAAgB,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AzureExtensionContext, IdentityExtension } from \"./provider\";\nimport { msalNodeFlowCacheControl } from \"../msal/nodeFlows/nodeCommon\";\nimport { vsCodeCredentialControl } from \"../credentials/visualStudioCodeCredential\";\n\n/**\n * The context passed to an Identity Extension. This contains objects that\n * extensions can use to set backend implementations.\n * @internal\n */\nconst extensionContext: AzureExtensionContext = {\n cachePluginControl: msalNodeFlowCacheControl,\n vsCodeCredentialControl: vsCodeCredentialControl\n};\n\n/**\n * Extend Azure Identity with additional functionality. Pass an extension from\n * an extension package, such as:\n *\n * - `@azure/identity-cache-persistence`: provides persistent token caching\n * - `@azure/identity-vscode`: provides the dependencies of\n * `VisualStudioCodeCredential` and enables it\n *\n * Example:\n *\n * ```javascript\n * import { cachePersistenceExtension } from \"@azure/identity-cache-persistence\";\n *\n * import { useIdentityExtension, DefaultAzureCredential } from \"@azure/identity\";\n * useIdentityExtension(persistence);\n *\n * // The extension has the capability to extend `DefaultAzureCredential` and to\n * // add middleware to the underlying credentials, such as persistence.\n * const credential = new DefaultAzureCredential({\n * tokenCachePersistenceOptions: {\n * enabled: true\n * }\n * });\n * ```\n *\n * @param extension - the extension to register\n */\nexport function useIdentityExtension(extension: IdentityExtension): void {\n extension(extensionContext);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/extensions/provider.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { VSCodeCredentialFinder } from \"../credentials/visualStudioCodeCredentialExtension\";\nimport { TokenCachePersistenceOptions } from \"../msal/nodeFlows/tokenCachePersistenceOptions\";\n\n/**\n * The type of an Azure Identity Extension, a function accepting an extension\n * context.\n */\nexport type IdentityExtension = (context: unknown) => void;\n\n/**\n * Extension context entries for controlling cache plugins.\n */\nexport interface CachePluginControl {\n setPersistence(\n persistenceFactory: (\n options?: TokenCachePersistenceOptions\n ) => Promise<import(\"@azure/msal-common\").ICachePlugin>\n ): void;\n}\n\n/**\n * Extension context entries for controlling VisualStudioCodeCredential.\n */\nexport interface VisualStudioCodeCredentialControl {\n setVsCodeCredentialFinder(finder: VSCodeCredentialFinder): void;\n}\n\n/**\n * Context options passed to an extension during initialization.\n *\n * Extension authors are responsible for casting their extension context values\n * to this type.\n *\n * @internal\n */\nexport interface AzureExtensionContext {\n cachePluginControl: CachePluginControl;\n vsCodeCredentialControl: VisualStudioCodeCredentialControl;\n}\n"]}
@@ -1,22 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- /**
4
- * Error used to enforce authentication after trying to retrieve a token silently.
5
- */
6
- export class AuthenticationRequiredError extends Error {
7
- constructor(
8
- /**
9
- * The list of scopes for which the token will have access.
10
- */
11
- scopes,
12
- /**
13
- * The options used to configure the getToken request.
14
- */
15
- getTokenOptions = {}, message) {
16
- super(message);
17
- this.scopes = scopes;
18
- this.getTokenOptions = getTokenOptions;
19
- this.name = "AuthenticationRequiredError";
20
- }
21
- }
22
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/msal/errors.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IACpD;IACE;;OAEG;IACI,MAAgB;IACvB;;OAEG;IACI,kBAAmC,EAAE,EAC5C,OAAgB;QAEhB,KAAK,CAAC,OAAO,CAAC,CAAC;QAPR,WAAM,GAAN,MAAM,CAAU;QAIhB,oBAAe,GAAf,eAAe,CAAsB;QAI5C,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC;IAC5C,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { GetTokenOptions } from \"@azure/core-auth\";\n\n/**\n * Error used to enforce authentication after trying to retrieve a token silently.\n */\nexport class AuthenticationRequiredError extends Error {\n constructor(\n /**\n * The list of scopes for which the token will have access.\n */\n public scopes: string[],\n /**\n * The options used to configure the getToken request.\n */\n public getTokenOptions: GetTokenOptions = {},\n message?: string\n ) {\n super(message);\n this.name = \"AuthenticationRequiredError\";\n }\n}\n"]}