@azure/identity 4.10.3-alpha.20250714.3 → 4.11.0-beta.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.
- package/README.md +19 -1
- package/dist/browser/client/identityClient.js +30 -18
- package/dist/browser/client/identityClient.js.map +1 -1
- package/dist/browser/constants.d.ts +1 -1
- package/dist/browser/constants.d.ts.map +1 -1
- package/dist/browser/constants.js +1 -1
- package/dist/browser/constants.js.map +1 -1
- package/dist/browser/credentials/brokerCredential.d.ts +35 -0
- package/dist/browser/credentials/brokerCredential.d.ts.map +1 -0
- package/dist/browser/credentials/brokerCredential.js +69 -0
- package/dist/browser/credentials/brokerCredential.js.map +1 -0
- package/dist/browser/credentials/chainedTokenCredential.js +1 -1
- package/dist/browser/credentials/chainedTokenCredential.js.map +1 -1
- package/dist/browser/credentials/clientSecretCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/clientSecretCredential.js +7 -2
- package/dist/browser/credentials/defaultAzureCredentialFunctions.d.ts +62 -0
- package/dist/browser/credentials/defaultAzureCredentialFunctions.d.ts.map +1 -0
- package/dist/browser/credentials/defaultAzureCredentialFunctions.js +143 -0
- package/dist/browser/credentials/defaultAzureCredentialFunctions.js.map +1 -0
- package/dist/browser/credentials/interactiveBrowserCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/interactiveBrowserCredential.js +19 -6
- package/dist/browser/credentials/managedIdentityCredential/imdsMsi.js +4 -6
- package/dist/browser/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
- package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.js +2 -2
- package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +1 -1
- package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.js +7 -1
- package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
- package/dist/browser/credentials/usernamePasswordCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/usernamePasswordCredential.js +7 -1
- package/dist/browser/credentials/visualStudioCodeCredentialOptions.d.ts +0 -4
- package/dist/browser/credentials/visualStudioCodeCredentialOptions.d.ts.map +1 -1
- package/dist/browser/credentials/visualStudioCodeCredentialOptions.js.map +1 -1
- package/dist/browser/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -4
- package/dist/browser/credentials/visualStudioCodeCredentialPlugin.d.ts.map +1 -1
- package/dist/browser/credentials/visualStudioCodeCredentialPlugin.js.map +1 -1
- package/dist/browser/errors.js +21 -0
- package/dist/browser/errors.js.map +1 -1
- package/dist/browser/msal/browserFlows/msalBrowserCommon.js +15 -15
- package/dist/browser/msal/browserFlows/msalBrowserCommon.js.map +1 -1
- package/dist/browser/msal/nodeFlows/msalClient.d.ts +13 -0
- package/dist/browser/msal/nodeFlows/msalClient.d.ts.map +1 -1
- package/dist/browser/msal/nodeFlows/msalClient.js +127 -94
- package/dist/browser/msal/nodeFlows/msalClient.js.map +1 -1
- package/dist/browser/msal/nodeFlows/msalPlugins.d.ts +19 -1
- package/dist/browser/msal/nodeFlows/msalPlugins.d.ts.map +1 -1
- package/dist/browser/msal/nodeFlows/msalPlugins.js +61 -16
- package/dist/browser/msal/nodeFlows/msalPlugins.js.map +1 -1
- package/dist/browser/msal/utils.js +3 -4
- package/dist/browser/msal/utils.js.map +1 -1
- package/dist/browser/plugins/provider.d.ts +2 -2
- package/dist/browser/plugins/provider.d.ts.map +1 -1
- package/dist/browser/plugins/provider.js.map +1 -1
- package/dist/browser/regionalAuthority.js +1 -2
- package/dist/browser/regionalAuthority.js.map +1 -1
- package/dist/browser/tokenProvider.js +1 -2
- package/dist/browser/tokenProvider.js.map +1 -1
- package/dist/browser/util/logging.js +6 -2
- package/dist/browser/util/logging.js.map +1 -1
- package/dist/browser/util/processMultiTenantRequest-browser.mjs.map +1 -1
- package/dist/browser/util/processMultiTenantRequest.js +1 -2
- package/dist/browser/util/processUtils.d.ts +1 -1
- package/dist/browser/util/processUtils.d.ts.map +1 -1
- package/dist/browser/util/processUtils.js +1 -1
- package/dist/browser/util/processUtils.js.map +1 -1
- package/dist/commonjs/client/identityClient.js +30 -18
- package/dist/commonjs/client/identityClient.js.map +1 -1
- package/dist/commonjs/constants.d.ts +1 -1
- package/dist/commonjs/constants.d.ts.map +1 -1
- package/dist/commonjs/constants.js +1 -1
- package/dist/commonjs/constants.js.map +1 -1
- package/dist/commonjs/credentials/authorizationCodeCredential.js +17 -3
- package/dist/commonjs/credentials/authorizationCodeCredential.js.map +1 -1
- package/dist/commonjs/credentials/azureCliCredential.js +15 -12
- package/dist/commonjs/credentials/azureCliCredential.js.map +1 -1
- package/dist/commonjs/credentials/azureDeveloperCliCredential.js +12 -10
- package/dist/commonjs/credentials/azureDeveloperCliCredential.js.map +1 -1
- package/dist/commonjs/credentials/azurePipelinesCredential.js +9 -5
- package/dist/commonjs/credentials/azurePipelinesCredential.js.map +1 -1
- package/dist/commonjs/credentials/azurePowerShellCredential.js +10 -7
- package/dist/commonjs/credentials/azurePowerShellCredential.js.map +1 -1
- package/dist/commonjs/credentials/brokerCredential.d.ts +35 -0
- package/dist/commonjs/credentials/brokerCredential.d.ts.map +1 -0
- package/dist/commonjs/credentials/brokerCredential.js +73 -0
- package/dist/commonjs/credentials/brokerCredential.js.map +1 -0
- package/dist/commonjs/credentials/chainedTokenCredential.js +1 -1
- package/dist/commonjs/credentials/chainedTokenCredential.js.map +1 -1
- package/dist/commonjs/credentials/clientAssertionCredential.js +11 -2
- package/dist/commonjs/credentials/clientAssertionCredential.js.map +1 -1
- package/dist/commonjs/credentials/clientCertificateCredential.js +19 -9
- package/dist/commonjs/credentials/clientCertificateCredential.js.map +1 -1
- package/dist/commonjs/credentials/clientSecretCredential.js +10 -2
- package/dist/commonjs/credentials/clientSecretCredential.js.map +1 -1
- package/dist/commonjs/credentials/defaultAzureCredential.d.ts +12 -14
- package/dist/commonjs/credentials/defaultAzureCredential.d.ts.map +1 -1
- package/dist/commonjs/credentials/defaultAzureCredential.js +48 -113
- package/dist/commonjs/credentials/defaultAzureCredential.js.map +1 -1
- package/dist/commonjs/credentials/defaultAzureCredentialFunctions.d.ts +62 -0
- package/dist/commonjs/credentials/defaultAzureCredentialFunctions.d.ts.map +1 -0
- package/dist/commonjs/credentials/defaultAzureCredentialFunctions.js +153 -0
- package/dist/commonjs/credentials/defaultAzureCredentialFunctions.js.map +1 -0
- package/dist/commonjs/credentials/deviceCodeCredential.js +24 -10
- package/dist/commonjs/credentials/deviceCodeCredential.js.map +1 -1
- package/dist/commonjs/credentials/environmentCredential.js +4 -6
- package/dist/commonjs/credentials/environmentCredential.js.map +1 -1
- package/dist/commonjs/credentials/interactiveBrowserCredential.js +30 -11
- package/dist/commonjs/credentials/interactiveBrowserCredential.js.map +1 -1
- package/dist/commonjs/credentials/managedIdentityCredential/imdsMsi.js +4 -6
- package/dist/commonjs/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
- package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js +2 -2
- package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +1 -1
- package/dist/commonjs/credentials/managedIdentityCredential/index.js +28 -18
- package/dist/commonjs/credentials/managedIdentityCredential/index.js.map +1 -1
- package/dist/commonjs/credentials/managedIdentityCredential/tokenExchangeMsi.js +7 -1
- package/dist/commonjs/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
- package/dist/commonjs/credentials/onBehalfOfCredential.js +13 -1
- package/dist/commonjs/credentials/onBehalfOfCredential.js.map +1 -1
- package/dist/commonjs/credentials/usernamePasswordCredential.js +10 -2
- package/dist/commonjs/credentials/usernamePasswordCredential.js.map +1 -1
- package/dist/commonjs/credentials/visualStudioCodeCredential.d.ts +15 -26
- package/dist/commonjs/credentials/visualStudioCodeCredential.d.ts.map +1 -1
- package/dist/commonjs/credentials/visualStudioCodeCredential.js +69 -130
- package/dist/commonjs/credentials/visualStudioCodeCredential.js.map +1 -1
- package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.d.ts +0 -4
- package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.d.ts.map +1 -1
- package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.js.map +1 -1
- package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -4
- package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.d.ts.map +1 -1
- package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js.map +1 -1
- package/dist/commonjs/credentials/workloadIdentityCredential.js +5 -3
- package/dist/commonjs/credentials/workloadIdentityCredential.js.map +1 -1
- package/dist/commonjs/errors.js +21 -0
- package/dist/commonjs/errors.js.map +1 -1
- package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js +15 -15
- package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js.map +1 -1
- package/dist/commonjs/msal/nodeFlows/msalClient.d.ts +13 -0
- package/dist/commonjs/msal/nodeFlows/msalClient.d.ts.map +1 -1
- package/dist/commonjs/msal/nodeFlows/msalClient.js +127 -94
- package/dist/commonjs/msal/nodeFlows/msalClient.js.map +1 -1
- package/dist/commonjs/msal/nodeFlows/msalPlugins.d.ts +19 -1
- package/dist/commonjs/msal/nodeFlows/msalPlugins.d.ts.map +1 -1
- package/dist/commonjs/msal/nodeFlows/msalPlugins.js +63 -17
- package/dist/commonjs/msal/nodeFlows/msalPlugins.js.map +1 -1
- package/dist/commonjs/msal/utils.js +3 -4
- package/dist/commonjs/msal/utils.js.map +1 -1
- package/dist/commonjs/plugins/consumer.d.ts.map +1 -1
- package/dist/commonjs/plugins/consumer.js +1 -2
- package/dist/commonjs/plugins/consumer.js.map +1 -1
- package/dist/commonjs/plugins/provider.d.ts +2 -2
- package/dist/commonjs/plugins/provider.d.ts.map +1 -1
- package/dist/commonjs/plugins/provider.js.map +1 -1
- package/dist/commonjs/regionalAuthority.js +1 -2
- package/dist/commonjs/regionalAuthority.js.map +1 -1
- package/dist/commonjs/tokenProvider.js +1 -2
- package/dist/commonjs/tokenProvider.js.map +1 -1
- package/dist/commonjs/util/logging.js +6 -2
- package/dist/commonjs/util/logging.js.map +1 -1
- package/dist/commonjs/util/processMultiTenantRequest.js +2 -3
- package/dist/commonjs/util/processMultiTenantRequest.js.map +1 -1
- package/dist/commonjs/util/processUtils.d.ts +1 -1
- package/dist/commonjs/util/processUtils.d.ts.map +1 -1
- package/dist/commonjs/util/processUtils.js +2 -2
- package/dist/commonjs/util/processUtils.js.map +1 -1
- package/dist/esm/client/identityClient.js +30 -18
- package/dist/esm/client/identityClient.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.d.ts.map +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/credentials/authorizationCodeCredential.js +17 -3
- package/dist/esm/credentials/authorizationCodeCredential.js.map +1 -1
- package/dist/esm/credentials/azureCliCredential.js +15 -12
- package/dist/esm/credentials/azureCliCredential.js.map +1 -1
- package/dist/esm/credentials/azureDeveloperCliCredential.js +12 -10
- package/dist/esm/credentials/azureDeveloperCliCredential.js.map +1 -1
- package/dist/esm/credentials/azurePipelinesCredential.js +9 -5
- package/dist/esm/credentials/azurePipelinesCredential.js.map +1 -1
- package/dist/esm/credentials/azurePowerShellCredential.js +10 -7
- package/dist/esm/credentials/azurePowerShellCredential.js.map +1 -1
- package/dist/esm/credentials/brokerCredential.d.ts +35 -0
- package/dist/esm/credentials/brokerCredential.d.ts.map +1 -0
- package/dist/esm/credentials/brokerCredential.js +69 -0
- package/dist/esm/credentials/brokerCredential.js.map +1 -0
- package/dist/esm/credentials/chainedTokenCredential.js +1 -1
- package/dist/esm/credentials/chainedTokenCredential.js.map +1 -1
- package/dist/esm/credentials/clientAssertionCredential.js +11 -2
- package/dist/esm/credentials/clientAssertionCredential.js.map +1 -1
- package/dist/esm/credentials/clientCertificateCredential.js +19 -9
- package/dist/esm/credentials/clientCertificateCredential.js.map +1 -1
- package/dist/esm/credentials/clientSecretCredential.js +10 -2
- package/dist/esm/credentials/clientSecretCredential.js.map +1 -1
- package/dist/esm/credentials/defaultAzureCredential.d.ts +12 -14
- package/dist/esm/credentials/defaultAzureCredential.d.ts.map +1 -1
- package/dist/esm/credentials/defaultAzureCredential.js +43 -106
- package/dist/esm/credentials/defaultAzureCredential.js.map +1 -1
- package/dist/esm/credentials/defaultAzureCredentialFunctions.d.ts +62 -0
- package/dist/esm/credentials/defaultAzureCredentialFunctions.d.ts.map +1 -0
- package/dist/esm/credentials/defaultAzureCredentialFunctions.js +143 -0
- package/dist/esm/credentials/defaultAzureCredentialFunctions.js.map +1 -0
- package/dist/esm/credentials/deviceCodeCredential.js +24 -10
- package/dist/esm/credentials/deviceCodeCredential.js.map +1 -1
- package/dist/esm/credentials/environmentCredential.js +4 -6
- package/dist/esm/credentials/environmentCredential.js.map +1 -1
- package/dist/esm/credentials/interactiveBrowserCredential.js +30 -11
- package/dist/esm/credentials/interactiveBrowserCredential.js.map +1 -1
- package/dist/esm/credentials/managedIdentityCredential/imdsMsi.js +4 -6
- package/dist/esm/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
- package/dist/esm/credentials/managedIdentityCredential/imdsRetryPolicy.js +2 -2
- package/dist/esm/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +1 -1
- package/dist/esm/credentials/managedIdentityCredential/index.js +28 -18
- package/dist/esm/credentials/managedIdentityCredential/index.js.map +1 -1
- package/dist/esm/credentials/managedIdentityCredential/tokenExchangeMsi.js +7 -1
- package/dist/esm/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
- package/dist/esm/credentials/onBehalfOfCredential.js +13 -1
- package/dist/esm/credentials/onBehalfOfCredential.js.map +1 -1
- package/dist/esm/credentials/usernamePasswordCredential.js +10 -2
- package/dist/esm/credentials/usernamePasswordCredential.js.map +1 -1
- package/dist/esm/credentials/visualStudioCodeCredential.d.ts +15 -26
- package/dist/esm/credentials/visualStudioCodeCredential.d.ts.map +1 -1
- package/dist/esm/credentials/visualStudioCodeCredential.js +69 -128
- package/dist/esm/credentials/visualStudioCodeCredential.js.map +1 -1
- package/dist/esm/credentials/visualStudioCodeCredentialOptions.d.ts +0 -4
- package/dist/esm/credentials/visualStudioCodeCredentialOptions.d.ts.map +1 -1
- package/dist/esm/credentials/visualStudioCodeCredentialOptions.js.map +1 -1
- package/dist/esm/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -4
- package/dist/esm/credentials/visualStudioCodeCredentialPlugin.d.ts.map +1 -1
- package/dist/esm/credentials/visualStudioCodeCredentialPlugin.js.map +1 -1
- package/dist/esm/credentials/workloadIdentityCredential.js +5 -3
- package/dist/esm/credentials/workloadIdentityCredential.js.map +1 -1
- package/dist/esm/errors.js +21 -0
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/msal/browserFlows/msalBrowserCommon.js +15 -15
- package/dist/esm/msal/browserFlows/msalBrowserCommon.js.map +1 -1
- package/dist/esm/msal/nodeFlows/msalClient.d.ts +13 -0
- package/dist/esm/msal/nodeFlows/msalClient.d.ts.map +1 -1
- package/dist/esm/msal/nodeFlows/msalClient.js +127 -94
- package/dist/esm/msal/nodeFlows/msalClient.js.map +1 -1
- package/dist/esm/msal/nodeFlows/msalPlugins.d.ts +19 -1
- package/dist/esm/msal/nodeFlows/msalPlugins.d.ts.map +1 -1
- package/dist/esm/msal/nodeFlows/msalPlugins.js +61 -16
- package/dist/esm/msal/nodeFlows/msalPlugins.js.map +1 -1
- package/dist/esm/msal/utils.js +3 -4
- package/dist/esm/msal/utils.js.map +1 -1
- package/dist/esm/plugins/consumer.d.ts.map +1 -1
- package/dist/esm/plugins/consumer.js +2 -3
- package/dist/esm/plugins/consumer.js.map +1 -1
- package/dist/esm/plugins/provider.d.ts +2 -2
- package/dist/esm/plugins/provider.d.ts.map +1 -1
- package/dist/esm/plugins/provider.js.map +1 -1
- package/dist/esm/regionalAuthority.js +1 -2
- package/dist/esm/regionalAuthority.js.map +1 -1
- package/dist/esm/tokenProvider.js +1 -2
- package/dist/esm/tokenProvider.js.map +1 -1
- package/dist/esm/util/logging.js +6 -2
- package/dist/esm/util/logging.js.map +1 -1
- package/dist/esm/util/processMultiTenantRequest.js +2 -3
- package/dist/esm/util/processMultiTenantRequest.js.map +1 -1
- package/dist/esm/util/processUtils.d.ts +1 -1
- package/dist/esm/util/processUtils.d.ts.map +1 -1
- package/dist/esm/util/processUtils.js +1 -1
- package/dist/esm/util/processUtils.js.map +1 -1
- package/dist/workerd/client/identityClient.js +30 -18
- package/dist/workerd/client/identityClient.js.map +1 -1
- package/dist/workerd/constants.d.ts +1 -1
- package/dist/workerd/constants.d.ts.map +1 -1
- package/dist/workerd/constants.js +1 -1
- package/dist/workerd/constants.js.map +1 -1
- package/dist/workerd/credentials/authorizationCodeCredential.js +17 -3
- package/dist/workerd/credentials/authorizationCodeCredential.js.map +1 -1
- package/dist/workerd/credentials/azureCliCredential.js +15 -12
- package/dist/workerd/credentials/azureCliCredential.js.map +1 -1
- package/dist/workerd/credentials/azureDeveloperCliCredential.js +12 -10
- package/dist/workerd/credentials/azureDeveloperCliCredential.js.map +1 -1
- package/dist/workerd/credentials/azurePipelinesCredential.js +9 -5
- package/dist/workerd/credentials/azurePipelinesCredential.js.map +1 -1
- package/dist/workerd/credentials/azurePowerShellCredential.js +10 -7
- package/dist/workerd/credentials/azurePowerShellCredential.js.map +1 -1
- package/dist/workerd/credentials/brokerCredential.d.ts +35 -0
- package/dist/workerd/credentials/brokerCredential.d.ts.map +1 -0
- package/dist/workerd/credentials/brokerCredential.js +69 -0
- package/dist/workerd/credentials/brokerCredential.js.map +1 -0
- package/dist/workerd/credentials/chainedTokenCredential.js +1 -1
- package/dist/workerd/credentials/chainedTokenCredential.js.map +1 -1
- package/dist/workerd/credentials/clientAssertionCredential.js +11 -2
- package/dist/workerd/credentials/clientAssertionCredential.js.map +1 -1
- package/dist/workerd/credentials/clientCertificateCredential.js +19 -9
- package/dist/workerd/credentials/clientCertificateCredential.js.map +1 -1
- package/dist/workerd/credentials/clientSecretCredential.js +10 -2
- package/dist/workerd/credentials/clientSecretCredential.js.map +1 -1
- package/dist/workerd/credentials/defaultAzureCredential.d.ts +12 -14
- package/dist/workerd/credentials/defaultAzureCredential.d.ts.map +1 -1
- package/dist/workerd/credentials/defaultAzureCredential.js +43 -106
- package/dist/workerd/credentials/defaultAzureCredential.js.map +1 -1
- package/dist/workerd/credentials/defaultAzureCredentialFunctions.d.ts +62 -0
- package/dist/workerd/credentials/defaultAzureCredentialFunctions.d.ts.map +1 -0
- package/dist/workerd/credentials/defaultAzureCredentialFunctions.js +143 -0
- package/dist/workerd/credentials/defaultAzureCredentialFunctions.js.map +1 -0
- package/dist/workerd/credentials/deviceCodeCredential.js +24 -10
- package/dist/workerd/credentials/deviceCodeCredential.js.map +1 -1
- package/dist/workerd/credentials/environmentCredential.js +4 -6
- package/dist/workerd/credentials/environmentCredential.js.map +1 -1
- package/dist/workerd/credentials/interactiveBrowserCredential.js +30 -11
- package/dist/workerd/credentials/interactiveBrowserCredential.js.map +1 -1
- package/dist/workerd/credentials/managedIdentityCredential/imdsMsi.js +4 -6
- package/dist/workerd/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
- package/dist/workerd/credentials/managedIdentityCredential/imdsRetryPolicy.js +2 -2
- package/dist/workerd/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +1 -1
- package/dist/workerd/credentials/managedIdentityCredential/index.js +28 -18
- package/dist/workerd/credentials/managedIdentityCredential/index.js.map +1 -1
- package/dist/workerd/credentials/managedIdentityCredential/tokenExchangeMsi.js +7 -1
- package/dist/workerd/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
- package/dist/workerd/credentials/onBehalfOfCredential.js +13 -1
- package/dist/workerd/credentials/onBehalfOfCredential.js.map +1 -1
- package/dist/workerd/credentials/usernamePasswordCredential.js +10 -2
- package/dist/workerd/credentials/usernamePasswordCredential.js.map +1 -1
- package/dist/workerd/credentials/visualStudioCodeCredential.d.ts +15 -26
- package/dist/workerd/credentials/visualStudioCodeCredential.d.ts.map +1 -1
- package/dist/workerd/credentials/visualStudioCodeCredential.js +69 -128
- package/dist/workerd/credentials/visualStudioCodeCredential.js.map +1 -1
- package/dist/workerd/credentials/visualStudioCodeCredentialOptions.d.ts +0 -4
- package/dist/workerd/credentials/visualStudioCodeCredentialOptions.d.ts.map +1 -1
- package/dist/workerd/credentials/visualStudioCodeCredentialOptions.js.map +1 -1
- package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -4
- package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.d.ts.map +1 -1
- package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.js.map +1 -1
- package/dist/workerd/credentials/workloadIdentityCredential.js +5 -3
- package/dist/workerd/credentials/workloadIdentityCredential.js.map +1 -1
- package/dist/workerd/errors.js +21 -0
- package/dist/workerd/errors.js.map +1 -1
- package/dist/workerd/msal/browserFlows/msalBrowserCommon.js +15 -15
- package/dist/workerd/msal/browserFlows/msalBrowserCommon.js.map +1 -1
- package/dist/workerd/msal/nodeFlows/msalClient.d.ts +13 -0
- package/dist/workerd/msal/nodeFlows/msalClient.d.ts.map +1 -1
- package/dist/workerd/msal/nodeFlows/msalClient.js +127 -94
- package/dist/workerd/msal/nodeFlows/msalClient.js.map +1 -1
- package/dist/workerd/msal/nodeFlows/msalPlugins.d.ts +19 -1
- package/dist/workerd/msal/nodeFlows/msalPlugins.d.ts.map +1 -1
- package/dist/workerd/msal/nodeFlows/msalPlugins.js +61 -16
- package/dist/workerd/msal/nodeFlows/msalPlugins.js.map +1 -1
- package/dist/workerd/msal/utils.js +3 -4
- package/dist/workerd/msal/utils.js.map +1 -1
- package/dist/workerd/plugins/consumer.d.ts.map +1 -1
- package/dist/workerd/plugins/consumer.js +2 -3
- package/dist/workerd/plugins/consumer.js.map +1 -1
- package/dist/workerd/plugins/provider.d.ts +2 -2
- package/dist/workerd/plugins/provider.d.ts.map +1 -1
- package/dist/workerd/plugins/provider.js.map +1 -1
- package/dist/workerd/regionalAuthority.js +1 -2
- package/dist/workerd/regionalAuthority.js.map +1 -1
- package/dist/workerd/tokenProvider.js +1 -2
- package/dist/workerd/tokenProvider.js.map +1 -1
- package/dist/workerd/util/logging.js +6 -2
- package/dist/workerd/util/logging.js.map +1 -1
- package/dist/workerd/util/processMultiTenantRequest.js +2 -3
- package/dist/workerd/util/processMultiTenantRequest.js.map +1 -1
- package/dist/workerd/util/processUtils.d.ts +1 -1
- package/dist/workerd/util/processUtils.d.ts.map +1 -1
- package/dist/workerd/util/processUtils.js +1 -1
- package/dist/workerd/util/processUtils.js.map +1 -1
- package/package.json +6 -6
@@ -27,11 +27,14 @@ const msalLogger = (0, logging_js_1.credentialLogger)("MsalClient");
|
|
27
27
|
* @returns The MSAL configuration object.
|
28
28
|
*/
|
29
29
|
function generateMsalConfiguration(clientId, tenantId, msalClientOptions = {}) {
|
30
|
-
|
31
|
-
const resolvedTenant = (0, tenantIdUtils_js_1.resolveTenantId)((_a = msalClientOptions.logger) !== null && _a !== void 0 ? _a : msalLogger, tenantId, clientId);
|
30
|
+
const resolvedTenant = (0, tenantIdUtils_js_1.resolveTenantId)(msalClientOptions.logger ?? msalLogger, tenantId, clientId);
|
32
31
|
// TODO: move and reuse getIdentityClientAuthorityHost
|
33
32
|
const authority = (0, utils_js_1.getAuthority)(resolvedTenant, (0, utils_js_1.getAuthorityHost)(msalClientOptions));
|
34
|
-
const httpClient = new identityClient_js_1.IdentityClient(
|
33
|
+
const httpClient = new identityClient_js_1.IdentityClient({
|
34
|
+
...msalClientOptions.tokenCredentialOptions,
|
35
|
+
authorityHost: authority,
|
36
|
+
loggingOptions: msalClientOptions.loggingOptions,
|
37
|
+
});
|
35
38
|
const msalConfig = {
|
36
39
|
auth: {
|
37
40
|
clientId,
|
@@ -41,9 +44,9 @@ function generateMsalConfiguration(clientId, tenantId, msalClientOptions = {}) {
|
|
41
44
|
system: {
|
42
45
|
networkClient: httpClient,
|
43
46
|
loggerOptions: {
|
44
|
-
loggerCallback: (0, utils_js_1.defaultLoggerCallback)(
|
47
|
+
loggerCallback: (0, utils_js_1.defaultLoggerCallback)(msalClientOptions.logger ?? msalLogger),
|
45
48
|
logLevel: (0, utils_js_1.getMSALLogLevel)((0, logger_1.getLogLevel)()),
|
46
|
-
piiLoggingEnabled:
|
49
|
+
piiLoggingEnabled: msalClientOptions.loggingOptions?.enableUnsafeSupportLogging,
|
47
50
|
},
|
48
51
|
},
|
49
52
|
};
|
@@ -60,14 +63,13 @@ function generateMsalConfiguration(clientId, tenantId, msalClientOptions = {}) {
|
|
60
63
|
* @public
|
61
64
|
*/
|
62
65
|
function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
63
|
-
var _a;
|
64
66
|
const state = {
|
65
67
|
msalConfig: generateMsalConfiguration(clientId, tenantId, createMsalClientOptions),
|
66
68
|
cachedAccount: createMsalClientOptions.authenticationRecord
|
67
69
|
? (0, utils_js_1.publicToMsal)(createMsalClientOptions.authenticationRecord)
|
68
70
|
: null,
|
69
71
|
pluginConfiguration: msalPlugins_js_1.msalPlugins.generatePluginConfiguration(createMsalClientOptions),
|
70
|
-
logger:
|
72
|
+
logger: createMsalClientOptions.logger ?? msalLogger,
|
71
73
|
};
|
72
74
|
const publicApps = new Map();
|
73
75
|
async function getPublicApp(options = {}) {
|
@@ -83,7 +85,11 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
83
85
|
? state.pluginConfiguration.cache.cachePluginCae
|
84
86
|
: state.pluginConfiguration.cache.cachePlugin;
|
85
87
|
state.msalConfig.auth.clientCapabilities = options.enableCae ? ["cp1"] : undefined;
|
86
|
-
publicClientApp = new msal.PublicClientApplication(
|
88
|
+
publicClientApp = new msal.PublicClientApplication({
|
89
|
+
...state.msalConfig,
|
90
|
+
broker: { nativeBrokerPlugin: state.pluginConfiguration.broker.nativeBrokerPlugin },
|
91
|
+
cache: { cachePlugin: await cachePlugin },
|
92
|
+
});
|
87
93
|
publicApps.set(appKey, publicClientApp);
|
88
94
|
return publicClientApp;
|
89
95
|
}
|
@@ -101,7 +107,11 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
101
107
|
? state.pluginConfiguration.cache.cachePluginCae
|
102
108
|
: state.pluginConfiguration.cache.cachePlugin;
|
103
109
|
state.msalConfig.auth.clientCapabilities = options.enableCae ? ["cp1"] : undefined;
|
104
|
-
confidentialClientApp = new msal.ConfidentialClientApplication(
|
110
|
+
confidentialClientApp = new msal.ConfidentialClientApplication({
|
111
|
+
...state.msalConfig,
|
112
|
+
broker: { nativeBrokerPlugin: state.pluginConfiguration.broker.nativeBrokerPlugin },
|
113
|
+
cache: { cachePlugin: await cachePlugin },
|
114
|
+
});
|
105
115
|
confidentialApps.set(appKey, confidentialClientApp);
|
106
116
|
return confidentialClientApp;
|
107
117
|
}
|
@@ -120,7 +130,7 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
120
130
|
claims: state.cachedClaims,
|
121
131
|
};
|
122
132
|
if (state.pluginConfiguration.broker.isEnabled) {
|
123
|
-
silentRequest.tokenQueryParameters
|
133
|
+
silentRequest.tokenQueryParameters ||= {};
|
124
134
|
if (state.pluginConfiguration.broker.enableMsaPassthrough) {
|
125
135
|
silentRequest.tokenQueryParameters["msal_request_type"] = "consumer_passthrough";
|
126
136
|
}
|
@@ -144,7 +154,7 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
144
154
|
* if the user is creating cross-tenant requests
|
145
155
|
*/
|
146
156
|
function calculateRequestAuthority(options) {
|
147
|
-
if (options
|
157
|
+
if (options?.tenantId) {
|
148
158
|
return (0, utils_js_1.getAuthority)(options.tenantId, (0, utils_js_1.getAuthorityHost)(createMsalClientOptions));
|
149
159
|
}
|
150
160
|
return state.msalConfig.auth.authority;
|
@@ -160,7 +170,6 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
160
170
|
* @returns A promise that resolves to an AccessToken object containing the access token and its expiration timestamp.
|
161
171
|
*/
|
162
172
|
async function withSilentAuthentication(msalApp, scopes, options, onAuthenticationRequired) {
|
163
|
-
var _a, _b;
|
164
173
|
let response = null;
|
165
174
|
try {
|
166
175
|
response = await getTokenSilent(msalApp, scopes, options);
|
@@ -188,17 +197,16 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
188
197
|
}
|
189
198
|
// At this point we should have a token, process it
|
190
199
|
(0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
|
191
|
-
state.cachedAccount =
|
200
|
+
state.cachedAccount = response?.account ?? null;
|
192
201
|
state.logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
|
193
202
|
return {
|
194
203
|
token: response.accessToken,
|
195
204
|
expiresOnTimestamp: response.expiresOn.getTime(),
|
196
|
-
refreshAfterTimestamp:
|
205
|
+
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
197
206
|
tokenType: response.tokenType,
|
198
207
|
};
|
199
208
|
}
|
200
209
|
async function getTokenByClientSecret(scopes, clientSecret, options = {}) {
|
201
|
-
var _a;
|
202
210
|
state.logger.getToken.info(`Attempting to acquire token using client secret`);
|
203
211
|
state.msalConfig.auth.clientSecret = clientSecret;
|
204
212
|
const msalApp = await getConfidentialApp(options);
|
@@ -207,14 +215,14 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
207
215
|
scopes,
|
208
216
|
authority: calculateRequestAuthority(options),
|
209
217
|
azureRegion: (0, regionalAuthority_js_1.calculateRegionalAuthority)(),
|
210
|
-
claims: options
|
218
|
+
claims: options?.claims,
|
211
219
|
});
|
212
220
|
(0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
|
213
221
|
state.logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
|
214
222
|
return {
|
215
223
|
token: response.accessToken,
|
216
224
|
expiresOnTimestamp: response.expiresOn.getTime(),
|
217
|
-
refreshAfterTimestamp:
|
225
|
+
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
218
226
|
tokenType: response.tokenType,
|
219
227
|
};
|
220
228
|
}
|
@@ -223,7 +231,6 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
223
231
|
}
|
224
232
|
}
|
225
233
|
async function getTokenByClientAssertion(scopes, clientAssertion, options = {}) {
|
226
|
-
var _a;
|
227
234
|
state.logger.getToken.info(`Attempting to acquire token using client assertion`);
|
228
235
|
state.msalConfig.auth.clientAssertion = clientAssertion;
|
229
236
|
const msalApp = await getConfidentialApp(options);
|
@@ -232,7 +239,7 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
232
239
|
scopes,
|
233
240
|
authority: calculateRequestAuthority(options),
|
234
241
|
azureRegion: (0, regionalAuthority_js_1.calculateRegionalAuthority)(),
|
235
|
-
claims: options
|
242
|
+
claims: options?.claims,
|
236
243
|
clientAssertion,
|
237
244
|
});
|
238
245
|
(0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
|
@@ -240,7 +247,7 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
240
247
|
return {
|
241
248
|
token: response.accessToken,
|
242
249
|
expiresOnTimestamp: response.expiresOn.getTime(),
|
243
|
-
refreshAfterTimestamp:
|
250
|
+
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
244
251
|
tokenType: response.tokenType,
|
245
252
|
};
|
246
253
|
}
|
@@ -249,7 +256,6 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
249
256
|
}
|
250
257
|
}
|
251
258
|
async function getTokenByClientCertificate(scopes, certificate, options = {}) {
|
252
|
-
var _a;
|
253
259
|
state.logger.getToken.info(`Attempting to acquire token using client certificate`);
|
254
260
|
state.msalConfig.auth.clientCertificate = certificate;
|
255
261
|
const msalApp = await getConfidentialApp(options);
|
@@ -258,14 +264,14 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
258
264
|
scopes,
|
259
265
|
authority: calculateRequestAuthority(options),
|
260
266
|
azureRegion: (0, regionalAuthority_js_1.calculateRegionalAuthority)(),
|
261
|
-
claims: options
|
267
|
+
claims: options?.claims,
|
262
268
|
});
|
263
269
|
(0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
|
264
270
|
state.logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
|
265
271
|
return {
|
266
272
|
token: response.accessToken,
|
267
273
|
expiresOnTimestamp: response.expiresOn.getTime(),
|
268
|
-
refreshAfterTimestamp:
|
274
|
+
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
269
275
|
tokenType: response.tokenType,
|
270
276
|
};
|
271
277
|
}
|
@@ -277,13 +283,12 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
277
283
|
state.logger.getToken.info(`Attempting to acquire token using device code`);
|
278
284
|
const msalApp = await getPublicApp(options);
|
279
285
|
return withSilentAuthentication(msalApp, scopes, options, () => {
|
280
|
-
var _a, _b;
|
281
286
|
const requestOptions = {
|
282
287
|
scopes,
|
283
|
-
cancel:
|
288
|
+
cancel: options?.abortSignal?.aborted ?? false,
|
284
289
|
deviceCodeCallback,
|
285
290
|
authority: calculateRequestAuthority(options),
|
286
|
-
claims: options
|
291
|
+
claims: options?.claims,
|
287
292
|
};
|
288
293
|
const deviceCodeRequest = msalApp.acquireTokenByDeviceCode(requestOptions);
|
289
294
|
if (options.abortSignal) {
|
@@ -303,7 +308,7 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
303
308
|
username,
|
304
309
|
password,
|
305
310
|
authority: calculateRequestAuthority(options),
|
306
|
-
claims: options
|
311
|
+
claims: options?.claims,
|
307
312
|
};
|
308
313
|
return msalApp.acquireTokenByUsernamePassword(requestOptions);
|
309
314
|
});
|
@@ -332,12 +337,11 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
332
337
|
redirectUri,
|
333
338
|
code: authorizationCode,
|
334
339
|
authority: calculateRequestAuthority(options),
|
335
|
-
claims: options
|
340
|
+
claims: options?.claims,
|
336
341
|
});
|
337
342
|
});
|
338
343
|
}
|
339
344
|
async function getTokenOnBehalfOf(scopes, userAssertionToken, clientCredentials, options = {}) {
|
340
|
-
var _a;
|
341
345
|
msalLogger.getToken.info(`Attempting to acquire token on behalf of another user`);
|
342
346
|
if (typeof clientCredentials === "string") {
|
343
347
|
// Client secret
|
@@ -367,7 +371,7 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
367
371
|
return {
|
368
372
|
token: response.accessToken,
|
369
373
|
expiresOnTimestamp: response.expiresOn.getTime(),
|
370
|
-
refreshAfterTimestamp:
|
374
|
+
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
371
375
|
tokenType: response.tokenType,
|
372
376
|
};
|
373
377
|
}
|
@@ -375,79 +379,107 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
375
379
|
throw (0, utils_js_1.handleMsalError)(scopes, err, options);
|
376
380
|
}
|
377
381
|
}
|
378
|
-
|
379
|
-
|
382
|
+
/**
|
383
|
+
* Creates a base interactive request configuration for MSAL interactive authentication.
|
384
|
+
* This is shared between interactive and brokered authentication flows.
|
385
|
+
*
|
386
|
+
* @internal
|
387
|
+
*/
|
388
|
+
function createBaseInteractiveRequest(scopes, options) {
|
389
|
+
return {
|
390
|
+
openBrowser: async (url) => {
|
391
|
+
const open = await import("open");
|
392
|
+
await open.default(url, { wait: true, newInstance: true });
|
393
|
+
},
|
394
|
+
scopes,
|
395
|
+
authority: calculateRequestAuthority(options),
|
396
|
+
claims: options?.claims,
|
397
|
+
loginHint: options?.loginHint,
|
398
|
+
errorTemplate: options?.browserCustomizationOptions?.errorMessage,
|
399
|
+
successTemplate: options?.browserCustomizationOptions?.successMessage,
|
400
|
+
prompt: options?.loginHint ? "login" : "select_account",
|
401
|
+
};
|
402
|
+
}
|
403
|
+
/**
|
404
|
+
* @internal
|
405
|
+
*/
|
406
|
+
async function getBrokeredTokenInternal(scopes, useDefaultBrokerAccount, options = {}) {
|
407
|
+
msalLogger.verbose("Authentication will resume through the broker");
|
380
408
|
const app = await getPublicApp(options);
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
409
|
+
const interactiveRequest = createBaseInteractiveRequest(scopes, options);
|
410
|
+
if (state.pluginConfiguration.broker.parentWindowHandle) {
|
411
|
+
interactiveRequest.windowHandle = Buffer.from(state.pluginConfiguration.broker.parentWindowHandle);
|
412
|
+
}
|
413
|
+
else {
|
414
|
+
// this is a bug, as the pluginConfiguration handler should validate this case.
|
415
|
+
msalLogger.warning("Parent window handle is not specified for the broker. This may cause unexpected behavior. Please provide the parentWindowHandle.");
|
416
|
+
}
|
417
|
+
if (state.pluginConfiguration.broker.enableMsaPassthrough) {
|
418
|
+
(interactiveRequest.tokenQueryParameters ??= {})["msal_request_type"] =
|
419
|
+
"consumer_passthrough";
|
420
|
+
}
|
421
|
+
if (useDefaultBrokerAccount) {
|
422
|
+
interactiveRequest.prompt = "none";
|
423
|
+
msalLogger.verbose("Attempting broker authentication using the default broker account");
|
424
|
+
}
|
425
|
+
else {
|
426
|
+
msalLogger.verbose("Attempting broker authentication without the default broker account");
|
427
|
+
}
|
428
|
+
if (options.proofOfPossessionOptions) {
|
429
|
+
interactiveRequest.shrNonce = options.proofOfPossessionOptions.nonce;
|
430
|
+
interactiveRequest.authenticationScheme = "pop";
|
431
|
+
interactiveRequest.resourceRequestMethod =
|
432
|
+
options.proofOfPossessionOptions.resourceRequestMethod;
|
433
|
+
interactiveRequest.resourceRequestUri = options.proofOfPossessionOptions.resourceRequestUrl;
|
434
|
+
}
|
435
|
+
try {
|
436
|
+
return await app.acquireTokenInteractive(interactiveRequest);
|
437
|
+
}
|
438
|
+
catch (e) {
|
439
|
+
msalLogger.verbose(`Failed to authenticate through the broker: ${e.message}`);
|
440
|
+
if (options.disableAutomaticAuthentication) {
|
441
|
+
throw new errors_js_1.AuthenticationRequiredError({
|
442
|
+
scopes,
|
443
|
+
getTokenOptions: options,
|
444
|
+
message: "Cannot silently authenticate with default broker account.",
|
445
|
+
});
|
401
446
|
}
|
447
|
+
// If we tried to use the default broker account and failed, fall back to interactive authentication
|
402
448
|
if (useDefaultBrokerAccount) {
|
403
|
-
|
404
|
-
msalLogger.verbose("Attempting broker authentication using the default broker account");
|
449
|
+
return getBrokeredTokenInternal(scopes, false, options);
|
405
450
|
}
|
406
451
|
else {
|
407
|
-
|
408
|
-
}
|
409
|
-
if (options.proofOfPossessionOptions) {
|
410
|
-
interactiveRequest.shrNonce = options.proofOfPossessionOptions.nonce;
|
411
|
-
interactiveRequest.authenticationScheme = "pop";
|
412
|
-
interactiveRequest.resourceRequestMethod =
|
413
|
-
options.proofOfPossessionOptions.resourceRequestMethod;
|
414
|
-
interactiveRequest.resourceRequestUri = options.proofOfPossessionOptions.resourceRequestUrl;
|
415
|
-
}
|
416
|
-
try {
|
417
|
-
return await app.acquireTokenInteractive(interactiveRequest);
|
418
|
-
}
|
419
|
-
catch (e) {
|
420
|
-
msalLogger.verbose(`Failed to authenticate through the broker: ${e.message}`);
|
421
|
-
// If we tried to use the default broker account and failed, fall back to interactive authentication
|
422
|
-
if (useDefaultBrokerAccount) {
|
423
|
-
return getBrokeredToken(/* useDefaultBrokerAccount: */ false);
|
424
|
-
}
|
425
|
-
else {
|
426
|
-
throw e;
|
427
|
-
}
|
452
|
+
throw e;
|
428
453
|
}
|
429
454
|
}
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
455
|
+
}
|
456
|
+
/**
|
457
|
+
* A helper function that supports brokered authentication through the MSAL's public application.
|
458
|
+
*
|
459
|
+
* When useDefaultBrokerAccount is true, the method will attempt to authenticate using the default broker account.
|
460
|
+
* If the default broker account is not available, the method will fall back to interactive authentication.
|
461
|
+
*/
|
462
|
+
async function getBrokeredToken(scopes, useDefaultBrokerAccount, options = {}) {
|
463
|
+
msalLogger.getToken.info(`Attempting to acquire token using brokered authentication with useDefaultBrokerAccount: ${useDefaultBrokerAccount}`);
|
464
|
+
const response = await getBrokeredTokenInternal(scopes, useDefaultBrokerAccount, options);
|
465
|
+
(0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
|
466
|
+
(0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
|
467
|
+
state.cachedAccount = response?.account ?? null;
|
468
|
+
state.logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
|
469
|
+
return {
|
470
|
+
token: response.accessToken,
|
471
|
+
expiresOnTimestamp: response.expiresOn.getTime(),
|
472
|
+
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
473
|
+
tokenType: response.tokenType,
|
474
|
+
};
|
475
|
+
}
|
476
|
+
async function getTokenByInteractiveRequest(scopes, options = {}) {
|
477
|
+
msalLogger.getToken.info(`Attempting to acquire token interactively`);
|
478
|
+
const app = await getPublicApp(options);
|
446
479
|
return withSilentAuthentication(app, scopes, options, async () => {
|
447
|
-
|
448
|
-
const interactiveRequest = createBaseInteractiveRequest();
|
480
|
+
const interactiveRequest = createBaseInteractiveRequest(scopes, options);
|
449
481
|
if (state.pluginConfiguration.broker.isEnabled) {
|
450
|
-
return
|
482
|
+
return getBrokeredTokenInternal(scopes, state.pluginConfiguration.broker.useDefaultBrokerAccount ?? false, options);
|
451
483
|
}
|
452
484
|
if (options.proofOfPossessionOptions) {
|
453
485
|
interactiveRequest.shrNonce = options.proofOfPossessionOptions.nonce;
|
@@ -461,6 +493,7 @@ function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
461
493
|
}
|
462
494
|
return {
|
463
495
|
getActiveAccount,
|
496
|
+
getBrokeredToken,
|
464
497
|
getTokenByClientSecret,
|
465
498
|
getTokenByClientAssertion,
|
466
499
|
getTokenByClientCertificate,
|