@azure/identity 4.8.1-alpha.20250410.1 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/constants.d.ts +1 -1
- package/dist/browser/constants.js +1 -1
- package/dist/browser/constants.js.map +1 -1
- package/dist/commonjs/constants.d.ts +1 -1
- package/dist/commonjs/constants.js +1 -1
- package/dist/commonjs/constants.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/workerd/client/identityClient.d.ts +65 -0
- package/dist/workerd/client/identityClient.d.ts.map +1 -0
- package/dist/workerd/client/identityClient.js +248 -0
- package/dist/workerd/client/identityClient.js.map +1 -0
- package/dist/workerd/constants.d.ts +69 -0
- package/dist/workerd/constants.d.ts.map +1 -0
- package/dist/workerd/constants.js +75 -0
- package/dist/workerd/constants.js.map +1 -0
- package/dist/workerd/credentials/authorityValidationOptions.d.ts +16 -0
- package/dist/workerd/credentials/authorityValidationOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/authorityValidationOptions.js +4 -0
- package/dist/workerd/credentials/authorityValidationOptions.js.map +1 -0
- package/dist/workerd/credentials/authorizationCodeCredential.d.ts +73 -0
- package/dist/workerd/credentials/authorizationCodeCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/authorizationCodeCredential.js +60 -0
- package/dist/workerd/credentials/authorizationCodeCredential.js.map +1 -0
- package/dist/workerd/credentials/authorizationCodeCredentialOptions.d.ts +8 -0
- package/dist/workerd/credentials/authorizationCodeCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/authorizationCodeCredentialOptions.js +4 -0
- package/dist/workerd/credentials/authorizationCodeCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/azureApplicationCredential.d.ts +24 -0
- package/dist/workerd/credentials/azureApplicationCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/azureApplicationCredential.js +32 -0
- package/dist/workerd/credentials/azureApplicationCredential.js.map +1 -0
- package/dist/workerd/credentials/azureApplicationCredentialOptions.d.ts +13 -0
- package/dist/workerd/credentials/azureApplicationCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/azureApplicationCredentialOptions.js +4 -0
- package/dist/workerd/credentials/azureApplicationCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/azureCliCredential.d.ts +64 -0
- package/dist/workerd/credentials/azureCliCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/azureCliCredential.js +191 -0
- package/dist/workerd/credentials/azureCliCredential.js.map +1 -0
- package/dist/workerd/credentials/azureCliCredentialOptions.d.ts +20 -0
- package/dist/workerd/credentials/azureCliCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/azureCliCredentialOptions.js +4 -0
- package/dist/workerd/credentials/azureCliCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/azureDeveloperCliCredential.d.ts +71 -0
- package/dist/workerd/credentials/azureDeveloperCliCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/azureDeveloperCliCredential.js +173 -0
- package/dist/workerd/credentials/azureDeveloperCliCredential.js.map +1 -0
- package/dist/workerd/credentials/azureDeveloperCliCredentialOptions.d.ts +15 -0
- package/dist/workerd/credentials/azureDeveloperCliCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/azureDeveloperCliCredentialOptions.js +4 -0
- package/dist/workerd/credentials/azureDeveloperCliCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/azurePipelinesCredential.d.ts +38 -0
- package/dist/workerd/credentials/azurePipelinesCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/azurePipelinesCredential.js +141 -0
- package/dist/workerd/credentials/azurePipelinesCredential.js.map +1 -0
- package/dist/workerd/credentials/azurePipelinesCredentialOptions.d.ts +9 -0
- package/dist/workerd/credentials/azurePipelinesCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/azurePipelinesCredentialOptions.js +4 -0
- package/dist/workerd/credentials/azurePipelinesCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/azurePowerShellCredential.d.ts +75 -0
- package/dist/workerd/credentials/azurePowerShellCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/azurePowerShellCredential.js +229 -0
- package/dist/workerd/credentials/azurePowerShellCredential.js.map +1 -0
- package/dist/workerd/credentials/azurePowerShellCredentialOptions.d.ts +15 -0
- package/dist/workerd/credentials/azurePowerShellCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/azurePowerShellCredentialOptions.js +4 -0
- package/dist/workerd/credentials/azurePowerShellCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/brokerAuthOptions.d.ts +13 -0
- package/dist/workerd/credentials/brokerAuthOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/brokerAuthOptions.js +2 -0
- package/dist/workerd/credentials/brokerAuthOptions.js.map +1 -0
- package/dist/workerd/credentials/browserCustomizationOptions.d.ts +19 -0
- package/dist/workerd/credentials/browserCustomizationOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/browserCustomizationOptions.js +4 -0
- package/dist/workerd/credentials/browserCustomizationOptions.js.map +1 -0
- package/dist/workerd/credentials/chainedTokenCredential.d.ts +51 -0
- package/dist/workerd/credentials/chainedTokenCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/chainedTokenCredential.js +92 -0
- package/dist/workerd/credentials/chainedTokenCredential.js.map +1 -0
- package/dist/workerd/credentials/clientAssertionCredential.d.ts +33 -0
- package/dist/workerd/credentials/clientAssertionCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/clientAssertionCredential.js +55 -0
- package/dist/workerd/credentials/clientAssertionCredential.js.map +1 -0
- package/dist/workerd/credentials/clientAssertionCredentialOptions.d.ts +9 -0
- package/dist/workerd/credentials/clientAssertionCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/clientAssertionCredentialOptions.js +4 -0
- package/dist/workerd/credentials/clientAssertionCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/clientCertificateCredential.d.ts +72 -0
- package/dist/workerd/credentials/clientCertificateCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/clientCertificateCredential.js +122 -0
- package/dist/workerd/credentials/clientCertificateCredential.js.map +1 -0
- package/dist/workerd/credentials/clientCertificateCredentialModels.d.ts +31 -0
- package/dist/workerd/credentials/clientCertificateCredentialModels.d.ts.map +1 -0
- package/dist/workerd/credentials/clientCertificateCredentialModels.js +4 -0
- package/dist/workerd/credentials/clientCertificateCredentialModels.js.map +1 -0
- package/dist/workerd/credentials/clientCertificateCredentialOptions.d.ts +14 -0
- package/dist/workerd/credentials/clientCertificateCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/clientCertificateCredentialOptions.js +4 -0
- package/dist/workerd/credentials/clientCertificateCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/clientSecretCredential.d.ts +37 -0
- package/dist/workerd/credentials/clientSecretCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/clientSecretCredential.js +60 -0
- package/dist/workerd/credentials/clientSecretCredential.js.map +1 -0
- package/dist/workerd/credentials/clientSecretCredentialOptions.d.ts +9 -0
- package/dist/workerd/credentials/clientSecretCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/clientSecretCredentialOptions.js +4 -0
- package/dist/workerd/credentials/clientSecretCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/credentialPersistenceOptions.d.ts +30 -0
- package/dist/workerd/credentials/credentialPersistenceOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/credentialPersistenceOptions.js +4 -0
- package/dist/workerd/credentials/credentialPersistenceOptions.js.map +1 -0
- package/dist/workerd/credentials/defaultAzureCredential.d.ts +65 -0
- package/dist/workerd/credentials/defaultAzureCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/defaultAzureCredential.js +164 -0
- package/dist/workerd/credentials/defaultAzureCredential.js.map +1 -0
- package/dist/workerd/credentials/defaultAzureCredentialOptions.d.ts +49 -0
- package/dist/workerd/credentials/defaultAzureCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/defaultAzureCredentialOptions.js +4 -0
- package/dist/workerd/credentials/defaultAzureCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/deviceCodeCredential.d.ts +67 -0
- package/dist/workerd/credentials/deviceCodeCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/deviceCodeCredential.js +91 -0
- package/dist/workerd/credentials/deviceCodeCredential.js.map +1 -0
- package/dist/workerd/credentials/deviceCodeCredentialOptions.d.ts +53 -0
- package/dist/workerd/credentials/deviceCodeCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/deviceCodeCredentialOptions.js +4 -0
- package/dist/workerd/credentials/deviceCodeCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/environmentCredential.d.ts +52 -0
- package/dist/workerd/credentials/environmentCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/environmentCredential.js +130 -0
- package/dist/workerd/credentials/environmentCredential.js.map +1 -0
- package/dist/workerd/credentials/environmentCredentialOptions.d.ts +9 -0
- package/dist/workerd/credentials/environmentCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/environmentCredentialOptions.js +4 -0
- package/dist/workerd/credentials/environmentCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/interactiveBrowserCredential.d.ts +56 -0
- package/dist/workerd/credentials/interactiveBrowserCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/interactiveBrowserCredential.js +91 -0
- package/dist/workerd/credentials/interactiveBrowserCredential.js.map +1 -0
- package/dist/workerd/credentials/interactiveBrowserCredentialOptions.d.ts +77 -0
- package/dist/workerd/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/interactiveBrowserCredentialOptions.js +4 -0
- package/dist/workerd/credentials/interactiveBrowserCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/interactiveCredentialOptions.d.ts +25 -0
- package/dist/workerd/credentials/interactiveCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/interactiveCredentialOptions.js +4 -0
- package/dist/workerd/credentials/interactiveCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/managedIdentityCredential/imdsMsi.d.ts +18 -0
- package/dist/workerd/credentials/managedIdentityCredential/imdsMsi.d.ts.map +1 -0
- package/dist/workerd/credentials/managedIdentityCredential/imdsMsi.js +99 -0
- package/dist/workerd/credentials/managedIdentityCredential/imdsMsi.js.map +1 -0
- package/dist/workerd/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts +12 -0
- package/dist/workerd/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts.map +1 -0
- package/dist/workerd/credentials/managedIdentityCredential/imdsRetryPolicy.js +33 -0
- package/dist/workerd/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +1 -0
- package/dist/workerd/credentials/managedIdentityCredential/index.d.ts +61 -0
- package/dist/workerd/credentials/managedIdentityCredential/index.d.ts.map +1 -0
- package/dist/workerd/credentials/managedIdentityCredential/index.js +239 -0
- package/dist/workerd/credentials/managedIdentityCredential/index.js.map +1 -0
- package/dist/workerd/credentials/managedIdentityCredential/models.d.ts +24 -0
- package/dist/workerd/credentials/managedIdentityCredential/models.d.ts.map +1 -0
- package/dist/workerd/credentials/managedIdentityCredential/models.js +4 -0
- package/dist/workerd/credentials/managedIdentityCredential/models.js.map +1 -0
- package/dist/workerd/credentials/managedIdentityCredential/options.d.ts +37 -0
- package/dist/workerd/credentials/managedIdentityCredential/options.d.ts.map +1 -0
- package/dist/workerd/credentials/managedIdentityCredential/options.js +4 -0
- package/dist/workerd/credentials/managedIdentityCredential/options.js.map +1 -0
- package/dist/workerd/credentials/managedIdentityCredential/tokenExchangeMsi.d.ts +14 -0
- package/dist/workerd/credentials/managedIdentityCredential/tokenExchangeMsi.d.ts.map +1 -0
- package/dist/workerd/credentials/managedIdentityCredential/tokenExchangeMsi.js +32 -0
- package/dist/workerd/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -0
- package/dist/workerd/credentials/managedIdentityCredential/utils.d.ts +37 -0
- package/dist/workerd/credentials/managedIdentityCredential/utils.d.ts.map +1 -0
- package/dist/workerd/credentials/managedIdentityCredential/utils.js +81 -0
- package/dist/workerd/credentials/managedIdentityCredential/utils.js.map +1 -0
- package/dist/workerd/credentials/multiTenantTokenCredentialOptions.d.ts +12 -0
- package/dist/workerd/credentials/multiTenantTokenCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/multiTenantTokenCredentialOptions.js +4 -0
- package/dist/workerd/credentials/multiTenantTokenCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/onBehalfOfCredential.d.ts +105 -0
- package/dist/workerd/credentials/onBehalfOfCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/onBehalfOfCredential.js +112 -0
- package/dist/workerd/credentials/onBehalfOfCredential.js.map +1 -0
- package/dist/workerd/credentials/onBehalfOfCredentialOptions.d.ts +76 -0
- package/dist/workerd/credentials/onBehalfOfCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/onBehalfOfCredentialOptions.js +4 -0
- package/dist/workerd/credentials/onBehalfOfCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/usernamePasswordCredential.d.ts +42 -0
- package/dist/workerd/credentials/usernamePasswordCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/usernamePasswordCredential.js +68 -0
- package/dist/workerd/credentials/usernamePasswordCredential.js.map +1 -0
- package/dist/workerd/credentials/usernamePasswordCredentialOptions.d.ts +10 -0
- package/dist/workerd/credentials/usernamePasswordCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/usernamePasswordCredentialOptions.js +4 -0
- package/dist/workerd/credentials/usernamePasswordCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/visualStudioCodeCredential.d.ts +66 -0
- package/dist/workerd/credentials/visualStudioCodeCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/visualStudioCodeCredential.js +196 -0
- package/dist/workerd/credentials/visualStudioCodeCredential.js.map +1 -0
- package/dist/workerd/credentials/visualStudioCodeCredentialOptions.d.ts +16 -0
- package/dist/workerd/credentials/visualStudioCodeCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/visualStudioCodeCredentialOptions.js +4 -0
- package/dist/workerd/credentials/visualStudioCodeCredentialOptions.js.map +1 -0
- package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.d.ts +16 -0
- package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.d.ts.map +1 -0
- package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.js +4 -0
- package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.js.map +1 -0
- package/dist/workerd/credentials/workloadIdentityCredential.d.ts +47 -0
- package/dist/workerd/credentials/workloadIdentityCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/workloadIdentityCredential.js +114 -0
- package/dist/workerd/credentials/workloadIdentityCredential.js.map +1 -0
- package/dist/workerd/credentials/workloadIdentityCredentialOptions.d.ts +20 -0
- package/dist/workerd/credentials/workloadIdentityCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/credentials/workloadIdentityCredentialOptions.js +4 -0
- package/dist/workerd/credentials/workloadIdentityCredentialOptions.js.map +1 -0
- package/dist/workerd/errors.d.ts +139 -0
- package/dist/workerd/errors.d.ts.map +1 -0
- package/dist/workerd/errors.js +123 -0
- package/dist/workerd/errors.js.map +1 -0
- package/dist/workerd/index.d.ts +61 -0
- package/dist/workerd/index.d.ts.map +1 -0
- package/dist/workerd/index.js +34 -0
- package/dist/workerd/index.js.map +1 -0
- package/dist/workerd/msal/browserFlows/msalBrowserCommon.d.ts +19 -0
- package/dist/workerd/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -0
- package/dist/workerd/msal/browserFlows/msalBrowserCommon.js +291 -0
- package/dist/workerd/msal/browserFlows/msalBrowserCommon.js.map +1 -0
- package/dist/workerd/msal/browserFlows/msalBrowserOptions.d.ts +87 -0
- package/dist/workerd/msal/browserFlows/msalBrowserOptions.d.ts.map +1 -0
- package/dist/workerd/msal/browserFlows/msalBrowserOptions.js +4 -0
- package/dist/workerd/msal/browserFlows/msalBrowserOptions.js.map +1 -0
- package/dist/workerd/msal/credentials.d.ts +52 -0
- package/dist/workerd/msal/credentials.d.ts.map +1 -0
- package/dist/workerd/msal/credentials.js +4 -0
- package/dist/workerd/msal/credentials.js.map +1 -0
- package/dist/workerd/msal/msal.d.ts +3 -0
- package/dist/workerd/msal/msal.d.ts.map +1 -0
- package/dist/workerd/msal/msal.js +5 -0
- package/dist/workerd/msal/msal.js.map +1 -0
- package/dist/workerd/msal/nodeFlows/brokerOptions.d.ts +44 -0
- package/dist/workerd/msal/nodeFlows/brokerOptions.d.ts.map +1 -0
- package/dist/workerd/msal/nodeFlows/brokerOptions.js +2 -0
- package/dist/workerd/msal/nodeFlows/brokerOptions.js.map +1 -0
- package/dist/workerd/msal/nodeFlows/msalClient.d.ts +186 -0
- package/dist/workerd/msal/nodeFlows/msalClient.d.ts.map +1 -0
- package/dist/workerd/msal/nodeFlows/msalClient.js +469 -0
- package/dist/workerd/msal/nodeFlows/msalClient.js.map +1 -0
- package/dist/workerd/msal/nodeFlows/msalPlugins.d.ts +91 -0
- package/dist/workerd/msal/nodeFlows/msalPlugins.d.ts.map +1 -0
- package/dist/workerd/msal/nodeFlows/msalPlugins.js +87 -0
- package/dist/workerd/msal/nodeFlows/msalPlugins.js.map +1 -0
- package/dist/workerd/msal/nodeFlows/tokenCachePersistenceOptions.d.ts +24 -0
- package/dist/workerd/msal/nodeFlows/tokenCachePersistenceOptions.d.ts.map +1 -0
- package/dist/workerd/msal/nodeFlows/tokenCachePersistenceOptions.js +4 -0
- package/dist/workerd/msal/nodeFlows/tokenCachePersistenceOptions.js.map +1 -0
- package/dist/workerd/msal/types.d.ts +87 -0
- package/dist/workerd/msal/types.d.ts.map +1 -0
- package/dist/workerd/msal/types.js +4 -0
- package/dist/workerd/msal/types.js.map +1 -0
- package/dist/workerd/msal/utils.d.ts +95 -0
- package/dist/workerd/msal/utils.d.ts.map +1 -0
- package/dist/workerd/msal/utils.js +238 -0
- package/dist/workerd/msal/utils.js.map +1 -0
- package/dist/workerd/package.json +3 -0
- package/dist/workerd/plugins/consumer.d.ts +28 -0
- package/dist/workerd/plugins/consumer.d.ts.map +1 -0
- package/dist/workerd/plugins/consumer.js +43 -0
- package/dist/workerd/plugins/consumer.js.map +1 -0
- package/dist/workerd/plugins/provider.d.ts +36 -0
- package/dist/workerd/plugins/provider.d.ts.map +1 -0
- package/dist/workerd/plugins/provider.js +4 -0
- package/dist/workerd/plugins/provider.js.map +1 -0
- package/dist/workerd/regionalAuthority.d.ts +122 -0
- package/dist/workerd/regionalAuthority.d.ts.map +1 -0
- package/dist/workerd/regionalAuthority.js +140 -0
- package/dist/workerd/regionalAuthority.js.map +1 -0
- package/dist/workerd/tokenCredentialOptions.d.ts +28 -0
- package/dist/workerd/tokenCredentialOptions.d.ts.map +1 -0
- package/dist/workerd/tokenCredentialOptions.js +4 -0
- package/dist/workerd/tokenCredentialOptions.js.map +1 -0
- package/dist/workerd/tokenProvider.d.ts +39 -0
- package/dist/workerd/tokenProvider.d.ts.map +1 -0
- package/dist/workerd/tokenProvider.js +53 -0
- package/dist/workerd/tokenProvider.js.map +1 -0
- package/dist/workerd/util/authHostEnv-browser.d.mts +4 -0
- package/dist/workerd/util/authHostEnv-browser.d.mts.map +1 -0
- package/dist/workerd/util/authHostEnv-browser.mjs +7 -0
- package/dist/workerd/util/authHostEnv-browser.mjs.map +1 -0
- package/dist/workerd/util/identityTokenEndpoint.d.ts +2 -0
- package/dist/workerd/util/identityTokenEndpoint.d.ts.map +1 -0
- package/dist/workerd/util/identityTokenEndpoint.js +11 -0
- package/dist/workerd/util/identityTokenEndpoint.js.map +1 -0
- package/dist/workerd/util/logging.d.ts +70 -0
- package/dist/workerd/util/logging.d.ts.map +1 -0
- package/dist/workerd/util/logging.js +94 -0
- package/dist/workerd/util/logging.js.map +1 -0
- package/dist/workerd/util/processMultiTenantRequest.d.ts +10 -0
- package/dist/workerd/util/processMultiTenantRequest.d.ts.map +1 -0
- package/dist/workerd/util/processMultiTenantRequest.js +35 -0
- package/dist/workerd/util/processMultiTenantRequest.js.map +1 -0
- package/dist/workerd/util/processUtils.d.ts +13 -0
- package/dist/workerd/util/processUtils.d.ts.map +1 -0
- package/dist/workerd/util/processUtils.js +32 -0
- package/dist/workerd/util/processUtils.js.map +1 -0
- package/dist/workerd/util/scopeUtils.d.ts +17 -0
- package/dist/workerd/util/scopeUtils.d.ts.map +1 -0
- package/dist/workerd/util/scopeUtils.js +29 -0
- package/dist/workerd/util/scopeUtils.js.map +1 -0
- package/dist/workerd/util/subscriptionUtils.d.ts +6 -0
- package/dist/workerd/util/subscriptionUtils.d.ts.map +1 -0
- package/dist/workerd/util/subscriptionUtils.js +14 -0
- package/dist/workerd/util/subscriptionUtils.js.map +1 -0
- package/dist/workerd/util/tenantIdUtils.d.ts +15 -0
- package/dist/workerd/util/tenantIdUtils.d.ts.map +1 -0
- package/dist/workerd/util/tenantIdUtils.js +44 -0
- package/dist/workerd/util/tenantIdUtils.js.map +1 -0
- package/dist/workerd/util/tracing.d.ts +6 -0
- package/dist/workerd/util/tracing.d.ts.map +1 -0
- package/dist/workerd/util/tracing.js +14 -0
- package/dist/workerd/util/tracing.js.map +1 -0
- package/package.json +13 -7
@@ -0,0 +1,140 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
/**
|
4
|
+
* Helps specify a regional authority, or "AutoDiscoverRegion" to auto-detect the region.
|
5
|
+
*/
|
6
|
+
export var RegionalAuthority;
|
7
|
+
(function (RegionalAuthority) {
|
8
|
+
/** Instructs MSAL to attempt to discover the region */
|
9
|
+
RegionalAuthority["AutoDiscoverRegion"] = "AutoDiscoverRegion";
|
10
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'westus' region. */
|
11
|
+
RegionalAuthority["USWest"] = "westus";
|
12
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'westus2' region. */
|
13
|
+
RegionalAuthority["USWest2"] = "westus2";
|
14
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'centralus' region. */
|
15
|
+
RegionalAuthority["USCentral"] = "centralus";
|
16
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'eastus' region. */
|
17
|
+
RegionalAuthority["USEast"] = "eastus";
|
18
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'eastus2' region. */
|
19
|
+
RegionalAuthority["USEast2"] = "eastus2";
|
20
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'northcentralus' region. */
|
21
|
+
RegionalAuthority["USNorthCentral"] = "northcentralus";
|
22
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'southcentralus' region. */
|
23
|
+
RegionalAuthority["USSouthCentral"] = "southcentralus";
|
24
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'westcentralus' region. */
|
25
|
+
RegionalAuthority["USWestCentral"] = "westcentralus";
|
26
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'canadacentral' region. */
|
27
|
+
RegionalAuthority["CanadaCentral"] = "canadacentral";
|
28
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'canadaeast' region. */
|
29
|
+
RegionalAuthority["CanadaEast"] = "canadaeast";
|
30
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'brazilsouth' region. */
|
31
|
+
RegionalAuthority["BrazilSouth"] = "brazilsouth";
|
32
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'northeurope' region. */
|
33
|
+
RegionalAuthority["EuropeNorth"] = "northeurope";
|
34
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'westeurope' region. */
|
35
|
+
RegionalAuthority["EuropeWest"] = "westeurope";
|
36
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'uksouth' region. */
|
37
|
+
RegionalAuthority["UKSouth"] = "uksouth";
|
38
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'ukwest' region. */
|
39
|
+
RegionalAuthority["UKWest"] = "ukwest";
|
40
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'francecentral' region. */
|
41
|
+
RegionalAuthority["FranceCentral"] = "francecentral";
|
42
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'francesouth' region. */
|
43
|
+
RegionalAuthority["FranceSouth"] = "francesouth";
|
44
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'switzerlandnorth' region. */
|
45
|
+
RegionalAuthority["SwitzerlandNorth"] = "switzerlandnorth";
|
46
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'switzerlandwest' region. */
|
47
|
+
RegionalAuthority["SwitzerlandWest"] = "switzerlandwest";
|
48
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'germanynorth' region. */
|
49
|
+
RegionalAuthority["GermanyNorth"] = "germanynorth";
|
50
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'germanywestcentral' region. */
|
51
|
+
RegionalAuthority["GermanyWestCentral"] = "germanywestcentral";
|
52
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'norwaywest' region. */
|
53
|
+
RegionalAuthority["NorwayWest"] = "norwaywest";
|
54
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'norwayeast' region. */
|
55
|
+
RegionalAuthority["NorwayEast"] = "norwayeast";
|
56
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'eastasia' region. */
|
57
|
+
RegionalAuthority["AsiaEast"] = "eastasia";
|
58
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'southeastasia' region. */
|
59
|
+
RegionalAuthority["AsiaSouthEast"] = "southeastasia";
|
60
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'japaneast' region. */
|
61
|
+
RegionalAuthority["JapanEast"] = "japaneast";
|
62
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'japanwest' region. */
|
63
|
+
RegionalAuthority["JapanWest"] = "japanwest";
|
64
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'australiaeast' region. */
|
65
|
+
RegionalAuthority["AustraliaEast"] = "australiaeast";
|
66
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'australiasoutheast' region. */
|
67
|
+
RegionalAuthority["AustraliaSouthEast"] = "australiasoutheast";
|
68
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'australiacentral' region. */
|
69
|
+
RegionalAuthority["AustraliaCentral"] = "australiacentral";
|
70
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'australiacentral2' region. */
|
71
|
+
RegionalAuthority["AustraliaCentral2"] = "australiacentral2";
|
72
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'centralindia' region. */
|
73
|
+
RegionalAuthority["IndiaCentral"] = "centralindia";
|
74
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'southindia' region. */
|
75
|
+
RegionalAuthority["IndiaSouth"] = "southindia";
|
76
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'westindia' region. */
|
77
|
+
RegionalAuthority["IndiaWest"] = "westindia";
|
78
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'koreasouth' region. */
|
79
|
+
RegionalAuthority["KoreaSouth"] = "koreasouth";
|
80
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'koreacentral' region. */
|
81
|
+
RegionalAuthority["KoreaCentral"] = "koreacentral";
|
82
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'uaecentral' region. */
|
83
|
+
RegionalAuthority["UAECentral"] = "uaecentral";
|
84
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'uaenorth' region. */
|
85
|
+
RegionalAuthority["UAENorth"] = "uaenorth";
|
86
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'southafricanorth' region. */
|
87
|
+
RegionalAuthority["SouthAfricaNorth"] = "southafricanorth";
|
88
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'southafricawest' region. */
|
89
|
+
RegionalAuthority["SouthAfricaWest"] = "southafricawest";
|
90
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'chinanorth' region. */
|
91
|
+
RegionalAuthority["ChinaNorth"] = "chinanorth";
|
92
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'chinaeast' region. */
|
93
|
+
RegionalAuthority["ChinaEast"] = "chinaeast";
|
94
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'chinanorth2' region. */
|
95
|
+
RegionalAuthority["ChinaNorth2"] = "chinanorth2";
|
96
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'chinaeast2' region. */
|
97
|
+
RegionalAuthority["ChinaEast2"] = "chinaeast2";
|
98
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'germanycentral' region. */
|
99
|
+
RegionalAuthority["GermanyCentral"] = "germanycentral";
|
100
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'germanynortheast' region. */
|
101
|
+
RegionalAuthority["GermanyNorthEast"] = "germanynortheast";
|
102
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'usgovvirginia' region. */
|
103
|
+
RegionalAuthority["GovernmentUSVirginia"] = "usgovvirginia";
|
104
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'usgoviowa' region. */
|
105
|
+
RegionalAuthority["GovernmentUSIowa"] = "usgoviowa";
|
106
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'usgovarizona' region. */
|
107
|
+
RegionalAuthority["GovernmentUSArizona"] = "usgovarizona";
|
108
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'usgovtexas' region. */
|
109
|
+
RegionalAuthority["GovernmentUSTexas"] = "usgovtexas";
|
110
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'usdodeast' region. */
|
111
|
+
RegionalAuthority["GovernmentUSDodEast"] = "usdodeast";
|
112
|
+
/** Uses the {@link RegionalAuthority} for the Azure 'usdodcentral' region. */
|
113
|
+
RegionalAuthority["GovernmentUSDodCentral"] = "usdodcentral";
|
114
|
+
})(RegionalAuthority || (RegionalAuthority = {}));
|
115
|
+
/**
|
116
|
+
* Calculates the correct regional authority based on the supplied value
|
117
|
+
* and the AZURE_REGIONAL_AUTHORITY_NAME environment variable.
|
118
|
+
*
|
119
|
+
* Values will be returned verbatim, except for {@link RegionalAuthority.AutoDiscoverRegion}
|
120
|
+
* which is mapped to a value MSAL can understand.
|
121
|
+
*
|
122
|
+
* @internal
|
123
|
+
*/
|
124
|
+
export function calculateRegionalAuthority(regionalAuthority) {
|
125
|
+
// Note: as of today only 3 credentials support regional authority, and the parameter
|
126
|
+
// is not exposed via the public API. Regional Authority is _only_ supported
|
127
|
+
// via the AZURE_REGIONAL_AUTHORITY_NAME env var and _only_ for: ClientSecretCredential, ClientCertificateCredential, and ClientAssertionCredential.
|
128
|
+
var _a, _b;
|
129
|
+
// Accepting the regionalAuthority parameter will allow us to support it in the future.
|
130
|
+
let azureRegion = regionalAuthority;
|
131
|
+
if (azureRegion === undefined &&
|
132
|
+
((_b = (_a = globalThis.process) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.AZURE_REGIONAL_AUTHORITY_NAME) !== undefined) {
|
133
|
+
azureRegion = process.env.AZURE_REGIONAL_AUTHORITY_NAME;
|
134
|
+
}
|
135
|
+
if (azureRegion === RegionalAuthority.AutoDiscoverRegion) {
|
136
|
+
return "AUTO_DISCOVER";
|
137
|
+
}
|
138
|
+
return azureRegion;
|
139
|
+
}
|
140
|
+
//# sourceMappingURL=regionalAuthority.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"regionalAuthority.js","sourceRoot":"","sources":["../../src/regionalAuthority.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Helps specify a regional authority, or \"AutoDiscoverRegion\" to auto-detect the region.\n */\nexport enum RegionalAuthority {\n /** Instructs MSAL to attempt to discover the region */\n AutoDiscoverRegion = \"AutoDiscoverRegion\",\n /** Uses the {@link RegionalAuthority} for the Azure 'westus' region. */\n USWest = \"westus\",\n /** Uses the {@link RegionalAuthority} for the Azure 'westus2' region. */\n USWest2 = \"westus2\",\n /** Uses the {@link RegionalAuthority} for the Azure 'centralus' region. */\n USCentral = \"centralus\",\n /** Uses the {@link RegionalAuthority} for the Azure 'eastus' region. */\n USEast = \"eastus\",\n /** Uses the {@link RegionalAuthority} for the Azure 'eastus2' region. */\n USEast2 = \"eastus2\",\n /** Uses the {@link RegionalAuthority} for the Azure 'northcentralus' region. */\n USNorthCentral = \"northcentralus\",\n /** Uses the {@link RegionalAuthority} for the Azure 'southcentralus' region. */\n USSouthCentral = \"southcentralus\",\n /** Uses the {@link RegionalAuthority} for the Azure 'westcentralus' region. */\n USWestCentral = \"westcentralus\",\n /** Uses the {@link RegionalAuthority} for the Azure 'canadacentral' region. */\n CanadaCentral = \"canadacentral\",\n /** Uses the {@link RegionalAuthority} for the Azure 'canadaeast' region. */\n CanadaEast = \"canadaeast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'brazilsouth' region. */\n BrazilSouth = \"brazilsouth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'northeurope' region. */\n EuropeNorth = \"northeurope\",\n /** Uses the {@link RegionalAuthority} for the Azure 'westeurope' region. */\n EuropeWest = \"westeurope\",\n /** Uses the {@link RegionalAuthority} for the Azure 'uksouth' region. */\n UKSouth = \"uksouth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'ukwest' region. */\n UKWest = \"ukwest\",\n /** Uses the {@link RegionalAuthority} for the Azure 'francecentral' region. */\n FranceCentral = \"francecentral\",\n /** Uses the {@link RegionalAuthority} for the Azure 'francesouth' region. */\n FranceSouth = \"francesouth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'switzerlandnorth' region. */\n SwitzerlandNorth = \"switzerlandnorth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'switzerlandwest' region. */\n SwitzerlandWest = \"switzerlandwest\",\n /** Uses the {@link RegionalAuthority} for the Azure 'germanynorth' region. */\n GermanyNorth = \"germanynorth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'germanywestcentral' region. */\n GermanyWestCentral = \"germanywestcentral\",\n /** Uses the {@link RegionalAuthority} for the Azure 'norwaywest' region. */\n NorwayWest = \"norwaywest\",\n /** Uses the {@link RegionalAuthority} for the Azure 'norwayeast' region. */\n NorwayEast = \"norwayeast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'eastasia' region. */\n AsiaEast = \"eastasia\",\n /** Uses the {@link RegionalAuthority} for the Azure 'southeastasia' region. */\n AsiaSouthEast = \"southeastasia\",\n /** Uses the {@link RegionalAuthority} for the Azure 'japaneast' region. */\n JapanEast = \"japaneast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'japanwest' region. */\n JapanWest = \"japanwest\",\n /** Uses the {@link RegionalAuthority} for the Azure 'australiaeast' region. */\n AustraliaEast = \"australiaeast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'australiasoutheast' region. */\n AustraliaSouthEast = \"australiasoutheast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'australiacentral' region. */\n AustraliaCentral = \"australiacentral\",\n /** Uses the {@link RegionalAuthority} for the Azure 'australiacentral2' region. */\n AustraliaCentral2 = \"australiacentral2\",\n /** Uses the {@link RegionalAuthority} for the Azure 'centralindia' region. */\n IndiaCentral = \"centralindia\",\n /** Uses the {@link RegionalAuthority} for the Azure 'southindia' region. */\n IndiaSouth = \"southindia\",\n /** Uses the {@link RegionalAuthority} for the Azure 'westindia' region. */\n IndiaWest = \"westindia\",\n /** Uses the {@link RegionalAuthority} for the Azure 'koreasouth' region. */\n KoreaSouth = \"koreasouth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'koreacentral' region. */\n KoreaCentral = \"koreacentral\",\n /** Uses the {@link RegionalAuthority} for the Azure 'uaecentral' region. */\n UAECentral = \"uaecentral\",\n /** Uses the {@link RegionalAuthority} for the Azure 'uaenorth' region. */\n UAENorth = \"uaenorth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'southafricanorth' region. */\n SouthAfricaNorth = \"southafricanorth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'southafricawest' region. */\n SouthAfricaWest = \"southafricawest\",\n /** Uses the {@link RegionalAuthority} for the Azure 'chinanorth' region. */\n ChinaNorth = \"chinanorth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'chinaeast' region. */\n ChinaEast = \"chinaeast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'chinanorth2' region. */\n ChinaNorth2 = \"chinanorth2\",\n /** Uses the {@link RegionalAuthority} for the Azure 'chinaeast2' region. */\n ChinaEast2 = \"chinaeast2\",\n /** Uses the {@link RegionalAuthority} for the Azure 'germanycentral' region. */\n GermanyCentral = \"germanycentral\",\n /** Uses the {@link RegionalAuthority} for the Azure 'germanynortheast' region. */\n GermanyNorthEast = \"germanynortheast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'usgovvirginia' region. */\n GovernmentUSVirginia = \"usgovvirginia\",\n /** Uses the {@link RegionalAuthority} for the Azure 'usgoviowa' region. */\n GovernmentUSIowa = \"usgoviowa\",\n /** Uses the {@link RegionalAuthority} for the Azure 'usgovarizona' region. */\n GovernmentUSArizona = \"usgovarizona\",\n /** Uses the {@link RegionalAuthority} for the Azure 'usgovtexas' region. */\n GovernmentUSTexas = \"usgovtexas\",\n /** Uses the {@link RegionalAuthority} for the Azure 'usdodeast' region. */\n GovernmentUSDodEast = \"usdodeast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'usdodcentral' region. */\n GovernmentUSDodCentral = \"usdodcentral\",\n}\n\n/**\n * Calculates the correct regional authority based on the supplied value\n * and the AZURE_REGIONAL_AUTHORITY_NAME environment variable.\n *\n * Values will be returned verbatim, except for {@link RegionalAuthority.AutoDiscoverRegion}\n * which is mapped to a value MSAL can understand.\n *\n * @internal\n */\nexport function calculateRegionalAuthority(regionalAuthority?: string): string | undefined {\n // Note: as of today only 3 credentials support regional authority, and the parameter\n // is not exposed via the public API. Regional Authority is _only_ supported\n // via the AZURE_REGIONAL_AUTHORITY_NAME env var and _only_ for: ClientSecretCredential, ClientCertificateCredential, and ClientAssertionCredential.\n\n // Accepting the regionalAuthority parameter will allow us to support it in the future.\n let azureRegion = regionalAuthority;\n\n if (\n azureRegion === undefined &&\n globalThis.process?.env?.AZURE_REGIONAL_AUTHORITY_NAME !== undefined\n ) {\n azureRegion = process.env.AZURE_REGIONAL_AUTHORITY_NAME;\n }\n\n if (azureRegion === RegionalAuthority.AutoDiscoverRegion) {\n return \"AUTO_DISCOVER\";\n }\n\n return azureRegion;\n}\n"]}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import type { CommonClientOptions } from "@azure/core-client";
|
2
|
+
import type { LogPolicyOptions } from "@azure/core-rest-pipeline";
|
3
|
+
/**
|
4
|
+
* Provides options to configure how the Identity library makes authentication
|
5
|
+
* requests to Microsoft Entra ID.
|
6
|
+
*/
|
7
|
+
export interface TokenCredentialOptions extends CommonClientOptions {
|
8
|
+
/**
|
9
|
+
* The authority host to use for authentication requests.
|
10
|
+
* Possible values are available through {@link AzureAuthorityHosts}.
|
11
|
+
* The default is "https://login.microsoftonline.com".
|
12
|
+
*/
|
13
|
+
authorityHost?: string;
|
14
|
+
/**
|
15
|
+
* Allows users to configure settings for logging policy options, allow logging account information and personally identifiable information for customer support.
|
16
|
+
*/
|
17
|
+
loggingOptions?: LogPolicyOptions & {
|
18
|
+
/**
|
19
|
+
* Allows logging account information once the authentication flow succeeds.
|
20
|
+
*/
|
21
|
+
allowLoggingAccountIdentifiers?: boolean;
|
22
|
+
/**
|
23
|
+
* Allows logging personally identifiable information for customer support.
|
24
|
+
*/
|
25
|
+
enableUnsafeSupportLogging?: boolean;
|
26
|
+
};
|
27
|
+
}
|
28
|
+
//# sourceMappingURL=tokenCredentialOptions.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"tokenCredentialOptions.d.ts","sourceRoot":"","sources":["../../src/tokenCredentialOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,gBAAgB,GAAG;QAClC;;WAEG;QACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;QACzC;;WAEG;QACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;KACtC,CAAC;CACH"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"tokenCredentialOptions.js","sourceRoot":"","sources":["../../src/tokenCredentialOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CommonClientOptions } from \"@azure/core-client\";\nimport type { LogPolicyOptions } from \"@azure/core-rest-pipeline\";\n\n/**\n * Provides options to configure how the Identity library makes authentication\n * requests to Microsoft Entra ID.\n */\nexport interface TokenCredentialOptions extends CommonClientOptions {\n /**\n * The authority host to use for authentication requests.\n * Possible values are available through {@link AzureAuthorityHosts}.\n * The default is \"https://login.microsoftonline.com\".\n */\n authorityHost?: string;\n /**\n * Allows users to configure settings for logging policy options, allow logging account information and personally identifiable information for customer support.\n */\n loggingOptions?: LogPolicyOptions & {\n /**\n * Allows logging account information once the authentication flow succeeds.\n */\n allowLoggingAccountIdentifiers?: boolean;\n /**\n * Allows logging personally identifiable information for customer support.\n */\n enableUnsafeSupportLogging?: boolean;\n };\n}\n"]}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import type { TokenCredential, TracingContext } from "@azure/core-auth";
|
2
|
+
/**
|
3
|
+
* The options to configure the token provider.
|
4
|
+
*/
|
5
|
+
export interface GetBearerTokenProviderOptions {
|
6
|
+
/** The abort signal to abort requests to get tokens */
|
7
|
+
abortSignal?: AbortSignal;
|
8
|
+
/** The tracing options for the requests to get tokens */
|
9
|
+
tracingOptions?: {
|
10
|
+
/**
|
11
|
+
* Tracing Context for the current request to get a token.
|
12
|
+
*/
|
13
|
+
tracingContext?: TracingContext;
|
14
|
+
};
|
15
|
+
}
|
16
|
+
/**
|
17
|
+
* Returns a callback that provides a bearer token.
|
18
|
+
* For example, the bearer token can be used to authenticate a request as follows:
|
19
|
+
* ```ts snippet:token_provider_example
|
20
|
+
* import { DefaultAzureCredential, getBearerTokenProvider } from "@azure/identity";
|
21
|
+
* import { createPipelineRequest } from "@azure/core-rest-pipeline";
|
22
|
+
*
|
23
|
+
* const credential = new DefaultAzureCredential();
|
24
|
+
* const scope = "https://cognitiveservices.azure.com/.default";
|
25
|
+
* const getAccessToken = getBearerTokenProvider(credential, scope);
|
26
|
+
* const token = await getAccessToken();
|
27
|
+
*
|
28
|
+
* // usage
|
29
|
+
* const request = createPipelineRequest({ url: "https://example.com" });
|
30
|
+
* request.headers.set("Authorization", `Bearer ${token}`);
|
31
|
+
* ```
|
32
|
+
*
|
33
|
+
* @param credential - The credential used to authenticate the request.
|
34
|
+
* @param scopes - The scopes required for the bearer token.
|
35
|
+
* @param options - Options to configure the token provider.
|
36
|
+
* @returns a callback that provides a bearer token.
|
37
|
+
*/
|
38
|
+
export declare function getBearerTokenProvider(credential: TokenCredential, scopes: string | string[], options?: GetBearerTokenProviderOptions): () => Promise<string>;
|
39
|
+
//# sourceMappingURL=tokenProvider.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"tokenProvider.d.ts","sourceRoot":"","sources":["../../src/tokenProvider.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOxE;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,uDAAuD;IACvD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,yDAAyD;IACzD,cAAc,CAAC,EAAE;QACf;;WAEG;QACH,cAAc,CAAC,EAAE,cAAc,CAAC;KACjC,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,eAAe,EAC3B,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EACzB,OAAO,CAAC,EAAE,6BAA6B,GACtC,MAAM,OAAO,CAAC,MAAM,CAAC,CA6BvB"}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
import { bearerTokenAuthenticationPolicy, createEmptyPipeline, createPipelineRequest, } from "@azure/core-rest-pipeline";
|
4
|
+
/**
|
5
|
+
* Returns a callback that provides a bearer token.
|
6
|
+
* For example, the bearer token can be used to authenticate a request as follows:
|
7
|
+
* ```ts snippet:token_provider_example
|
8
|
+
* import { DefaultAzureCredential, getBearerTokenProvider } from "@azure/identity";
|
9
|
+
* import { createPipelineRequest } from "@azure/core-rest-pipeline";
|
10
|
+
*
|
11
|
+
* const credential = new DefaultAzureCredential();
|
12
|
+
* const scope = "https://cognitiveservices.azure.com/.default";
|
13
|
+
* const getAccessToken = getBearerTokenProvider(credential, scope);
|
14
|
+
* const token = await getAccessToken();
|
15
|
+
*
|
16
|
+
* // usage
|
17
|
+
* const request = createPipelineRequest({ url: "https://example.com" });
|
18
|
+
* request.headers.set("Authorization", `Bearer ${token}`);
|
19
|
+
* ```
|
20
|
+
*
|
21
|
+
* @param credential - The credential used to authenticate the request.
|
22
|
+
* @param scopes - The scopes required for the bearer token.
|
23
|
+
* @param options - Options to configure the token provider.
|
24
|
+
* @returns a callback that provides a bearer token.
|
25
|
+
*/
|
26
|
+
export function getBearerTokenProvider(credential, scopes, options) {
|
27
|
+
const { abortSignal, tracingOptions } = options || {};
|
28
|
+
const pipeline = createEmptyPipeline();
|
29
|
+
pipeline.addPolicy(bearerTokenAuthenticationPolicy({ credential, scopes }));
|
30
|
+
async function getRefreshedToken() {
|
31
|
+
var _a;
|
32
|
+
// Create a pipeline with just the bearer token policy
|
33
|
+
// and run a dummy request through it to get the token
|
34
|
+
const res = await pipeline.sendRequest({
|
35
|
+
sendRequest: (request) => Promise.resolve({
|
36
|
+
request,
|
37
|
+
status: 200,
|
38
|
+
headers: request.headers,
|
39
|
+
}),
|
40
|
+
}, createPipelineRequest({
|
41
|
+
url: "https://example.com",
|
42
|
+
abortSignal,
|
43
|
+
tracingOptions,
|
44
|
+
}));
|
45
|
+
const accessToken = (_a = res.headers.get("authorization")) === null || _a === void 0 ? void 0 : _a.split(" ")[1];
|
46
|
+
if (!accessToken) {
|
47
|
+
throw new Error("Failed to get access token");
|
48
|
+
}
|
49
|
+
return accessToken;
|
50
|
+
}
|
51
|
+
return getRefreshedToken;
|
52
|
+
}
|
53
|
+
//# sourceMappingURL=tokenProvider.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"tokenProvider.js","sourceRoot":"","sources":["../../src/tokenProvider.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,+BAA+B,EAC/B,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAiBnC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAA2B,EAC3B,MAAyB,EACzB,OAAuC;IAEvC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IACtD,MAAM,QAAQ,GAAG,mBAAmB,EAAE,CAAC;IACvC,QAAQ,CAAC,SAAS,CAAC,+BAA+B,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAC5E,KAAK,UAAU,iBAAiB;;QAC9B,sDAAsD;QACtD,sDAAsD;QACtD,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,WAAW,CACpC;YACE,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CACvB,OAAO,CAAC,OAAO,CAAC;gBACd,OAAO;gBACP,MAAM,EAAE,GAAG;gBACX,OAAO,EAAE,OAAO,CAAC,OAAO;aACzB,CAAC;SACL,EACD,qBAAqB,CAAC;YACpB,GAAG,EAAE,qBAAqB;YAC1B,WAAW;YACX,cAAc;SACf,CAAC,CACH,CAAC;QACF,MAAM,WAAW,GAAG,MAAA,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,0CAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACpE,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { TokenCredential, TracingContext } from \"@azure/core-auth\";\nimport {\n bearerTokenAuthenticationPolicy,\n createEmptyPipeline,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\n\n/**\n * The options to configure the token provider.\n */\nexport interface GetBearerTokenProviderOptions {\n /** The abort signal to abort requests to get tokens */\n abortSignal?: AbortSignal;\n /** The tracing options for the requests to get tokens */\n tracingOptions?: {\n /**\n * Tracing Context for the current request to get a token.\n */\n tracingContext?: TracingContext;\n };\n}\n\n/**\n * Returns a callback that provides a bearer token.\n * For example, the bearer token can be used to authenticate a request as follows:\n * ```ts snippet:token_provider_example\n * import { DefaultAzureCredential, getBearerTokenProvider } from \"@azure/identity\";\n * import { createPipelineRequest } from \"@azure/core-rest-pipeline\";\n *\n * const credential = new DefaultAzureCredential();\n * const scope = \"https://cognitiveservices.azure.com/.default\";\n * const getAccessToken = getBearerTokenProvider(credential, scope);\n * const token = await getAccessToken();\n *\n * // usage\n * const request = createPipelineRequest({ url: \"https://example.com\" });\n * request.headers.set(\"Authorization\", `Bearer ${token}`);\n * ```\n *\n * @param credential - The credential used to authenticate the request.\n * @param scopes - The scopes required for the bearer token.\n * @param options - Options to configure the token provider.\n * @returns a callback that provides a bearer token.\n */\nexport function getBearerTokenProvider(\n credential: TokenCredential,\n scopes: string | string[],\n options?: GetBearerTokenProviderOptions,\n): () => Promise<string> {\n const { abortSignal, tracingOptions } = options || {};\n const pipeline = createEmptyPipeline();\n pipeline.addPolicy(bearerTokenAuthenticationPolicy({ credential, scopes }));\n async function getRefreshedToken(): Promise<string> {\n // Create a pipeline with just the bearer token policy\n // and run a dummy request through it to get the token\n const res = await pipeline.sendRequest(\n {\n sendRequest: (request) =>\n Promise.resolve({\n request,\n status: 200,\n headers: request.headers,\n }),\n },\n createPipelineRequest({\n url: \"https://example.com\",\n abortSignal,\n tracingOptions,\n }),\n );\n const accessToken = res.headers.get(\"authorization\")?.split(\" \")[1];\n if (!accessToken) {\n throw new Error(\"Failed to get access token\");\n }\n return accessToken;\n }\n return getRefreshedToken;\n}\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"authHostEnv-browser.d.mts","sourceRoot":"","sources":["../../../src/util/authHostEnv-browser.mts"],"names":[],"mappings":"AAOA,wBAAgB,2BAA2B,IAAI;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAEnF"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
const BrowserNotSupportedError = new Error("getAuthorityHostEnvironment is not supported in the browser.");
|
4
|
+
export function getAuthorityHostEnvironment() {
|
5
|
+
throw BrowserNotSupportedError;
|
6
|
+
}
|
7
|
+
//# sourceMappingURL=authHostEnv-browser.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"authHostEnv-browser.mjs","sourceRoot":"","sources":["../../../src/util/authHostEnv-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,wBAAwB,GAAG,IAAI,KAAK,CACxC,8DAA8D,CAC/D,CAAC;AAEF,MAAM,UAAU,2BAA2B;IACzC,MAAM,wBAAwB,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nconst BrowserNotSupportedError = new Error(\n \"getAuthorityHostEnvironment is not supported in the browser.\",\n);\n\nexport function getAuthorityHostEnvironment(): { authorityHost: string } | undefined {\n throw BrowserNotSupportedError;\n}\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"identityTokenEndpoint.d.ts","sourceRoot":"","sources":["../../../src/util/identityTokenEndpoint.ts"],"names":[],"mappings":"AAGA,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMvE"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
export function getIdentityTokenEndpointSuffix(tenantId) {
|
4
|
+
if (tenantId === "adfs") {
|
5
|
+
return "oauth2/token";
|
6
|
+
}
|
7
|
+
else {
|
8
|
+
return "oauth2/v2.0/token";
|
9
|
+
}
|
10
|
+
}
|
11
|
+
//# sourceMappingURL=identityTokenEndpoint.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"identityTokenEndpoint.js","sourceRoot":"","sources":["../../../src/util/identityTokenEndpoint.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,UAAU,8BAA8B,CAAC,QAAgB;IAC7D,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACxB,OAAO,cAAc,CAAC;IACxB,CAAC;SAAM,CAAC;QACN,OAAO,mBAAmB,CAAC;IAC7B,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport function getIdentityTokenEndpointSuffix(tenantId: string): string {\n if (tenantId === \"adfs\") {\n return \"oauth2/token\";\n } else {\n return \"oauth2/v2.0/token\";\n }\n}\n"]}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import type { AzureLogger } from "@azure/logger";
|
2
|
+
/**
|
3
|
+
* The AzureLogger used for all clients within the identity package
|
4
|
+
*/
|
5
|
+
export declare const logger: AzureLogger;
|
6
|
+
interface EnvironmentAccumulator {
|
7
|
+
missing: string[];
|
8
|
+
assigned: string[];
|
9
|
+
}
|
10
|
+
/**
|
11
|
+
* Separates a list of environment variable names into a plain object with two arrays: an array of missing environment variables and another array with assigned environment variables.
|
12
|
+
* @param supportedEnvVars - List of environment variable names
|
13
|
+
*/
|
14
|
+
export declare function processEnvVars(supportedEnvVars: string[]): EnvironmentAccumulator;
|
15
|
+
/**
|
16
|
+
* Based on a given list of environment variable names,
|
17
|
+
* logs the environment variables currently assigned during the usage of a credential that goes by the given name.
|
18
|
+
* @param credentialName - Name of the credential in use
|
19
|
+
* @param supportedEnvVars - List of environment variables supported by that credential
|
20
|
+
*/
|
21
|
+
export declare function logEnvVars(credentialName: string, supportedEnvVars: string[]): void;
|
22
|
+
/**
|
23
|
+
* Formatting the success event on the credentials
|
24
|
+
*/
|
25
|
+
export declare function formatSuccess(scope: string | string[]): string;
|
26
|
+
/**
|
27
|
+
* Formatting the success event on the credentials
|
28
|
+
*/
|
29
|
+
export declare function formatError(scope: string | string[] | undefined, error: Error | string): string;
|
30
|
+
/**
|
31
|
+
* A CredentialLoggerInstance is a logger properly formatted to work in a credential's constructor, and its methods.
|
32
|
+
*/
|
33
|
+
export interface CredentialLoggerInstance {
|
34
|
+
title: string;
|
35
|
+
fullTitle: string;
|
36
|
+
info(message: string): void;
|
37
|
+
warning(message: string): void;
|
38
|
+
verbose(message: string): void;
|
39
|
+
error(err: string): void;
|
40
|
+
}
|
41
|
+
/**
|
42
|
+
* Generates a CredentialLoggerInstance.
|
43
|
+
*
|
44
|
+
* It logs with the format:
|
45
|
+
*
|
46
|
+
* `[title] => [message]`
|
47
|
+
*
|
48
|
+
*/
|
49
|
+
export declare function credentialLoggerInstance(title: string, parent?: CredentialLoggerInstance, log?: AzureLogger): CredentialLoggerInstance;
|
50
|
+
/**
|
51
|
+
* A CredentialLogger is a logger declared at the credential's constructor, and used at any point in the credential.
|
52
|
+
* It has all the properties of a CredentialLoggerInstance, plus other logger instances, one per method.
|
53
|
+
*/
|
54
|
+
export interface CredentialLogger extends CredentialLoggerInstance {
|
55
|
+
parent: AzureLogger;
|
56
|
+
getToken: CredentialLoggerInstance;
|
57
|
+
}
|
58
|
+
/**
|
59
|
+
* Generates a CredentialLogger, which is a logger declared at the credential's constructor, and used at any point in the credential.
|
60
|
+
* It has all the properties of a CredentialLoggerInstance, plus other logger instances, one per method.
|
61
|
+
*
|
62
|
+
* It logs with the format:
|
63
|
+
*
|
64
|
+
* `[title] => [message]`
|
65
|
+
* `[title] => getToken() => [message]`
|
66
|
+
*
|
67
|
+
*/
|
68
|
+
export declare function credentialLogger(title: string, log?: AzureLogger): CredentialLogger;
|
69
|
+
export {};
|
70
|
+
//# sourceMappingURL=logging.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/util/logging.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD;;GAEG;AACH,eAAO,MAAM,MAAM,aAAiC,CAAC;AAErD,UAAU,sBAAsB;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,gBAAgB,EAAE,MAAM,EAAE,GAAG,sBAAsB,CAYjF;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,GAAG,IAAI,CAKnF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAE9D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAM/F;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,wBAAwB,EACjC,GAAG,GAAE,WAAoB,GACxB,wBAAwB,CA2B1B;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,wBAAwB;IAChE,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,wBAAwB,CAAC;CACpC;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,GAAE,WAAoB,GAAG,gBAAgB,CAO3F"}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
import { createClientLogger } from "@azure/logger";
|
4
|
+
/**
|
5
|
+
* The AzureLogger used for all clients within the identity package
|
6
|
+
*/
|
7
|
+
export const logger = createClientLogger("identity");
|
8
|
+
/**
|
9
|
+
* Separates a list of environment variable names into a plain object with two arrays: an array of missing environment variables and another array with assigned environment variables.
|
10
|
+
* @param supportedEnvVars - List of environment variable names
|
11
|
+
*/
|
12
|
+
export function processEnvVars(supportedEnvVars) {
|
13
|
+
return supportedEnvVars.reduce((acc, envVariable) => {
|
14
|
+
if (process.env[envVariable]) {
|
15
|
+
acc.assigned.push(envVariable);
|
16
|
+
}
|
17
|
+
else {
|
18
|
+
acc.missing.push(envVariable);
|
19
|
+
}
|
20
|
+
return acc;
|
21
|
+
}, { missing: [], assigned: [] });
|
22
|
+
}
|
23
|
+
/**
|
24
|
+
* Based on a given list of environment variable names,
|
25
|
+
* logs the environment variables currently assigned during the usage of a credential that goes by the given name.
|
26
|
+
* @param credentialName - Name of the credential in use
|
27
|
+
* @param supportedEnvVars - List of environment variables supported by that credential
|
28
|
+
*/
|
29
|
+
export function logEnvVars(credentialName, supportedEnvVars) {
|
30
|
+
const { assigned } = processEnvVars(supportedEnvVars);
|
31
|
+
logger.info(`${credentialName} => Found the following environment variables: ${assigned.join(", ")}`);
|
32
|
+
}
|
33
|
+
/**
|
34
|
+
* Formatting the success event on the credentials
|
35
|
+
*/
|
36
|
+
export function formatSuccess(scope) {
|
37
|
+
return `SUCCESS. Scopes: ${Array.isArray(scope) ? scope.join(", ") : scope}.`;
|
38
|
+
}
|
39
|
+
/**
|
40
|
+
* Formatting the success event on the credentials
|
41
|
+
*/
|
42
|
+
export function formatError(scope, error) {
|
43
|
+
let message = "ERROR.";
|
44
|
+
if (scope === null || scope === void 0 ? void 0 : scope.length) {
|
45
|
+
message += ` Scopes: ${Array.isArray(scope) ? scope.join(", ") : scope}.`;
|
46
|
+
}
|
47
|
+
return `${message} Error message: ${typeof error === "string" ? error : error.message}.`;
|
48
|
+
}
|
49
|
+
/**
|
50
|
+
* Generates a CredentialLoggerInstance.
|
51
|
+
*
|
52
|
+
* It logs with the format:
|
53
|
+
*
|
54
|
+
* `[title] => [message]`
|
55
|
+
*
|
56
|
+
*/
|
57
|
+
export function credentialLoggerInstance(title, parent, log = logger) {
|
58
|
+
const fullTitle = parent ? `${parent.fullTitle} ${title}` : title;
|
59
|
+
function info(message) {
|
60
|
+
log.info(`${fullTitle} =>`, message);
|
61
|
+
}
|
62
|
+
function warning(message) {
|
63
|
+
log.warning(`${fullTitle} =>`, message);
|
64
|
+
}
|
65
|
+
function verbose(message) {
|
66
|
+
log.verbose(`${fullTitle} =>`, message);
|
67
|
+
}
|
68
|
+
function error(message) {
|
69
|
+
log.error(`${fullTitle} =>`, message);
|
70
|
+
}
|
71
|
+
return {
|
72
|
+
title,
|
73
|
+
fullTitle,
|
74
|
+
info,
|
75
|
+
warning,
|
76
|
+
verbose,
|
77
|
+
error,
|
78
|
+
};
|
79
|
+
}
|
80
|
+
/**
|
81
|
+
* Generates a CredentialLogger, which is a logger declared at the credential's constructor, and used at any point in the credential.
|
82
|
+
* It has all the properties of a CredentialLoggerInstance, plus other logger instances, one per method.
|
83
|
+
*
|
84
|
+
* It logs with the format:
|
85
|
+
*
|
86
|
+
* `[title] => [message]`
|
87
|
+
* `[title] => getToken() => [message]`
|
88
|
+
*
|
89
|
+
*/
|
90
|
+
export function credentialLogger(title, log = logger) {
|
91
|
+
const credLogger = credentialLoggerInstance(title, undefined, log);
|
92
|
+
return Object.assign(Object.assign({}, credLogger), { parent: log, getToken: credentialLoggerInstance("=> getToken()", credLogger, log) });
|
93
|
+
}
|
94
|
+
//# sourceMappingURL=logging.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../../src/util/logging.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;AAOrD;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,gBAA0B;IACvD,OAAO,gBAAgB,CAAC,MAAM,CAC5B,CAAC,GAA2B,EAAE,WAAmB,EAAE,EAAE;QACnD,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YAC7B,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAChC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAC9B,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,cAAsB,EAAE,gBAA0B;IAC3E,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC,gBAAgB,CAAC,CAAC;IACtD,MAAM,CAAC,IAAI,CACT,GAAG,cAAc,kDAAkD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACzF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAwB;IACpD,OAAO,oBAAoB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;AAChF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAoC,EAAE,KAAqB;IACrF,IAAI,OAAO,GAAG,QAAQ,CAAC;IACvB,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,EAAE,CAAC;QAClB,OAAO,IAAI,YAAY,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;IAC5E,CAAC;IACD,OAAO,GAAG,OAAO,mBAAmB,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC;AAC3F,CAAC;AAcD;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CACtC,KAAa,EACb,MAAiC,EACjC,MAAmB,MAAM;IAEzB,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,SAAS,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAElE,SAAS,IAAI,CAAC,OAAe;QAC3B,GAAG,CAAC,IAAI,CAAC,GAAG,SAAS,KAAK,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IAED,SAAS,OAAO,CAAC,OAAe;QAC9B,GAAG,CAAC,OAAO,CAAC,GAAG,SAAS,KAAK,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,SAAS,OAAO,CAAC,OAAe;QAC9B,GAAG,CAAC,OAAO,CAAC,GAAG,SAAS,KAAK,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,SAAS,KAAK,CAAC,OAAe;QAC5B,GAAG,CAAC,KAAK,CAAC,GAAG,SAAS,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,OAAO;QACL,KAAK;QACL,SAAS;QACT,IAAI;QACJ,OAAO;QACP,OAAO;QACP,KAAK;KACN,CAAC;AACJ,CAAC;AAWD;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa,EAAE,MAAmB,MAAM;IACvE,MAAM,UAAU,GAAG,wBAAwB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IACnE,uCACK,UAAU,KACb,MAAM,EAAE,GAAG,EACX,QAAQ,EAAE,wBAAwB,CAAC,eAAe,EAAE,UAAU,EAAE,GAAG,CAAC,IACpE;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AzureLogger } from \"@azure/logger\";\nimport { createClientLogger } from \"@azure/logger\";\n\n/**\n * The AzureLogger used for all clients within the identity package\n */\nexport const logger = createClientLogger(\"identity\");\n\ninterface EnvironmentAccumulator {\n missing: string[];\n assigned: string[];\n}\n\n/**\n * Separates a list of environment variable names into a plain object with two arrays: an array of missing environment variables and another array with assigned environment variables.\n * @param supportedEnvVars - List of environment variable names\n */\nexport function processEnvVars(supportedEnvVars: string[]): EnvironmentAccumulator {\n return supportedEnvVars.reduce(\n (acc: EnvironmentAccumulator, envVariable: string) => {\n if (process.env[envVariable]) {\n acc.assigned.push(envVariable);\n } else {\n acc.missing.push(envVariable);\n }\n return acc;\n },\n { missing: [], assigned: [] },\n );\n}\n\n/**\n * Based on a given list of environment variable names,\n * logs the environment variables currently assigned during the usage of a credential that goes by the given name.\n * @param credentialName - Name of the credential in use\n * @param supportedEnvVars - List of environment variables supported by that credential\n */\nexport function logEnvVars(credentialName: string, supportedEnvVars: string[]): void {\n const { assigned } = processEnvVars(supportedEnvVars);\n logger.info(\n `${credentialName} => Found the following environment variables: ${assigned.join(\", \")}`,\n );\n}\n\n/**\n * Formatting the success event on the credentials\n */\nexport function formatSuccess(scope: string | string[]): string {\n return `SUCCESS. Scopes: ${Array.isArray(scope) ? scope.join(\", \") : scope}.`;\n}\n\n/**\n * Formatting the success event on the credentials\n */\nexport function formatError(scope: string | string[] | undefined, error: Error | string): string {\n let message = \"ERROR.\";\n if (scope?.length) {\n message += ` Scopes: ${Array.isArray(scope) ? scope.join(\", \") : scope}.`;\n }\n return `${message} Error message: ${typeof error === \"string\" ? error : error.message}.`;\n}\n\n/**\n * A CredentialLoggerInstance is a logger properly formatted to work in a credential's constructor, and its methods.\n */\nexport interface CredentialLoggerInstance {\n title: string;\n fullTitle: string;\n info(message: string): void;\n warning(message: string): void;\n verbose(message: string): void;\n error(err: string): void;\n}\n\n/**\n * Generates a CredentialLoggerInstance.\n *\n * It logs with the format:\n *\n * `[title] => [message]`\n *\n */\nexport function credentialLoggerInstance(\n title: string,\n parent?: CredentialLoggerInstance,\n log: AzureLogger = logger,\n): CredentialLoggerInstance {\n const fullTitle = parent ? `${parent.fullTitle} ${title}` : title;\n\n function info(message: string): void {\n log.info(`${fullTitle} =>`, message);\n }\n\n function warning(message: string): void {\n log.warning(`${fullTitle} =>`, message);\n }\n\n function verbose(message: string): void {\n log.verbose(`${fullTitle} =>`, message);\n }\n\n function error(message: string): void {\n log.error(`${fullTitle} =>`, message);\n }\n\n return {\n title,\n fullTitle,\n info,\n warning,\n verbose,\n error,\n };\n}\n\n/**\n * A CredentialLogger is a logger declared at the credential's constructor, and used at any point in the credential.\n * It has all the properties of a CredentialLoggerInstance, plus other logger instances, one per method.\n */\nexport interface CredentialLogger extends CredentialLoggerInstance {\n parent: AzureLogger;\n getToken: CredentialLoggerInstance;\n}\n\n/**\n * Generates a CredentialLogger, which is a logger declared at the credential's constructor, and used at any point in the credential.\n * It has all the properties of a CredentialLoggerInstance, plus other logger instances, one per method.\n *\n * It logs with the format:\n *\n * `[title] => [message]`\n * `[title] => getToken() => [message]`\n *\n */\nexport function credentialLogger(title: string, log: AzureLogger = logger): CredentialLogger {\n const credLogger = credentialLoggerInstance(title, undefined, log);\n return {\n ...credLogger,\n parent: log,\n getToken: credentialLoggerInstance(\"=> getToken()\", credLogger, log),\n };\n}\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { GetTokenOptions } from "@azure/core-auth";
|
2
|
+
import type { CredentialLogger } from "./logging.js";
|
3
|
+
/**
|
4
|
+
* Of getToken contains a tenantId, this functions allows picking this tenantId as the appropriate for authentication,
|
5
|
+
* unless multitenant authentication has been disabled through the AZURE_IDENTITY_DISABLE_MULTITENANTAUTH (on Node.js),
|
6
|
+
* or unless the original tenant Id is `adfs`.
|
7
|
+
* @internal
|
8
|
+
*/
|
9
|
+
export declare function processMultiTenantRequest(tenantId?: string, getTokenOptions?: GetTokenOptions, additionallyAllowedTenantIds?: string[], logger?: CredentialLogger): string | undefined;
|
10
|
+
//# sourceMappingURL=processMultiTenantRequest.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"processMultiTenantRequest.d.ts","sourceRoot":"","sources":["../../../src/util/processMultiTenantRequest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAMrD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,CAAC,EAAE,MAAM,EACjB,eAAe,CAAC,EAAE,eAAe,EACjC,4BAA4B,GAAE,MAAM,EAAO,EAC3C,MAAM,CAAC,EAAE,gBAAgB,GACxB,MAAM,GAAG,SAAS,CAqBpB"}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
import { CredentialUnavailableError } from "../errors.js";
|
4
|
+
function createConfigurationErrorMessage(tenantId) {
|
5
|
+
return `The current credential is not configured to acquire tokens for tenant ${tenantId}. To enable acquiring tokens for this tenant add it to the AdditionallyAllowedTenants on the credential options, or add "*" to AdditionallyAllowedTenants to allow acquiring tokens for any tenant.`;
|
6
|
+
}
|
7
|
+
/**
|
8
|
+
* Of getToken contains a tenantId, this functions allows picking this tenantId as the appropriate for authentication,
|
9
|
+
* unless multitenant authentication has been disabled through the AZURE_IDENTITY_DISABLE_MULTITENANTAUTH (on Node.js),
|
10
|
+
* or unless the original tenant Id is `adfs`.
|
11
|
+
* @internal
|
12
|
+
*/
|
13
|
+
export function processMultiTenantRequest(tenantId, getTokenOptions, additionallyAllowedTenantIds = [], logger) {
|
14
|
+
var _a;
|
15
|
+
let resolvedTenantId;
|
16
|
+
if (process.env.AZURE_IDENTITY_DISABLE_MULTITENANTAUTH) {
|
17
|
+
resolvedTenantId = tenantId;
|
18
|
+
}
|
19
|
+
else if (tenantId === "adfs") {
|
20
|
+
resolvedTenantId = tenantId;
|
21
|
+
}
|
22
|
+
else {
|
23
|
+
resolvedTenantId = (_a = getTokenOptions === null || getTokenOptions === void 0 ? void 0 : getTokenOptions.tenantId) !== null && _a !== void 0 ? _a : tenantId;
|
24
|
+
}
|
25
|
+
if (tenantId &&
|
26
|
+
resolvedTenantId !== tenantId &&
|
27
|
+
!additionallyAllowedTenantIds.includes("*") &&
|
28
|
+
!additionallyAllowedTenantIds.some((t) => t.localeCompare(resolvedTenantId) === 0)) {
|
29
|
+
const message = createConfigurationErrorMessage(resolvedTenantId);
|
30
|
+
logger === null || logger === void 0 ? void 0 : logger.info(message);
|
31
|
+
throw new CredentialUnavailableError(message);
|
32
|
+
}
|
33
|
+
return resolvedTenantId;
|
34
|
+
}
|
35
|
+
//# sourceMappingURL=processMultiTenantRequest.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"processMultiTenantRequest.js","sourceRoot":"","sources":["../../../src/util/processMultiTenantRequest.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAG1D,SAAS,+BAA+B,CAAC,QAAgB;IACvD,OAAO,yEAAyE,QAAQ,qMAAqM,CAAC;AAChS,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAAiB,EACjB,eAAiC,EACjC,+BAAyC,EAAE,EAC3C,MAAyB;;IAEzB,IAAI,gBAAoC,CAAC;IACzC,IAAI,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE,CAAC;QACvD,gBAAgB,GAAG,QAAQ,CAAC;IAC9B,CAAC;SAAM,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QAC/B,gBAAgB,GAAG,QAAQ,CAAC;IAC9B,CAAC;SAAM,CAAC;QACN,gBAAgB,GAAG,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ,mCAAI,QAAQ,CAAC;IAC3D,CAAC;IACD,IACE,QAAQ;QACR,gBAAgB,KAAK,QAAQ;QAC7B,CAAC,4BAA4B,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC3C,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,gBAAiB,CAAC,KAAK,CAAC,CAAC,EACnF,CAAC;QACD,MAAM,OAAO,GAAG,+BAA+B,CAAC,gBAAiB,CAAC,CAAC;QACnE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,MAAM,IAAI,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { GetTokenOptions } from \"@azure/core-auth\";\nimport { CredentialUnavailableError } from \"../errors.js\";\nimport type { CredentialLogger } from \"./logging.js\";\n\nfunction createConfigurationErrorMessage(tenantId: string): string {\n return `The current credential is not configured to acquire tokens for tenant ${tenantId}. To enable acquiring tokens for this tenant add it to the AdditionallyAllowedTenants on the credential options, or add \"*\" to AdditionallyAllowedTenants to allow acquiring tokens for any tenant.`;\n}\n\n/**\n * Of getToken contains a tenantId, this functions allows picking this tenantId as the appropriate for authentication,\n * unless multitenant authentication has been disabled through the AZURE_IDENTITY_DISABLE_MULTITENANTAUTH (on Node.js),\n * or unless the original tenant Id is `adfs`.\n * @internal\n */\nexport function processMultiTenantRequest(\n tenantId?: string,\n getTokenOptions?: GetTokenOptions,\n additionallyAllowedTenantIds: string[] = [],\n logger?: CredentialLogger,\n): string | undefined {\n let resolvedTenantId: string | undefined;\n if (process.env.AZURE_IDENTITY_DISABLE_MULTITENANTAUTH) {\n resolvedTenantId = tenantId;\n } else if (tenantId === \"adfs\") {\n resolvedTenantId = tenantId;\n } else {\n resolvedTenantId = getTokenOptions?.tenantId ?? tenantId;\n }\n if (\n tenantId &&\n resolvedTenantId !== tenantId &&\n !additionallyAllowedTenantIds.includes(\"*\") &&\n !additionallyAllowedTenantIds.some((t) => t.localeCompare(resolvedTenantId!) === 0)\n ) {\n const message = createConfigurationErrorMessage(resolvedTenantId!);\n logger?.info(message);\n throw new CredentialUnavailableError(message);\n }\n\n return resolvedTenantId;\n}\n"]}
|