@azure/identity 4.14.0-beta.2 → 4.14.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/browser/credentials/authorizationCodeCredential.d.ts +3 -3
- package/dist/browser/credentials/authorizationCodeCredential.d.ts.map +1 -0
- package/dist/browser/credentials/authorizationCodeCredential.js +2 -2
- package/dist/browser/credentials/authorizationCodeCredential.js.map +1 -0
- package/dist/browser/credentials/azureCliCredential.d.ts +5 -4
- package/dist/browser/credentials/azureCliCredential.d.ts.map +1 -0
- package/dist/browser/credentials/azureCliCredential.js +3 -3
- package/dist/browser/credentials/azureCliCredential.js.map +1 -0
- package/dist/browser/credentials/azureDeveloperCliCredential.d.ts +5 -4
- package/dist/browser/credentials/azureDeveloperCliCredential.d.ts.map +1 -0
- package/dist/browser/credentials/azureDeveloperCliCredential.js +3 -3
- package/dist/browser/credentials/azureDeveloperCliCredential.js.map +1 -0
- package/dist/browser/credentials/azurePipelinesCredential.d.ts +5 -4
- package/dist/browser/credentials/azurePipelinesCredential.d.ts.map +1 -0
- package/dist/browser/credentials/azurePipelinesCredential.js +3 -3
- package/dist/browser/credentials/azurePipelinesCredential.js.map +1 -0
- package/dist/browser/credentials/azurePowerShellCredential.d.ts +5 -4
- package/dist/browser/credentials/azurePowerShellCredential.d.ts.map +1 -0
- package/dist/browser/credentials/azurePowerShellCredential.js +3 -3
- package/dist/browser/credentials/azurePowerShellCredential.js.map +1 -0
- package/dist/browser/credentials/clientAssertionCredential.d.ts +5 -4
- package/dist/browser/credentials/clientAssertionCredential.d.ts.map +1 -0
- package/dist/browser/credentials/clientAssertionCredential.js +3 -3
- package/dist/browser/credentials/clientAssertionCredential.js.map +1 -0
- package/dist/browser/credentials/clientCertificateCredential.d.ts +6 -4
- package/dist/browser/credentials/clientCertificateCredential.d.ts.map +1 -0
- package/dist/browser/credentials/clientCertificateCredential.js +3 -3
- package/dist/browser/credentials/clientCertificateCredential.js.map +1 -0
- package/dist/browser/credentials/clientSecretCredential.d.ts +1 -1
- package/dist/browser/credentials/clientSecretCredential.d.ts.map +1 -0
- package/dist/browser/credentials/clientSecretCredential.js +1 -1
- package/dist/browser/credentials/clientSecretCredential.js.map +1 -0
- package/dist/browser/credentials/defaultAzureCredential.d.ts +3 -3
- package/dist/browser/credentials/defaultAzureCredential.d.ts.map +1 -0
- package/dist/browser/credentials/defaultAzureCredential.js +2 -2
- package/dist/browser/credentials/defaultAzureCredential.js.map +1 -0
- package/dist/browser/credentials/defaultAzureCredentialOptions.d.ts +2 -2
- package/dist/browser/credentials/defaultAzureCredentialOptions.js.map +1 -1
- package/dist/browser/credentials/deviceCodeCredential.d.ts +5 -4
- package/dist/browser/credentials/deviceCodeCredential.d.ts.map +1 -0
- package/dist/browser/credentials/deviceCodeCredential.js +3 -3
- package/dist/browser/credentials/deviceCodeCredential.js.map +1 -0
- package/dist/browser/credentials/environmentCredential.d.ts +5 -4
- package/dist/browser/credentials/environmentCredential.d.ts.map +1 -0
- package/dist/browser/credentials/environmentCredential.js +3 -3
- package/dist/browser/credentials/environmentCredential.js.map +1 -0
- package/dist/browser/credentials/interactiveBrowserCredential.d.ts +1 -1
- package/dist/browser/credentials/interactiveBrowserCredential.d.ts.map +1 -0
- package/dist/browser/credentials/interactiveBrowserCredential.js +1 -1
- package/dist/browser/credentials/interactiveBrowserCredential.js.map +1 -0
- package/dist/browser/credentials/managedIdentityCredential/index.d.ts +9 -4
- package/dist/browser/credentials/managedIdentityCredential/index.d.ts.map +1 -0
- package/dist/browser/credentials/managedIdentityCredential/index.js +3 -3
- package/dist/browser/credentials/managedIdentityCredential/index.js.map +1 -0
- package/dist/browser/credentials/onBehalfOfCredential.d.ts +5 -4
- package/dist/browser/credentials/onBehalfOfCredential.d.ts.map +1 -0
- package/dist/browser/credentials/onBehalfOfCredential.js +3 -3
- package/dist/browser/credentials/onBehalfOfCredential.js.map +1 -0
- package/dist/browser/credentials/usernamePasswordCredential.d.ts +1 -1
- package/dist/browser/credentials/usernamePasswordCredential.d.ts.map +1 -0
- package/dist/browser/credentials/usernamePasswordCredential.js +1 -1
- package/dist/browser/credentials/usernamePasswordCredential.js.map +1 -0
- package/dist/browser/credentials/visualStudioCodeCredential.d.ts +5 -4
- package/dist/browser/credentials/visualStudioCodeCredential.d.ts.map +1 -0
- package/dist/browser/credentials/visualStudioCodeCredential.js +3 -3
- package/dist/browser/credentials/visualStudioCodeCredential.js.map +1 -0
- package/dist/browser/credentials/workloadIdentityCredential.d.ts +5 -4
- package/dist/browser/credentials/workloadIdentityCredential.d.ts.map +1 -0
- package/dist/browser/credentials/workloadIdentityCredential.js +3 -3
- package/dist/browser/credentials/workloadIdentityCredential.js.map +1 -0
- package/dist/browser/index.d.ts +33 -33
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
- package/dist/browser/msal/browserFlows/msalBrowserCommon.js +2 -3
- package/dist/browser/msal/browserFlows/msalBrowserCommon.js.map +1 -1
- package/dist/browser/msal/msal.d.ts +2 -3
- package/dist/browser/msal/msal.d.ts.map +1 -0
- package/dist/browser/msal/msal.js +2 -3
- package/dist/browser/msal/msal.js.map +1 -0
- package/dist/browser/msal/nodeFlows/msalClient.d.ts +2 -2
- package/dist/browser/msal/nodeFlows/msalClient.d.ts.map +1 -1
- package/dist/browser/msal/nodeFlows/msalClient.js +3 -3
- package/dist/browser/msal/nodeFlows/msalClient.js.map +1 -1
- package/dist/browser/msal/utils.d.ts +5 -4
- package/dist/browser/msal/utils.d.ts.map +1 -1
- package/dist/browser/msal/utils.js +10 -10
- package/dist/browser/msal/utils.js.map +1 -1
- package/dist/browser/plugins/consumer.d.ts +1 -1
- package/dist/browser/plugins/consumer.d.ts.map +1 -0
- package/dist/browser/plugins/consumer.js +1 -1
- package/dist/browser/plugins/consumer.js.map +1 -0
- package/dist/browser/util/processMultiTenantRequest.d.ts +3 -2
- package/dist/browser/util/processMultiTenantRequest.d.ts.map +1 -0
- package/dist/browser/util/processMultiTenantRequest.js +2 -2
- package/dist/browser/util/processMultiTenantRequest.js.map +1 -0
- package/dist/commonjs/client/identityClient.js +294 -288
- package/dist/commonjs/client/identityClient.js.map +7 -1
- package/dist/commonjs/constants.d.ts +1 -1
- package/dist/commonjs/constants.js +61 -78
- package/dist/commonjs/constants.js.map +7 -1
- package/dist/commonjs/credentials/authorityValidationOptions.js +16 -5
- package/dist/commonjs/credentials/authorityValidationOptions.js.map +7 -1
- package/dist/commonjs/credentials/authorizationCodeCredential.js +98 -74
- package/dist/commonjs/credentials/authorizationCodeCredential.js.map +7 -1
- package/dist/commonjs/credentials/authorizationCodeCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/authorizationCodeCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/azureCliCredential.js +245 -214
- package/dist/commonjs/credentials/azureCliCredential.js.map +7 -1
- package/dist/commonjs/credentials/azureCliCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/azureCliCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/azureDeveloperCliCredential.js +237 -225
- package/dist/commonjs/credentials/azureDeveloperCliCredential.js.map +7 -1
- package/dist/commonjs/credentials/azureDeveloperCliCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/azureDeveloperCliCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/azurePipelinesCredential.js +173 -135
- package/dist/commonjs/credentials/azurePipelinesCredential.js.map +7 -1
- package/dist/commonjs/credentials/azurePipelinesCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/azurePipelinesCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/azurePowerShellCredential.js +201 -205
- package/dist/commonjs/credentials/azurePowerShellCredential.js.map +7 -1
- package/dist/commonjs/credentials/azurePowerShellCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/azurePowerShellCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/brokerAuthOptions.js +16 -3
- package/dist/commonjs/credentials/brokerAuthOptions.js.map +7 -1
- package/dist/commonjs/credentials/brokerCredential.js +103 -70
- package/dist/commonjs/credentials/brokerCredential.js.map +7 -1
- package/dist/commonjs/credentials/browserCustomizationOptions.js +16 -5
- package/dist/commonjs/credentials/browserCustomizationOptions.js.map +7 -1
- package/dist/commonjs/credentials/chainedTokenCredential.js +113 -93
- package/dist/commonjs/credentials/chainedTokenCredential.js.map +7 -1
- package/dist/commonjs/credentials/clientAssertionCredential.js +101 -63
- package/dist/commonjs/credentials/clientAssertionCredential.js.map +7 -1
- package/dist/commonjs/credentials/clientAssertionCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/clientAssertionCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/clientCertificateCredential.js +129 -123
- package/dist/commonjs/credentials/clientCertificateCredential.js.map +7 -1
- package/dist/commonjs/credentials/clientCertificateCredentialModels.js +16 -5
- package/dist/commonjs/credentials/clientCertificateCredentialModels.js.map +7 -1
- package/dist/commonjs/credentials/clientCertificateCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/clientCertificateCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/clientSecretCredential.js +96 -67
- package/dist/commonjs/credentials/clientSecretCredential.js.map +7 -1
- package/dist/commonjs/credentials/clientSecretCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/clientSecretCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/credentialPersistenceOptions.js +16 -5
- package/dist/commonjs/credentials/credentialPersistenceOptions.js.map +7 -1
- package/dist/commonjs/credentials/defaultAzureCredential.js +121 -159
- package/dist/commonjs/credentials/defaultAzureCredential.js.map +7 -1
- package/dist/commonjs/credentials/defaultAzureCredentialFunctions.js +110 -140
- package/dist/commonjs/credentials/defaultAzureCredentialFunctions.js.map +7 -1
- package/dist/commonjs/credentials/defaultAzureCredentialOptions.d.ts +2 -2
- package/dist/commonjs/credentials/defaultAzureCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/defaultAzureCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/deviceCodeCredential.js +132 -103
- package/dist/commonjs/credentials/deviceCodeCredential.js.map +7 -1
- package/dist/commonjs/credentials/deviceCodeCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/deviceCodeCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/environmentCredential.js +157 -123
- package/dist/commonjs/credentials/environmentCredential.js.map +7 -1
- package/dist/commonjs/credentials/environmentCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/environmentCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/interactiveBrowserCredential.js +144 -107
- package/dist/commonjs/credentials/interactiveBrowserCredential.js.map +7 -1
- package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/interactiveCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/interactiveCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/managedIdentityCredential/imdsMsi.js +92 -91
- package/dist/commonjs/credentials/managedIdentityCredential/imdsMsi.js.map +7 -1
- package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js +51 -44
- package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +7 -1
- package/dist/commonjs/credentials/managedIdentityCredential/index.js +256 -242
- package/dist/commonjs/credentials/managedIdentityCredential/index.js.map +7 -1
- package/dist/commonjs/credentials/managedIdentityCredential/models.js +16 -5
- package/dist/commonjs/credentials/managedIdentityCredential/models.js.map +7 -1
- package/dist/commonjs/credentials/managedIdentityCredential/options.js +16 -5
- package/dist/commonjs/credentials/managedIdentityCredential/options.js.map +7 -1
- package/dist/commonjs/credentials/managedIdentityCredential/tokenExchangeMsi.js +56 -39
- package/dist/commonjs/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +7 -1
- package/dist/commonjs/credentials/managedIdentityCredential/utils.js +79 -75
- package/dist/commonjs/credentials/managedIdentityCredential/utils.js.map +7 -1
- package/dist/commonjs/credentials/multiTenantTokenCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/multiTenantTokenCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/onBehalfOfCredential.js +168 -126
- package/dist/commonjs/credentials/onBehalfOfCredential.js.map +7 -1
- package/dist/commonjs/credentials/onBehalfOfCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/onBehalfOfCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/usernamePasswordCredential.js +112 -75
- package/dist/commonjs/credentials/usernamePasswordCredential.js.map +7 -1
- package/dist/commonjs/credentials/usernamePasswordCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/usernamePasswordCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/visualStudioCodeCredential.js +144 -132
- package/dist/commonjs/credentials/visualStudioCodeCredential.js.map +7 -1
- package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.js.map +7 -1
- package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js +16 -5
- package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js.map +7 -1
- package/dist/commonjs/credentials/workloadIdentityCredential.js +284 -274
- package/dist/commonjs/credentials/workloadIdentityCredential.js.map +7 -1
- package/dist/commonjs/credentials/workloadIdentityCredentialOptions.js +16 -5
- package/dist/commonjs/credentials/workloadIdentityCredentialOptions.js.map +7 -1
- package/dist/commonjs/errors.js +131 -132
- package/dist/commonjs/errors.js.map +7 -1
- package/dist/commonjs/index.d.ts +33 -33
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +115 -67
- package/dist/commonjs/index.js.map +7 -1
- package/dist/commonjs/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
- package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js +226 -249
- package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js.map +7 -1
- package/dist/commonjs/msal/browserFlows/msalBrowserOptions.js +16 -5
- package/dist/commonjs/msal/browserFlows/msalBrowserOptions.js.map +7 -1
- package/dist/commonjs/msal/credentials.js +16 -5
- package/dist/commonjs/msal/credentials.js.map +7 -1
- package/dist/commonjs/msal/msal.d.ts +1 -2
- package/dist/commonjs/msal/msal.d.ts.map +1 -1
- package/dist/commonjs/msal/msal.js +30 -9
- package/dist/commonjs/msal/msal.js.map +7 -1
- package/dist/commonjs/msal/nodeFlows/brokerOptions.js +16 -3
- package/dist/commonjs/msal/nodeFlows/brokerOptions.js.map +7 -1
- package/dist/commonjs/msal/nodeFlows/msalClient.d.ts +2 -2
- package/dist/commonjs/msal/nodeFlows/msalClient.d.ts.map +1 -1
- package/dist/commonjs/msal/nodeFlows/msalClient.js +450 -478
- package/dist/commonjs/msal/nodeFlows/msalClient.js.map +7 -1
- package/dist/commonjs/msal/nodeFlows/msalPlugins.js +140 -147
- package/dist/commonjs/msal/nodeFlows/msalPlugins.js.map +7 -1
- package/dist/commonjs/msal/nodeFlows/tokenCachePersistenceOptions.js +16 -5
- package/dist/commonjs/msal/nodeFlows/tokenCachePersistenceOptions.js.map +7 -1
- package/dist/commonjs/msal/types.js +16 -5
- package/dist/commonjs/msal/types.js.map +7 -1
- package/dist/commonjs/msal/utils.d.ts +5 -4
- package/dist/commonjs/msal/utils.d.ts.map +1 -1
- package/dist/commonjs/msal/utils.js +171 -211
- package/dist/commonjs/msal/utils.js.map +7 -1
- package/dist/commonjs/plugins/consumer.js +32 -40
- package/dist/commonjs/plugins/consumer.js.map +7 -1
- package/dist/commonjs/plugins/provider.js +16 -5
- package/dist/commonjs/plugins/provider.js.map +7 -1
- package/dist/commonjs/regionalAuthority.js +93 -141
- package/dist/commonjs/regionalAuthority.js.map +7 -1
- package/dist/commonjs/tokenCredentialOptions.js +16 -5
- package/dist/commonjs/tokenCredentialOptions.js.map +7 -1
- package/dist/commonjs/tokenProvider.js +52 -52
- package/dist/commonjs/tokenProvider.js.map +7 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/util/authorityHost.js +34 -19
- package/dist/commonjs/util/authorityHost.js.map +7 -1
- package/dist/commonjs/util/certificatesUtils.js +54 -45
- package/dist/commonjs/util/certificatesUtils.js.map +7 -1
- package/dist/commonjs/util/identityTokenEndpoint.js +32 -12
- package/dist/commonjs/util/identityTokenEndpoint.js.map +7 -1
- package/dist/commonjs/util/logging.js +91 -97
- package/dist/commonjs/util/logging.js.map +7 -1
- package/dist/commonjs/util/processMultiTenantRequest.js +43 -33
- package/dist/commonjs/util/processMultiTenantRequest.js.map +7 -1
- package/dist/commonjs/util/processUtils.js +60 -35
- package/dist/commonjs/util/processUtils.js.map +7 -1
- package/dist/commonjs/util/scopeUtils.js +39 -28
- package/dist/commonjs/util/scopeUtils.js.map +7 -1
- package/dist/commonjs/util/subscriptionUtils.js +35 -17
- package/dist/commonjs/util/subscriptionUtils.js.map +7 -1
- package/dist/commonjs/util/tenantIdUtils.js +61 -45
- package/dist/commonjs/util/tenantIdUtils.js.map +7 -1
- package/dist/commonjs/util/tracing.js +33 -16
- package/dist/commonjs/util/tracing.js.map +7 -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/esm/credentials/defaultAzureCredentialOptions.d.ts +2 -2
- package/dist/esm/credentials/defaultAzureCredentialOptions.js.map +1 -1
- package/dist/esm/index.d.ts +33 -33
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
- package/dist/esm/msal/browserFlows/msalBrowserCommon.js +2 -3
- package/dist/esm/msal/browserFlows/msalBrowserCommon.js.map +1 -1
- package/dist/esm/msal/msal.d.ts +1 -2
- package/dist/esm/msal/msal.d.ts.map +1 -1
- package/dist/esm/msal/msal.js +1 -2
- package/dist/esm/msal/msal.js.map +1 -1
- package/dist/esm/msal/nodeFlows/msalClient.d.ts +2 -2
- package/dist/esm/msal/nodeFlows/msalClient.d.ts.map +1 -1
- package/dist/esm/msal/nodeFlows/msalClient.js +3 -3
- package/dist/esm/msal/nodeFlows/msalClient.js.map +1 -1
- package/dist/esm/msal/utils.d.ts +5 -4
- package/dist/esm/msal/utils.d.ts.map +1 -1
- package/dist/esm/msal/utils.js +10 -10
- package/dist/esm/msal/utils.js.map +1 -1
- package/dist/workerd/constants.d.ts +1 -1
- package/dist/workerd/constants.js +1 -1
- package/dist/workerd/constants.js.map +1 -1
- package/dist/workerd/credentials/defaultAzureCredentialOptions.d.ts +2 -2
- package/dist/workerd/credentials/defaultAzureCredentialOptions.js.map +1 -1
- package/dist/workerd/index.d.ts +33 -33
- package/dist/workerd/index.d.ts.map +1 -1
- package/dist/workerd/index.js.map +1 -1
- package/dist/workerd/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
- package/dist/workerd/msal/browserFlows/msalBrowserCommon.js +2 -3
- package/dist/workerd/msal/browserFlows/msalBrowserCommon.js.map +1 -1
- package/dist/workerd/msal/msal.d.ts +1 -2
- package/dist/workerd/msal/msal.d.ts.map +1 -1
- package/dist/workerd/msal/msal.js +1 -2
- package/dist/workerd/msal/msal.js.map +1 -1
- package/dist/workerd/msal/nodeFlows/msalClient.d.ts +2 -2
- package/dist/workerd/msal/nodeFlows/msalClient.d.ts.map +1 -1
- package/dist/workerd/msal/nodeFlows/msalClient.js +3 -3
- package/dist/workerd/msal/nodeFlows/msalClient.js.map +1 -1
- package/dist/workerd/msal/utils.d.ts +5 -4
- package/dist/workerd/msal/utils.d.ts.map +1 -1
- package/dist/workerd/msal/utils.js +10 -10
- package/dist/workerd/msal/utils.js.map +1 -1
- package/package.json +10 -27
- package/dist/browser/credentials/authorizationCodeCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/authorizationCodeCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/azureCliCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/azureCliCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/azureDeveloperCliCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/azureDeveloperCliCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/azurePipelinesCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/azurePipelinesCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/azurePowerShellCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/azurePowerShellCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/clientAssertionCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/clientAssertionCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/clientCertificateCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/clientCertificateCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/clientSecretCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/clientSecretCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/defaultAzureCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/defaultAzureCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/deviceCodeCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/deviceCodeCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/environmentCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/environmentCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/interactiveBrowserCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/interactiveBrowserCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/managedIdentityCredential/index-browser.d.mts.map +0 -1
- package/dist/browser/credentials/managedIdentityCredential/index-browser.mjs.map +0 -1
- package/dist/browser/credentials/onBehalfOfCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/onBehalfOfCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/usernamePasswordCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/usernamePasswordCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/visualStudioCodeCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/visualStudioCodeCredential-browser.mjs.map +0 -1
- package/dist/browser/credentials/workloadIdentityCredential-browser.d.mts.map +0 -1
- package/dist/browser/credentials/workloadIdentityCredential-browser.mjs.map +0 -1
- package/dist/browser/msal/msal-browser.d.mts.map +0 -1
- package/dist/browser/msal/msal-browser.mjs.map +0 -1
- package/dist/browser/plugins/consumer-browser.d.mts.map +0 -1
- package/dist/browser/plugins/consumer-browser.mjs.map +0 -1
- package/dist/browser/util/authHostEnv-browser.d.mts +0 -4
- package/dist/browser/util/authHostEnv-browser.d.mts.map +0 -1
- package/dist/browser/util/authHostEnv-browser.mjs +0 -7
- package/dist/browser/util/authHostEnv-browser.mjs.map +0 -1
- package/dist/browser/util/processMultiTenantRequest-browser.d.mts.map +0 -1
- package/dist/browser/util/processMultiTenantRequest-browser.mjs.map +0 -1
- package/dist/esm/util/authHostEnv-browser.d.mts +0 -4
- package/dist/esm/util/authHostEnv-browser.d.mts.map +0 -1
- package/dist/esm/util/authHostEnv-browser.mjs +0 -7
- package/dist/esm/util/authHostEnv-browser.mjs.map +0 -1
- package/dist/workerd/util/authHostEnv-browser.d.mts +0 -4
- package/dist/workerd/util/authHostEnv-browser.d.mts.map +0 -1
- package/dist/workerd/util/authHostEnv-browser.mjs +0 -7
- package/dist/workerd/util/authHostEnv-browser.mjs.map +0 -1
|
@@ -1,504 +1,476 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var msalClient_exports = {};
|
|
29
|
+
__export(msalClient_exports, {
|
|
30
|
+
createMsalClient: () => createMsalClient,
|
|
31
|
+
generateMsalConfiguration: () => generateMsalConfiguration
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(msalClient_exports);
|
|
34
|
+
var msal = __toESM(require("@azure/msal-node"));
|
|
35
|
+
var import_logging = require("../../util/logging.js");
|
|
36
|
+
var import_msalPlugins = require("./msalPlugins.js");
|
|
37
|
+
var import_utils = require("../utils.js");
|
|
38
|
+
var import_errors = require("../../errors.js");
|
|
39
|
+
var import_identityClient = require("../../client/identityClient.js");
|
|
40
|
+
var import_regionalAuthority = require("../../regionalAuthority.js");
|
|
41
|
+
var import_logger = require("@azure/logger");
|
|
42
|
+
var import_tenantIdUtils = require("../../util/tenantIdUtils.js");
|
|
43
|
+
var import_authorityHost = require("../../util/authorityHost.js");
|
|
44
|
+
const msalLogger = (0, import_logging.credentialLogger)("MsalClient");
|
|
30
45
|
function generateMsalConfiguration(clientId, tenantId, msalClientOptions = {}) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
const resolvedTenant = (0, import_tenantIdUtils.resolveTenantId)(
|
|
47
|
+
msalClientOptions.logger ?? msalLogger,
|
|
48
|
+
tenantId,
|
|
49
|
+
clientId
|
|
50
|
+
);
|
|
51
|
+
const authority = (0, import_utils.getAuthority)(resolvedTenant, (0, import_authorityHost.getAuthorityHost)(msalClientOptions));
|
|
52
|
+
const httpClient = new import_identityClient.IdentityClient({
|
|
53
|
+
...msalClientOptions,
|
|
54
|
+
authorityHost: authority,
|
|
55
|
+
loggingOptions: msalClientOptions.loggingOptions
|
|
56
|
+
});
|
|
57
|
+
const msalConfig = {
|
|
58
|
+
auth: {
|
|
59
|
+
clientId,
|
|
60
|
+
authority,
|
|
61
|
+
knownAuthorities: (0, import_utils.getKnownAuthorities)(
|
|
62
|
+
resolvedTenant,
|
|
63
|
+
authority,
|
|
64
|
+
msalClientOptions.disableInstanceDiscovery
|
|
65
|
+
)
|
|
66
|
+
},
|
|
67
|
+
system: {
|
|
68
|
+
networkClient: httpClient,
|
|
69
|
+
loggerOptions: {
|
|
70
|
+
loggerCallback: (0, import_utils.defaultLoggerCallback)(msalClientOptions.logger ?? msalLogger),
|
|
71
|
+
logLevel: (0, import_utils.getMSALLogLevel)((0, import_logger.getLogLevel)()),
|
|
72
|
+
piiLoggingEnabled: msalClientOptions.loggingOptions?.enableUnsafeSupportLogging
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return msalConfig;
|
|
54
77
|
}
|
|
55
|
-
/**
|
|
56
|
-
* Creates an instance of the MSAL (Microsoft Authentication Library) client.
|
|
57
|
-
*
|
|
58
|
-
* @param clientId - The client ID of the application.
|
|
59
|
-
* @param tenantId - The tenant ID of the Azure Active Directory.
|
|
60
|
-
* @param createMsalClientOptions - Optional. Additional options for creating the MSAL client.
|
|
61
|
-
* @returns An instance of the MSAL client.
|
|
62
|
-
*
|
|
63
|
-
* @public
|
|
64
|
-
*/
|
|
65
78
|
function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
state.logger.getToken.info("Existing PublicClientApplication found in cache, returning it.");
|
|
80
|
-
return publicClientApp;
|
|
81
|
-
}
|
|
82
|
-
// Initialize a new app and cache it
|
|
83
|
-
state.logger.getToken.info(`Creating new PublicClientApplication with CAE ${options.enableCae ? "enabled" : "disabled"}.`);
|
|
84
|
-
const cachePlugin = options.enableCae
|
|
85
|
-
? state.pluginConfiguration.cache.cachePluginCae
|
|
86
|
-
: state.pluginConfiguration.cache.cachePlugin;
|
|
87
|
-
state.msalConfig.auth.clientCapabilities = options.enableCae ? ["cp1"] : undefined;
|
|
88
|
-
publicClientApp = new msal.PublicClientApplication({
|
|
89
|
-
...state.msalConfig,
|
|
90
|
-
broker: { nativeBrokerPlugin: state.pluginConfiguration.broker.nativeBrokerPlugin },
|
|
91
|
-
cache: { cachePlugin: await cachePlugin },
|
|
92
|
-
});
|
|
93
|
-
publicApps.set(appKey, publicClientApp);
|
|
94
|
-
return publicClientApp;
|
|
79
|
+
const state = {
|
|
80
|
+
msalConfig: generateMsalConfiguration(clientId, tenantId, createMsalClientOptions),
|
|
81
|
+
cachedAccount: createMsalClientOptions.authenticationRecord ? (0, import_utils.publicToMsal)(createMsalClientOptions.authenticationRecord) : null,
|
|
82
|
+
pluginConfiguration: import_msalPlugins.msalPlugins.generatePluginConfiguration(createMsalClientOptions),
|
|
83
|
+
logger: createMsalClientOptions.logger ?? msalLogger
|
|
84
|
+
};
|
|
85
|
+
const publicApps = /* @__PURE__ */ new Map();
|
|
86
|
+
async function getPublicApp(options = {}) {
|
|
87
|
+
const appKey = options.enableCae ? "CAE" : "default";
|
|
88
|
+
let publicClientApp = publicApps.get(appKey);
|
|
89
|
+
if (publicClientApp) {
|
|
90
|
+
state.logger.getToken.info("Existing PublicClientApplication found in cache, returning it.");
|
|
91
|
+
return publicClientApp;
|
|
95
92
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
93
|
+
state.logger.getToken.info(
|
|
94
|
+
`Creating new PublicClientApplication with CAE ${options.enableCae ? "enabled" : "disabled"}.`
|
|
95
|
+
);
|
|
96
|
+
const cachePlugin = options.enableCae ? state.pluginConfiguration.cache.cachePluginCae : state.pluginConfiguration.cache.cachePlugin;
|
|
97
|
+
state.msalConfig.auth.clientCapabilities = options.enableCae ? ["cp1"] : void 0;
|
|
98
|
+
publicClientApp = new msal.PublicClientApplication({
|
|
99
|
+
...state.msalConfig,
|
|
100
|
+
broker: { nativeBrokerPlugin: state.pluginConfiguration.broker.nativeBrokerPlugin },
|
|
101
|
+
cache: { cachePlugin: await cachePlugin }
|
|
102
|
+
});
|
|
103
|
+
publicApps.set(appKey, publicClientApp);
|
|
104
|
+
return publicClientApp;
|
|
105
|
+
}
|
|
106
|
+
const confidentialApps = /* @__PURE__ */ new Map();
|
|
107
|
+
async function getConfidentialApp(options = {}) {
|
|
108
|
+
const appKey = options.enableCae ? "CAE" : "default";
|
|
109
|
+
let confidentialClientApp = confidentialApps.get(appKey);
|
|
110
|
+
if (confidentialClientApp) {
|
|
111
|
+
state.logger.getToken.info(
|
|
112
|
+
"Existing ConfidentialClientApplication found in cache, returning it."
|
|
113
|
+
);
|
|
114
|
+
return confidentialClientApp;
|
|
117
115
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
silentRequest.tokenQueryParameters["msal_request_type"] = "consumer_passthrough";
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (options.proofOfPossessionOptions) {
|
|
139
|
-
silentRequest.shrNonce = options.proofOfPossessionOptions.nonce;
|
|
140
|
-
silentRequest.authenticationScheme = "pop";
|
|
141
|
-
silentRequest.resourceRequestMethod = options.proofOfPossessionOptions.resourceRequestMethod;
|
|
142
|
-
silentRequest.resourceRequestUri = options.proofOfPossessionOptions.resourceRequestUrl;
|
|
143
|
-
}
|
|
144
|
-
state.logger.getToken.info("Attempting to acquire token silently");
|
|
145
|
-
try {
|
|
146
|
-
return await app.acquireTokenSilent(silentRequest);
|
|
147
|
-
}
|
|
148
|
-
catch (err) {
|
|
149
|
-
throw (0, utils_js_1.handleMsalError)(scopes, err, options);
|
|
150
|
-
}
|
|
116
|
+
state.logger.getToken.info(
|
|
117
|
+
`Creating new ConfidentialClientApplication with CAE ${options.enableCae ? "enabled" : "disabled"}.`
|
|
118
|
+
);
|
|
119
|
+
const cachePlugin = options.enableCae ? state.pluginConfiguration.cache.cachePluginCae : state.pluginConfiguration.cache.cachePlugin;
|
|
120
|
+
state.msalConfig.auth.clientCapabilities = options.enableCae ? ["cp1"] : void 0;
|
|
121
|
+
confidentialClientApp = new msal.ConfidentialClientApplication({
|
|
122
|
+
...state.msalConfig,
|
|
123
|
+
broker: { nativeBrokerPlugin: state.pluginConfiguration.broker.nativeBrokerPlugin },
|
|
124
|
+
cache: { cachePlugin: await cachePlugin }
|
|
125
|
+
});
|
|
126
|
+
confidentialApps.set(appKey, confidentialClientApp);
|
|
127
|
+
return confidentialClientApp;
|
|
128
|
+
}
|
|
129
|
+
async function getTokenSilent(app, scopes, options = {}) {
|
|
130
|
+
if (state.cachedAccount === null) {
|
|
131
|
+
state.logger.getToken.info("No cached account found in local state.");
|
|
132
|
+
throw new import_errors.AuthenticationRequiredError({ scopes });
|
|
151
133
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
* if the user is creating cross-tenant requests
|
|
155
|
-
*/
|
|
156
|
-
function calculateRequestAuthority(options) {
|
|
157
|
-
if (options?.tenantId) {
|
|
158
|
-
return (0, utils_js_1.getAuthority)(options.tenantId, (0, authorityHost_js_1.getAuthorityHost)(createMsalClientOptions));
|
|
159
|
-
}
|
|
160
|
-
return state.msalConfig.auth.authority;
|
|
134
|
+
if (options.claims) {
|
|
135
|
+
state.cachedClaims = options.claims;
|
|
161
136
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
async function withSilentAuthentication(msalApp, scopes, options, onAuthenticationRequired) {
|
|
173
|
-
let response = null;
|
|
174
|
-
try {
|
|
175
|
-
response = await getTokenSilent(msalApp, scopes, options);
|
|
176
|
-
}
|
|
177
|
-
catch (e) {
|
|
178
|
-
if (e.name !== "AuthenticationRequiredError") {
|
|
179
|
-
throw e;
|
|
180
|
-
}
|
|
181
|
-
if (options.disableAutomaticAuthentication) {
|
|
182
|
-
throw new errors_js_1.AuthenticationRequiredError({
|
|
183
|
-
scopes,
|
|
184
|
-
getTokenOptions: options,
|
|
185
|
-
message: "Automatic authentication has been disabled. You may call the authentication() method.",
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
// Silent authentication failed
|
|
190
|
-
if (response === null) {
|
|
191
|
-
try {
|
|
192
|
-
response = await onAuthenticationRequired();
|
|
193
|
-
}
|
|
194
|
-
catch (err) {
|
|
195
|
-
throw (0, utils_js_1.handleMsalError)(scopes, err, options);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
// At this point we should have a token, process it
|
|
199
|
-
(0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
|
|
200
|
-
state.cachedAccount = response?.account ?? null;
|
|
201
|
-
state.logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
|
|
202
|
-
return {
|
|
203
|
-
token: response.accessToken,
|
|
204
|
-
expiresOnTimestamp: response.expiresOn.getTime(),
|
|
205
|
-
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
|
206
|
-
tokenType: response.tokenType,
|
|
207
|
-
};
|
|
137
|
+
const silentRequest = {
|
|
138
|
+
account: state.cachedAccount,
|
|
139
|
+
scopes,
|
|
140
|
+
claims: state.cachedClaims
|
|
141
|
+
};
|
|
142
|
+
if (state.pluginConfiguration.broker.isEnabled) {
|
|
143
|
+
silentRequest.extraQueryParameters ||= {};
|
|
144
|
+
if (state.pluginConfiguration.broker.enableMsaPassthrough) {
|
|
145
|
+
silentRequest.extraQueryParameters["msal_request_type"] = "consumer_passthrough";
|
|
146
|
+
}
|
|
208
147
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
const response = await msalApp.acquireTokenByClientCredential({
|
|
215
|
-
scopes,
|
|
216
|
-
authority: calculateRequestAuthority(options),
|
|
217
|
-
azureRegion: (0, regionalAuthority_js_1.calculateRegionalAuthority)(),
|
|
218
|
-
claims: options?.claims,
|
|
219
|
-
});
|
|
220
|
-
(0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
|
|
221
|
-
state.logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
|
|
222
|
-
return {
|
|
223
|
-
token: response.accessToken,
|
|
224
|
-
expiresOnTimestamp: response.expiresOn.getTime(),
|
|
225
|
-
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
|
226
|
-
tokenType: response.tokenType,
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
catch (err) {
|
|
230
|
-
throw (0, utils_js_1.handleMsalError)(scopes, err, options);
|
|
231
|
-
}
|
|
148
|
+
if (options.proofOfPossessionOptions) {
|
|
149
|
+
silentRequest.shrNonce = options.proofOfPossessionOptions.nonce;
|
|
150
|
+
silentRequest.authenticationScheme = "pop";
|
|
151
|
+
silentRequest.resourceRequestMethod = options.proofOfPossessionOptions.resourceRequestMethod;
|
|
152
|
+
silentRequest.resourceRequestUri = options.proofOfPossessionOptions.resourceRequestUrl;
|
|
232
153
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const response = await msalApp.acquireTokenByClientCredential({
|
|
239
|
-
scopes,
|
|
240
|
-
authority: calculateRequestAuthority(options),
|
|
241
|
-
azureRegion: (0, regionalAuthority_js_1.calculateRegionalAuthority)(),
|
|
242
|
-
claims: options?.claims,
|
|
243
|
-
clientAssertion,
|
|
244
|
-
});
|
|
245
|
-
(0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
|
|
246
|
-
state.logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
|
|
247
|
-
return {
|
|
248
|
-
token: response.accessToken,
|
|
249
|
-
expiresOnTimestamp: response.expiresOn.getTime(),
|
|
250
|
-
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
|
251
|
-
tokenType: response.tokenType,
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
catch (err) {
|
|
255
|
-
throw (0, utils_js_1.handleMsalError)(scopes, err, options);
|
|
256
|
-
}
|
|
154
|
+
state.logger.getToken.info("Attempting to acquire token silently");
|
|
155
|
+
try {
|
|
156
|
+
return await app.acquireTokenSilent(silentRequest);
|
|
157
|
+
} catch (err) {
|
|
158
|
+
throw (0, import_utils.handleMsalError)(scopes, err, options);
|
|
257
159
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
try {
|
|
263
|
-
const response = await msalApp.acquireTokenByClientCredential({
|
|
264
|
-
scopes,
|
|
265
|
-
authority: calculateRequestAuthority(options),
|
|
266
|
-
azureRegion: (0, regionalAuthority_js_1.calculateRegionalAuthority)(),
|
|
267
|
-
claims: options?.claims,
|
|
268
|
-
});
|
|
269
|
-
(0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
|
|
270
|
-
state.logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
|
|
271
|
-
return {
|
|
272
|
-
token: response.accessToken,
|
|
273
|
-
expiresOnTimestamp: response.expiresOn.getTime(),
|
|
274
|
-
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
|
275
|
-
tokenType: response.tokenType,
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
catch (err) {
|
|
279
|
-
throw (0, utils_js_1.handleMsalError)(scopes, err, options);
|
|
280
|
-
}
|
|
160
|
+
}
|
|
161
|
+
function calculateRequestAuthority(options) {
|
|
162
|
+
if (options?.tenantId) {
|
|
163
|
+
return (0, import_utils.getAuthority)(options.tenantId, (0, import_authorityHost.getAuthorityHost)(createMsalClientOptions));
|
|
281
164
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
return deviceCodeRequest;
|
|
165
|
+
return state.msalConfig.auth.authority;
|
|
166
|
+
}
|
|
167
|
+
async function withSilentAuthentication(msalApp, scopes, options, onAuthenticationRequired) {
|
|
168
|
+
let response = null;
|
|
169
|
+
try {
|
|
170
|
+
response = await getTokenSilent(msalApp, scopes, options);
|
|
171
|
+
} catch (e) {
|
|
172
|
+
if (e.name !== "AuthenticationRequiredError") {
|
|
173
|
+
throw e;
|
|
174
|
+
}
|
|
175
|
+
if (options.disableAutomaticAuthentication) {
|
|
176
|
+
throw new import_errors.AuthenticationRequiredError({
|
|
177
|
+
scopes,
|
|
178
|
+
getTokenOptions: options,
|
|
179
|
+
message: "Automatic authentication has been disabled. You may call the authentication() method."
|
|
300
180
|
});
|
|
181
|
+
}
|
|
301
182
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
username,
|
|
309
|
-
password,
|
|
310
|
-
authority: calculateRequestAuthority(options),
|
|
311
|
-
claims: options?.claims,
|
|
312
|
-
};
|
|
313
|
-
return msalApp.acquireTokenByUsernamePassword(requestOptions);
|
|
314
|
-
});
|
|
183
|
+
if (response === null) {
|
|
184
|
+
try {
|
|
185
|
+
response = await onAuthenticationRequired();
|
|
186
|
+
} catch (err) {
|
|
187
|
+
throw (0, import_utils.handleMsalError)(scopes, err, options);
|
|
188
|
+
}
|
|
315
189
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
190
|
+
(0, import_utils.ensureValidMsalToken)(scopes, response, options);
|
|
191
|
+
state.cachedAccount = response?.account ?? null;
|
|
192
|
+
state.logger.getToken.info((0, import_logging.formatSuccess)(scopes));
|
|
193
|
+
return {
|
|
194
|
+
token: response.accessToken,
|
|
195
|
+
expiresOnTimestamp: response.expiresOn.getTime(),
|
|
196
|
+
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
|
197
|
+
tokenType: response.tokenType
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
async function getTokenByClientSecret(scopes, clientSecret, options = {}) {
|
|
201
|
+
state.logger.getToken.info(`Attempting to acquire token using client secret`);
|
|
202
|
+
state.msalConfig.auth.clientSecret = clientSecret;
|
|
203
|
+
const msalApp = await getConfidentialApp(options);
|
|
204
|
+
try {
|
|
205
|
+
const response = await msalApp.acquireTokenByClientCredential({
|
|
206
|
+
scopes,
|
|
207
|
+
authority: calculateRequestAuthority(options),
|
|
208
|
+
azureRegion: (0, import_regionalAuthority.calculateRegionalAuthority)(),
|
|
209
|
+
claims: options?.claims
|
|
210
|
+
});
|
|
211
|
+
(0, import_utils.ensureValidMsalToken)(scopes, response, options);
|
|
212
|
+
state.logger.getToken.info((0, import_logging.formatSuccess)(scopes));
|
|
213
|
+
return {
|
|
214
|
+
token: response.accessToken,
|
|
215
|
+
expiresOnTimestamp: response.expiresOn.getTime(),
|
|
216
|
+
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
|
217
|
+
tokenType: response.tokenType
|
|
218
|
+
};
|
|
219
|
+
} catch (err) {
|
|
220
|
+
throw (0, import_utils.handleMsalError)(scopes, err, options);
|
|
321
221
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
222
|
+
}
|
|
223
|
+
async function getTokenByClientAssertion(scopes, clientAssertion, options = {}) {
|
|
224
|
+
state.logger.getToken.info(`Attempting to acquire token using client assertion`);
|
|
225
|
+
state.msalConfig.auth.clientAssertion = clientAssertion;
|
|
226
|
+
const msalApp = await getConfidentialApp(options);
|
|
227
|
+
try {
|
|
228
|
+
const response = await msalApp.acquireTokenByClientCredential({
|
|
229
|
+
scopes,
|
|
230
|
+
authority: calculateRequestAuthority(options),
|
|
231
|
+
azureRegion: (0, import_regionalAuthority.calculateRegionalAuthority)(),
|
|
232
|
+
claims: options?.claims,
|
|
233
|
+
clientAssertion
|
|
234
|
+
});
|
|
235
|
+
(0, import_utils.ensureValidMsalToken)(scopes, response, options);
|
|
236
|
+
state.logger.getToken.info((0, import_logging.formatSuccess)(scopes));
|
|
237
|
+
return {
|
|
238
|
+
token: response.accessToken,
|
|
239
|
+
expiresOnTimestamp: response.expiresOn.getTime(),
|
|
240
|
+
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
|
241
|
+
tokenType: response.tokenType
|
|
242
|
+
};
|
|
243
|
+
} catch (err) {
|
|
244
|
+
throw (0, import_utils.handleMsalError)(scopes, err, options);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
async function getTokenByClientCertificate(scopes, certificate, options = {}) {
|
|
248
|
+
state.logger.getToken.info(`Attempting to acquire token using client certificate`);
|
|
249
|
+
state.msalConfig.auth.clientCertificate = certificate;
|
|
250
|
+
const msalApp = await getConfidentialApp(options);
|
|
251
|
+
try {
|
|
252
|
+
const response = await msalApp.acquireTokenByClientCredential({
|
|
253
|
+
scopes,
|
|
254
|
+
authority: calculateRequestAuthority(options),
|
|
255
|
+
azureRegion: (0, import_regionalAuthority.calculateRegionalAuthority)(),
|
|
256
|
+
claims: options?.claims
|
|
257
|
+
});
|
|
258
|
+
(0, import_utils.ensureValidMsalToken)(scopes, response, options);
|
|
259
|
+
state.logger.getToken.info((0, import_logging.formatSuccess)(scopes));
|
|
260
|
+
return {
|
|
261
|
+
token: response.accessToken,
|
|
262
|
+
expiresOnTimestamp: response.expiresOn.getTime(),
|
|
263
|
+
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
|
264
|
+
tokenType: response.tokenType
|
|
265
|
+
};
|
|
266
|
+
} catch (err) {
|
|
267
|
+
throw (0, import_utils.handleMsalError)(scopes, err, options);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
async function getTokenByDeviceCode(scopes, deviceCodeCallback, options = {}) {
|
|
271
|
+
state.logger.getToken.info(`Attempting to acquire token using device code`);
|
|
272
|
+
const msalApp = await getPublicApp(options);
|
|
273
|
+
return withSilentAuthentication(msalApp, scopes, options, () => {
|
|
274
|
+
const requestOptions = {
|
|
275
|
+
scopes,
|
|
276
|
+
cancel: options?.abortSignal?.aborted ?? false,
|
|
277
|
+
deviceCodeCallback,
|
|
278
|
+
authority: calculateRequestAuthority(options),
|
|
279
|
+
claims: options?.claims
|
|
280
|
+
};
|
|
281
|
+
const deviceCodeRequest = msalApp.acquireTokenByDeviceCode(requestOptions);
|
|
282
|
+
if (options.abortSignal) {
|
|
283
|
+
options.abortSignal.addEventListener("abort", () => {
|
|
284
|
+
requestOptions.cancel = true;
|
|
342
285
|
});
|
|
286
|
+
}
|
|
287
|
+
return deviceCodeRequest;
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
async function getTokenByUsernamePassword(scopes, username, password, options = {}) {
|
|
291
|
+
state.logger.getToken.info(`Attempting to acquire token using username and password`);
|
|
292
|
+
const msalApp = await getPublicApp(options);
|
|
293
|
+
return withSilentAuthentication(msalApp, scopes, options, () => {
|
|
294
|
+
const requestOptions = {
|
|
295
|
+
scopes,
|
|
296
|
+
username,
|
|
297
|
+
password,
|
|
298
|
+
authority: calculateRequestAuthority(options),
|
|
299
|
+
claims: options?.claims
|
|
300
|
+
};
|
|
301
|
+
return msalApp.acquireTokenByUsernamePassword(requestOptions);
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
function getActiveAccount() {
|
|
305
|
+
if (!state.cachedAccount) {
|
|
306
|
+
return void 0;
|
|
343
307
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
state.msalConfig.auth.clientAssertion = clientCredentials;
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
// Client certificate
|
|
358
|
-
msalLogger.getToken.info(`Using client certificate for on behalf of flow`);
|
|
359
|
-
state.msalConfig.auth.clientCertificate = clientCredentials;
|
|
360
|
-
}
|
|
361
|
-
const msalApp = await getConfidentialApp(options);
|
|
362
|
-
try {
|
|
363
|
-
const response = await msalApp.acquireTokenOnBehalfOf({
|
|
364
|
-
scopes,
|
|
365
|
-
authority: calculateRequestAuthority(options),
|
|
366
|
-
claims: options.claims,
|
|
367
|
-
oboAssertion: userAssertionToken,
|
|
368
|
-
});
|
|
369
|
-
(0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
|
|
370
|
-
msalLogger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
|
|
371
|
-
return {
|
|
372
|
-
token: response.accessToken,
|
|
373
|
-
expiresOnTimestamp: response.expiresOn.getTime(),
|
|
374
|
-
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
|
375
|
-
tokenType: response.tokenType,
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
catch (err) {
|
|
379
|
-
throw (0, utils_js_1.handleMsalError)(scopes, err, options);
|
|
380
|
-
}
|
|
308
|
+
return (0, import_utils.msalToPublic)(clientId, state.cachedAccount);
|
|
309
|
+
}
|
|
310
|
+
async function getTokenByAuthorizationCode(scopes, redirectUri, authorizationCode, clientSecret, options = {}) {
|
|
311
|
+
state.logger.getToken.info(`Attempting to acquire token using authorization code`);
|
|
312
|
+
let msalApp;
|
|
313
|
+
if (clientSecret) {
|
|
314
|
+
state.msalConfig.auth.clientSecret = clientSecret;
|
|
315
|
+
msalApp = await getConfidentialApp(options);
|
|
316
|
+
} else {
|
|
317
|
+
msalApp = await getPublicApp(options);
|
|
381
318
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
319
|
+
return withSilentAuthentication(msalApp, scopes, options, () => {
|
|
320
|
+
return msalApp.acquireTokenByCode({
|
|
321
|
+
scopes,
|
|
322
|
+
redirectUri,
|
|
323
|
+
code: authorizationCode,
|
|
324
|
+
authority: calculateRequestAuthority(options),
|
|
325
|
+
claims: options?.claims
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
async function getTokenOnBehalfOf(scopes, userAssertionToken, clientCredentials, options = {}) {
|
|
330
|
+
msalLogger.getToken.info(`Attempting to acquire token on behalf of another user`);
|
|
331
|
+
if (typeof clientCredentials === "string") {
|
|
332
|
+
msalLogger.getToken.info(`Using client secret for on behalf of flow`);
|
|
333
|
+
state.msalConfig.auth.clientSecret = clientCredentials;
|
|
334
|
+
} else if (typeof clientCredentials === "function") {
|
|
335
|
+
msalLogger.getToken.info(`Using client assertion callback for on behalf of flow`);
|
|
336
|
+
state.msalConfig.auth.clientAssertion = clientCredentials;
|
|
337
|
+
} else {
|
|
338
|
+
msalLogger.getToken.info(`Using client certificate for on behalf of flow`);
|
|
339
|
+
state.msalConfig.auth.clientCertificate = clientCredentials;
|
|
400
340
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
if (useDefaultBrokerAccount) {
|
|
420
|
-
interactiveRequest.prompt = "none";
|
|
421
|
-
msalLogger.verbose("Attempting broker authentication using the default broker account");
|
|
422
|
-
}
|
|
423
|
-
else {
|
|
424
|
-
msalLogger.verbose("Attempting broker authentication without the default broker account");
|
|
425
|
-
}
|
|
426
|
-
if (options.proofOfPossessionOptions) {
|
|
427
|
-
interactiveRequest.shrNonce = options.proofOfPossessionOptions.nonce;
|
|
428
|
-
interactiveRequest.authenticationScheme = "pop";
|
|
429
|
-
interactiveRequest.resourceRequestMethod =
|
|
430
|
-
options.proofOfPossessionOptions.resourceRequestMethod;
|
|
431
|
-
interactiveRequest.resourceRequestUri = options.proofOfPossessionOptions.resourceRequestUrl;
|
|
432
|
-
}
|
|
433
|
-
try {
|
|
434
|
-
return await app.acquireTokenInteractive(interactiveRequest);
|
|
435
|
-
}
|
|
436
|
-
catch (e) {
|
|
437
|
-
msalLogger.verbose(`Failed to authenticate through the broker: ${e.message}`);
|
|
438
|
-
if (options.disableAutomaticAuthentication) {
|
|
439
|
-
throw new errors_js_1.AuthenticationRequiredError({
|
|
440
|
-
scopes,
|
|
441
|
-
getTokenOptions: options,
|
|
442
|
-
message: "Cannot silently authenticate with default broker account.",
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
// If we tried to use the default broker account and failed, fall back to interactive authentication
|
|
446
|
-
if (useDefaultBrokerAccount) {
|
|
447
|
-
return getBrokeredTokenInternal(scopes, false, options);
|
|
448
|
-
}
|
|
449
|
-
else {
|
|
450
|
-
throw e;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
341
|
+
const msalApp = await getConfidentialApp(options);
|
|
342
|
+
try {
|
|
343
|
+
const response = await msalApp.acquireTokenOnBehalfOf({
|
|
344
|
+
scopes,
|
|
345
|
+
authority: calculateRequestAuthority(options),
|
|
346
|
+
claims: options.claims,
|
|
347
|
+
oboAssertion: userAssertionToken
|
|
348
|
+
});
|
|
349
|
+
(0, import_utils.ensureValidMsalToken)(scopes, response, options);
|
|
350
|
+
msalLogger.getToken.info((0, import_logging.formatSuccess)(scopes));
|
|
351
|
+
return {
|
|
352
|
+
token: response.accessToken,
|
|
353
|
+
expiresOnTimestamp: response.expiresOn.getTime(),
|
|
354
|
+
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
|
355
|
+
tokenType: response.tokenType
|
|
356
|
+
};
|
|
357
|
+
} catch (err) {
|
|
358
|
+
throw (0, import_utils.handleMsalError)(scopes, err, options);
|
|
453
359
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
360
|
+
}
|
|
361
|
+
function createBaseInteractiveRequest(scopes, options) {
|
|
362
|
+
return {
|
|
363
|
+
openBrowser: async (url) => {
|
|
364
|
+
const open = await import("open");
|
|
365
|
+
await open.default(url, { newInstance: true });
|
|
366
|
+
},
|
|
367
|
+
scopes,
|
|
368
|
+
authority: calculateRequestAuthority(options),
|
|
369
|
+
claims: options?.claims,
|
|
370
|
+
loginHint: options?.loginHint,
|
|
371
|
+
errorTemplate: options?.browserCustomizationOptions?.errorMessage,
|
|
372
|
+
successTemplate: options?.browserCustomizationOptions?.successMessage,
|
|
373
|
+
prompt: options?.loginHint ? "login" : "select_account"
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
async function getBrokeredTokenInternal(scopes, useDefaultBrokerAccount, options = {}) {
|
|
377
|
+
msalLogger.verbose("Authentication will resume through the broker");
|
|
378
|
+
const app = await getPublicApp(options);
|
|
379
|
+
const interactiveRequest = createBaseInteractiveRequest(scopes, options);
|
|
380
|
+
if (state.pluginConfiguration.broker.parentWindowHandle) {
|
|
381
|
+
interactiveRequest.windowHandle = Buffer.from(
|
|
382
|
+
state.pluginConfiguration.broker.parentWindowHandle
|
|
383
|
+
);
|
|
384
|
+
} else {
|
|
385
|
+
msalLogger.warning(
|
|
386
|
+
"Parent window handle is not specified for the broker. This may cause unexpected behavior. Please provide the parentWindowHandle."
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
if (state.pluginConfiguration.broker.enableMsaPassthrough) {
|
|
390
|
+
(interactiveRequest.extraQueryParameters ??= {})["msal_request_type"] = "consumer_passthrough";
|
|
391
|
+
}
|
|
392
|
+
if (useDefaultBrokerAccount) {
|
|
393
|
+
interactiveRequest.prompt = "none";
|
|
394
|
+
msalLogger.verbose("Attempting broker authentication using the default broker account");
|
|
395
|
+
} else {
|
|
396
|
+
msalLogger.verbose("Attempting broker authentication without the default broker account");
|
|
472
397
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
return app.acquireTokenInteractive(interactiveRequest);
|
|
398
|
+
if (options.proofOfPossessionOptions) {
|
|
399
|
+
interactiveRequest.shrNonce = options.proofOfPossessionOptions.nonce;
|
|
400
|
+
interactiveRequest.authenticationScheme = "pop";
|
|
401
|
+
interactiveRequest.resourceRequestMethod = options.proofOfPossessionOptions.resourceRequestMethod;
|
|
402
|
+
interactiveRequest.resourceRequestUri = options.proofOfPossessionOptions.resourceRequestUrl;
|
|
403
|
+
}
|
|
404
|
+
try {
|
|
405
|
+
return await app.acquireTokenInteractive(interactiveRequest);
|
|
406
|
+
} catch (e) {
|
|
407
|
+
msalLogger.verbose(`Failed to authenticate through the broker: ${e.message}`);
|
|
408
|
+
if (options.disableAutomaticAuthentication) {
|
|
409
|
+
throw new import_errors.AuthenticationRequiredError({
|
|
410
|
+
scopes,
|
|
411
|
+
getTokenOptions: options,
|
|
412
|
+
message: "Cannot silently authenticate with default broker account."
|
|
489
413
|
});
|
|
414
|
+
}
|
|
415
|
+
if (useDefaultBrokerAccount) {
|
|
416
|
+
return getBrokeredTokenInternal(scopes, false, options);
|
|
417
|
+
} else {
|
|
418
|
+
throw e;
|
|
419
|
+
}
|
|
490
420
|
}
|
|
421
|
+
}
|
|
422
|
+
async function getBrokeredToken(scopes, useDefaultBrokerAccount, options = {}) {
|
|
423
|
+
msalLogger.getToken.info(
|
|
424
|
+
`Attempting to acquire token using brokered authentication with useDefaultBrokerAccount: ${useDefaultBrokerAccount}`
|
|
425
|
+
);
|
|
426
|
+
const response = await getBrokeredTokenInternal(scopes, useDefaultBrokerAccount, options);
|
|
427
|
+
(0, import_utils.ensureValidMsalToken)(scopes, response, options);
|
|
428
|
+
state.cachedAccount = response?.account ?? null;
|
|
429
|
+
state.logger.getToken.info((0, import_logging.formatSuccess)(scopes));
|
|
491
430
|
return {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
getTokenByClientCertificate,
|
|
497
|
-
getTokenByDeviceCode,
|
|
498
|
-
getTokenByUsernamePassword,
|
|
499
|
-
getTokenByAuthorizationCode,
|
|
500
|
-
getTokenOnBehalfOf,
|
|
501
|
-
getTokenByInteractiveRequest,
|
|
431
|
+
token: response.accessToken,
|
|
432
|
+
expiresOnTimestamp: response.expiresOn.getTime(),
|
|
433
|
+
refreshAfterTimestamp: response.refreshOn?.getTime(),
|
|
434
|
+
tokenType: response.tokenType
|
|
502
435
|
};
|
|
436
|
+
}
|
|
437
|
+
async function getTokenByInteractiveRequest(scopes, options = {}) {
|
|
438
|
+
msalLogger.getToken.info(`Attempting to acquire token interactively`);
|
|
439
|
+
const app = await getPublicApp(options);
|
|
440
|
+
return withSilentAuthentication(app, scopes, options, async () => {
|
|
441
|
+
const interactiveRequest = createBaseInteractiveRequest(scopes, options);
|
|
442
|
+
if (state.pluginConfiguration.broker.isEnabled) {
|
|
443
|
+
return getBrokeredTokenInternal(
|
|
444
|
+
scopes,
|
|
445
|
+
state.pluginConfiguration.broker.useDefaultBrokerAccount ?? false,
|
|
446
|
+
options
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
if (options.proofOfPossessionOptions) {
|
|
450
|
+
interactiveRequest.shrNonce = options.proofOfPossessionOptions.nonce;
|
|
451
|
+
interactiveRequest.authenticationScheme = "pop";
|
|
452
|
+
interactiveRequest.resourceRequestMethod = options.proofOfPossessionOptions.resourceRequestMethod;
|
|
453
|
+
interactiveRequest.resourceRequestUri = options.proofOfPossessionOptions.resourceRequestUrl;
|
|
454
|
+
}
|
|
455
|
+
return app.acquireTokenInteractive(interactiveRequest);
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
return {
|
|
459
|
+
getActiveAccount,
|
|
460
|
+
getBrokeredToken,
|
|
461
|
+
getTokenByClientSecret,
|
|
462
|
+
getTokenByClientAssertion,
|
|
463
|
+
getTokenByClientCertificate,
|
|
464
|
+
getTokenByDeviceCode,
|
|
465
|
+
getTokenByUsernamePassword,
|
|
466
|
+
getTokenByAuthorizationCode,
|
|
467
|
+
getTokenOnBehalfOf,
|
|
468
|
+
getTokenByInteractiveRequest
|
|
469
|
+
};
|
|
503
470
|
}
|
|
504
|
-
|
|
471
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
472
|
+
0 && (module.exports = {
|
|
473
|
+
createMsalClient,
|
|
474
|
+
generateMsalConfiguration
|
|
475
|
+
});
|
|
476
|
+
//# sourceMappingURL=msalClient.js.map
|