@azure/identity 4.14.0-beta.2 → 4.14.0-beta.4
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/client/identityClient.d.ts.map +1 -1
- package/dist/browser/client/identityClient.js +2 -1
- package/dist/browser/client/identityClient.js.map +1 -1
- 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 → authorizationCodeCredential-browser.d.mts} +2 -2
- package/dist/browser/credentials/authorizationCodeCredential-browser.d.mts.map +1 -1
- package/dist/browser/credentials/{authorizationCodeCredential.js → authorizationCodeCredential-browser.mjs} +1 -1
- package/dist/browser/credentials/authorizationCodeCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/azureCliCredential-browser.d.mts +14 -0
- package/dist/browser/credentials/azureCliCredential-browser.d.mts.map +1 -1
- package/dist/browser/credentials/{azureCliCredential.js → azureCliCredential-browser.mjs} +2 -2
- package/dist/browser/credentials/azureCliCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/azureDeveloperCliCredential-browser.d.mts +14 -0
- package/dist/browser/credentials/azureDeveloperCliCredential-browser.d.mts.map +1 -1
- package/dist/browser/credentials/{azureDeveloperCliCredential.js → azureDeveloperCliCredential-browser.mjs} +2 -2
- package/dist/browser/credentials/azureDeveloperCliCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/azurePipelinesCredential-browser.d.mts +14 -0
- package/dist/browser/credentials/azurePipelinesCredential-browser.d.mts.map +1 -1
- package/dist/browser/credentials/{azurePipelinesCredential.js → azurePipelinesCredential-browser.mjs} +2 -2
- package/dist/browser/credentials/azurePipelinesCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/azurePowerShellCredential-browser.d.mts +13 -0
- package/dist/browser/credentials/azurePowerShellCredential-browser.d.mts.map +1 -1
- package/dist/browser/credentials/{azurePowerShellCredential.js → azurePowerShellCredential-browser.mjs} +2 -2
- package/dist/browser/credentials/azurePowerShellCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/clientAssertionCredential-browser.d.mts +13 -0
- package/dist/browser/credentials/clientAssertionCredential-browser.d.mts.map +1 -1
- package/dist/browser/credentials/{clientAssertionCredential.js → clientAssertionCredential-browser.mjs} +2 -2
- package/dist/browser/credentials/clientAssertionCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/clientCertificateCredential-browser.d.mts +15 -0
- package/dist/browser/credentials/clientCertificateCredential-browser.d.mts.map +1 -1
- package/dist/browser/credentials/{clientCertificateCredential.js → clientCertificateCredential-browser.mjs} +2 -2
- package/dist/browser/credentials/clientCertificateCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/{defaultAzureCredential.d.ts → defaultAzureCredential-browser.d.mts} +2 -2
- package/dist/browser/credentials/defaultAzureCredential-browser.d.mts.map +1 -1
- package/dist/browser/credentials/{defaultAzureCredential.js → defaultAzureCredential-browser.mjs} +1 -1
- package/dist/browser/credentials/defaultAzureCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/defaultAzureCredentialOptions.d.ts +2 -2
- package/dist/browser/credentials/defaultAzureCredentialOptions.js.map +1 -1
- package/dist/browser/credentials/deviceCodeCredential-browser.d.mts +14 -0
- package/dist/browser/credentials/deviceCodeCredential-browser.d.mts.map +1 -1
- package/dist/browser/credentials/{deviceCodeCredential.js → deviceCodeCredential-browser.mjs} +2 -2
- package/dist/browser/credentials/deviceCodeCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/environmentCredential-browser.d.mts +14 -0
- package/dist/browser/credentials/environmentCredential-browser.d.mts.map +1 -1
- package/dist/browser/credentials/{environmentCredential.js → environmentCredential-browser.mjs} +2 -2
- package/dist/browser/credentials/environmentCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/managedIdentityCredential/index-browser.d.mts +11 -0
- package/dist/browser/credentials/managedIdentityCredential/index-browser.d.mts.map +1 -1
- package/dist/browser/credentials/managedIdentityCredential/{index.js → index-browser.mjs} +2 -2
- package/dist/browser/credentials/managedIdentityCredential/index-browser.mjs.map +1 -1
- package/dist/browser/credentials/onBehalfOfCredential-browser.d.mts +13 -0
- package/dist/browser/credentials/onBehalfOfCredential-browser.d.mts.map +1 -1
- package/dist/browser/credentials/{onBehalfOfCredential.js → onBehalfOfCredential-browser.mjs} +2 -2
- package/dist/browser/credentials/onBehalfOfCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/usernamePasswordCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/{visualStudioCodeCredential.d.ts → visualStudioCodeCredential-browser.d.mts} +4 -3
- package/dist/browser/credentials/visualStudioCodeCredential-browser.d.mts.map +1 -1
- package/dist/browser/credentials/{visualStudioCodeCredential.js → visualStudioCodeCredential-browser.mjs} +2 -2
- package/dist/browser/credentials/visualStudioCodeCredential-browser.mjs.map +1 -1
- package/dist/browser/credentials/{workloadIdentityCredential.d.ts → workloadIdentityCredential-browser.d.mts} +4 -3
- package/dist/browser/credentials/workloadIdentityCredential-browser.d.mts.map +1 -1
- package/dist/browser/credentials/{workloadIdentityCredential.js → workloadIdentityCredential-browser.mjs} +2 -2
- package/dist/browser/credentials/workloadIdentityCredential-browser.mjs.map +1 -1
- package/dist/browser/index.d.ts +51 -51
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +19 -19
- 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-browser.d.mts +2 -0
- package/dist/browser/msal/msal-browser.d.mts.map +1 -1
- package/dist/browser/msal/msal-browser.mjs +4 -0
- package/dist/browser/msal/msal-browser.mjs.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 +16 -11
- package/dist/browser/msal/utils.js.map +1 -1
- package/dist/browser/util/{processMultiTenantRequest.d.ts → processMultiTenantRequest-browser.d.mts} +2 -1
- package/dist/browser/util/processMultiTenantRequest-browser.d.mts.map +1 -1
- package/dist/browser/util/{processMultiTenantRequest.js → processMultiTenantRequest-browser.mjs} +1 -1
- package/dist/browser/util/processMultiTenantRequest-browser.mjs.map +1 -1
- package/dist/browser/util/tenantIdUtils.d.ts +1 -1
- package/dist/browser/util/tenantIdUtils.d.ts.map +1 -1
- package/dist/browser/util/tenantIdUtils.js +1 -1
- package/dist/browser/util/tenantIdUtils.js.map +1 -1
- package/dist/commonjs/client/identityClient.d.ts.map +1 -1
- package/dist/commonjs/client/identityClient.js +295 -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.d.ts.map +1 -1
- package/dist/commonjs/credentials/azureCliCredential.js +246 -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.d.ts +12 -4
- package/dist/commonjs/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
- package/dist/commonjs/credentials/azureDeveloperCliCredential.js +262 -224
- 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.d.ts.map +1 -1
- package/dist/commonjs/credentials/azurePowerShellCredential.js +205 -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/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/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 +176 -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.d.ts.map +1 -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/client/identityClient.d.ts.map +1 -1
- package/dist/esm/client/identityClient.js +2 -1
- package/dist/esm/client/identityClient.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/credentials/azureCliCredential.d.ts.map +1 -1
- package/dist/esm/credentials/azureCliCredential.js +2 -1
- package/dist/esm/credentials/azureCliCredential.js.map +1 -1
- package/dist/esm/credentials/azureDeveloperCliCredential.d.ts +12 -4
- package/dist/esm/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
- package/dist/esm/credentials/azureDeveloperCliCredential.js +40 -14
- package/dist/esm/credentials/azureDeveloperCliCredential.js.map +1 -1
- package/dist/esm/credentials/azurePipelinesCredential.js.map +1 -1
- package/dist/esm/credentials/azurePowerShellCredential.d.ts.map +1 -1
- package/dist/esm/credentials/azurePowerShellCredential.js +2 -1
- package/dist/esm/credentials/azurePowerShellCredential.js.map +1 -1
- package/dist/esm/credentials/defaultAzureCredential.js.map +1 -1
- package/dist/esm/credentials/defaultAzureCredentialFunctions.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/credentials/environmentCredential.js.map +1 -1
- package/dist/esm/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
- package/dist/esm/credentials/workloadIdentityCredential.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/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 +16 -11
- package/dist/esm/msal/utils.js.map +1 -1
- package/dist/esm/util/tenantIdUtils.d.ts.map +1 -1
- package/dist/esm/util/tenantIdUtils.js.map +1 -1
- package/dist/workerd/client/identityClient.d.ts.map +1 -1
- package/dist/workerd/client/identityClient.js +2 -1
- package/dist/workerd/client/identityClient.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/azureCliCredential.d.ts.map +1 -1
- package/dist/workerd/credentials/azureCliCredential.js +2 -1
- package/dist/workerd/credentials/azureCliCredential.js.map +1 -1
- package/dist/workerd/credentials/azureDeveloperCliCredential.d.ts +12 -4
- package/dist/workerd/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
- package/dist/workerd/credentials/azureDeveloperCliCredential.js +40 -14
- package/dist/workerd/credentials/azureDeveloperCliCredential.js.map +1 -1
- package/dist/workerd/credentials/azurePipelinesCredential.js.map +1 -1
- package/dist/workerd/credentials/azurePowerShellCredential.d.ts.map +1 -1
- package/dist/workerd/credentials/azurePowerShellCredential.js +2 -1
- package/dist/workerd/credentials/azurePowerShellCredential.js.map +1 -1
- package/dist/workerd/credentials/defaultAzureCredential.js.map +1 -1
- package/dist/workerd/credentials/defaultAzureCredentialFunctions.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/credentials/environmentCredential.js.map +1 -1
- package/dist/workerd/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
- package/dist/workerd/credentials/workloadIdentityCredential.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/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 +16 -11
- package/dist/workerd/msal/utils.js.map +1 -1
- package/dist/workerd/util/tenantIdUtils.d.ts.map +1 -1
- package/dist/workerd/util/tenantIdUtils.js.map +1 -1
- package/package.json +29 -36
- package/dist/browser/credentials/azureCliCredential.d.ts +0 -13
- package/dist/browser/credentials/azureDeveloperCliCredential.d.ts +0 -13
- package/dist/browser/credentials/azurePipelinesCredential.d.ts +0 -13
- package/dist/browser/credentials/azurePowerShellCredential.d.ts +0 -12
- package/dist/browser/credentials/brokerCredential.d.ts +0 -35
- package/dist/browser/credentials/brokerCredential.d.ts.map +0 -1
- package/dist/browser/credentials/brokerCredential.js +0 -68
- package/dist/browser/credentials/brokerCredential.js.map +0 -1
- package/dist/browser/credentials/clientAssertionCredential.d.ts +0 -12
- package/dist/browser/credentials/clientCertificateCredential.d.ts +0 -13
- package/dist/browser/credentials/defaultAzureCredentialFunctions.d.ts +0 -64
- package/dist/browser/credentials/defaultAzureCredentialFunctions.d.ts.map +0 -1
- package/dist/browser/credentials/defaultAzureCredentialFunctions.js +0 -147
- package/dist/browser/credentials/defaultAzureCredentialFunctions.js.map +0 -1
- package/dist/browser/credentials/deviceCodeCredential.d.ts +0 -13
- package/dist/browser/credentials/environmentCredential.d.ts +0 -13
- package/dist/browser/credentials/managedIdentityCredential/imdsMsi.d.ts +0 -18
- package/dist/browser/credentials/managedIdentityCredential/imdsMsi.d.ts.map +0 -1
- package/dist/browser/credentials/managedIdentityCredential/imdsMsi.js +0 -97
- package/dist/browser/credentials/managedIdentityCredential/imdsMsi.js.map +0 -1
- package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts +0 -13
- package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts.map +0 -1
- package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.js +0 -43
- package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +0 -1
- package/dist/browser/credentials/managedIdentityCredential/index.d.ts +0 -6
- package/dist/browser/credentials/managedIdentityCredential/models.d.ts +0 -24
- package/dist/browser/credentials/managedIdentityCredential/models.d.ts.map +0 -1
- package/dist/browser/credentials/managedIdentityCredential/models.js +0 -4
- package/dist/browser/credentials/managedIdentityCredential/models.js.map +0 -1
- package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.d.ts +0 -14
- package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.d.ts.map +0 -1
- package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.js +0 -38
- package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +0 -1
- package/dist/browser/credentials/onBehalfOfCredential.d.ts +0 -12
- package/dist/browser/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
- package/dist/browser/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
- package/dist/browser/credentials/visualStudioCodeCredentialPlugin.js +0 -4
- package/dist/browser/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
- package/dist/browser/msal/msal.d.ts +0 -3
- package/dist/browser/msal/msal.js +0 -5
- package/dist/browser/msal/nodeFlows/msalClient.d.ts +0 -205
- package/dist/browser/msal/nodeFlows/msalClient.d.ts.map +0 -1
- package/dist/browser/msal/nodeFlows/msalClient.js +0 -499
- package/dist/browser/msal/nodeFlows/msalClient.js.map +0 -1
- package/dist/browser/msal/nodeFlows/msalPlugins.d.ts +0 -109
- package/dist/browser/msal/nodeFlows/msalPlugins.d.ts.map +0 -1
- package/dist/browser/msal/nodeFlows/msalPlugins.js +0 -160
- package/dist/browser/msal/nodeFlows/msalPlugins.js.map +0 -1
- package/dist/browser/regionalAuthority.d.ts +0 -122
- package/dist/browser/regionalAuthority.d.ts.map +0 -1
- package/dist/browser/regionalAuthority.js +0 -139
- package/dist/browser/regionalAuthority.js.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/certificatesUtils.d.ts +0 -13
- package/dist/browser/util/certificatesUtils.d.ts.map +0 -1
- package/dist/browser/util/certificatesUtils.js +0 -47
- package/dist/browser/util/certificatesUtils.js.map +0 -1
- package/dist/browser/util/processUtils.d.ts +0 -13
- package/dist/browser/util/processUtils.d.ts.map +0 -1
- package/dist/browser/util/processUtils.js +0 -32
- package/dist/browser/util/processUtils.js.map +0 -1
- package/dist/browser/util/subscriptionUtils.d.ts +0 -6
- package/dist/browser/util/subscriptionUtils.d.ts.map +0 -1
- package/dist/browser/util/subscriptionUtils.js +0 -16
- package/dist/browser/util/subscriptionUtils.js.map +0 -1
- package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
- package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
- package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js +0 -5
- package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
- package/dist/commonjs/msal/browserFlows/msalBrowserCommon.d.ts +0 -19
- package/dist/commonjs/msal/browserFlows/msalBrowserCommon.d.ts.map +0 -1
- package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js +0 -265
- package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js.map +0 -1
- package/dist/commonjs/msal/browserFlows/msalBrowserOptions.d.ts +0 -87
- package/dist/commonjs/msal/browserFlows/msalBrowserOptions.d.ts.map +0 -1
- package/dist/commonjs/msal/browserFlows/msalBrowserOptions.js +0 -5
- package/dist/commonjs/msal/browserFlows/msalBrowserOptions.js.map +0 -1
- package/dist/commonjs/msal/credentials.d.ts +0 -52
- package/dist/commonjs/msal/credentials.d.ts.map +0 -1
- package/dist/commonjs/msal/credentials.js +0 -5
- package/dist/commonjs/msal/credentials.js.map +0 -1
- package/dist/esm/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
- package/dist/esm/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
- package/dist/esm/credentials/visualStudioCodeCredentialPlugin.js +0 -4
- package/dist/esm/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
- package/dist/esm/msal/browserFlows/msalBrowserCommon.d.ts +0 -19
- package/dist/esm/msal/browserFlows/msalBrowserCommon.d.ts.map +0 -1
- package/dist/esm/msal/browserFlows/msalBrowserCommon.js +0 -261
- package/dist/esm/msal/browserFlows/msalBrowserCommon.js.map +0 -1
- package/dist/esm/msal/browserFlows/msalBrowserOptions.d.ts +0 -87
- package/dist/esm/msal/browserFlows/msalBrowserOptions.d.ts.map +0 -1
- package/dist/esm/msal/browserFlows/msalBrowserOptions.js +0 -4
- package/dist/esm/msal/browserFlows/msalBrowserOptions.js.map +0 -1
- package/dist/esm/msal/credentials.d.ts +0 -52
- package/dist/esm/msal/credentials.d.ts.map +0 -1
- package/dist/esm/msal/credentials.js +0 -4
- package/dist/esm/msal/credentials.js.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/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
- package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
- package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.js +0 -4
- package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
- package/dist/workerd/msal/browserFlows/msalBrowserCommon.d.ts +0 -19
- package/dist/workerd/msal/browserFlows/msalBrowserCommon.d.ts.map +0 -1
- package/dist/workerd/msal/browserFlows/msalBrowserCommon.js +0 -261
- package/dist/workerd/msal/browserFlows/msalBrowserCommon.js.map +0 -1
- package/dist/workerd/msal/browserFlows/msalBrowserOptions.d.ts +0 -87
- package/dist/workerd/msal/browserFlows/msalBrowserOptions.d.ts.map +0 -1
- package/dist/workerd/msal/browserFlows/msalBrowserOptions.js +0 -4
- package/dist/workerd/msal/browserFlows/msalBrowserOptions.js.map +0 -1
- package/dist/workerd/msal/credentials.d.ts +0 -52
- package/dist/workerd/msal/credentials.d.ts.map +0 -1
- package/dist/workerd/msal/credentials.js +0 -4
- package/dist/workerd/msal/credentials.js.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
- /package/dist/browser/credentials/{clientSecretCredential.d.ts → clientSecretCredential-browser.d.mts} +0 -0
- /package/dist/browser/credentials/{clientSecretCredential.js → clientSecretCredential-browser.mjs} +0 -0
- /package/dist/browser/credentials/{interactiveBrowserCredential.d.ts → interactiveBrowserCredential-browser.d.mts} +0 -0
- /package/dist/browser/credentials/{interactiveBrowserCredential.js → interactiveBrowserCredential-browser.mjs} +0 -0
- /package/dist/browser/credentials/{usernamePasswordCredential.d.ts → usernamePasswordCredential-browser.d.mts} +0 -0
- /package/dist/browser/credentials/{usernamePasswordCredential.js → usernamePasswordCredential-browser.mjs} +0 -0
- /package/dist/browser/plugins/{consumer.d.ts → consumer-browser.d.mts} +0 -0
- /package/dist/browser/plugins/{consumer.js → consumer-browser.mjs} +0 -0
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import { X509Certificate } from "crypto";
|
|
4
|
-
/**
|
|
5
|
-
* Extracts public keys from PEM certificate content
|
|
6
|
-
* @param pemData - The PEM certificate data to parse
|
|
7
|
-
* @returns Array of base64-encoded public key strings
|
|
8
|
-
*/
|
|
9
|
-
export function extractPemCertificateKeys(pemContent) {
|
|
10
|
-
const certificatePattern = /(-+BEGIN CERTIFICATE-+)(\n\r?|\r\n?)([A-Za-z0-9+/\n\r]+=*)(\n\r?|\r\n?)(-+END CERTIFICATE-+)/g;
|
|
11
|
-
const publicKeys = [];
|
|
12
|
-
// Match all possible certificates, in the order they are in the file. These will form the chain that is used for x5c
|
|
13
|
-
let match;
|
|
14
|
-
do {
|
|
15
|
-
match = certificatePattern.exec(pemContent);
|
|
16
|
-
if (match) {
|
|
17
|
-
publicKeys.push(match[3]);
|
|
18
|
-
}
|
|
19
|
-
} while (match);
|
|
20
|
-
if (publicKeys.length === 0) {
|
|
21
|
-
throw new Error("The file at the specified path does not contain a PEM-encoded certificate.");
|
|
22
|
-
}
|
|
23
|
-
return publicKeys;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Checks if PEM certificate content can be parsed as X509Certificate
|
|
27
|
-
* @param pemCert - The PEM certificate
|
|
28
|
-
* @returns true if all certificates in the PEM content can be parsed without error
|
|
29
|
-
*/
|
|
30
|
-
export function canParseAsX509Certificate(pemCert) {
|
|
31
|
-
try {
|
|
32
|
-
const pemContents = extractPemCertificateKeys(pemCert);
|
|
33
|
-
for (let i = 0; i < pemContents.length; i++) {
|
|
34
|
-
const pemContent = pemContents[i];
|
|
35
|
-
// Reconstruct the full PEM format for X509Certificate constructor
|
|
36
|
-
const fullPemCertificate = `-----BEGIN CERTIFICATE-----\n${pemContent}\n-----END CERTIFICATE-----`;
|
|
37
|
-
// Attempt to parse as X.509 certificate
|
|
38
|
-
new X509Certificate(fullPemCertificate);
|
|
39
|
-
}
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
catch (extractError) {
|
|
43
|
-
// Return false for any error (extraction or parsing)
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=certificatesUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"certificatesUtils.js","sourceRoot":"","sources":["../../../src/util/certificatesUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAAkB;IAC1D,MAAM,kBAAkB,GACtB,+FAA+F,CAAC;IAClG,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,qHAAqH;IACrH,IAAI,KAAK,CAAC;IACV,GAAG,CAAC;QACF,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,KAAK,EAAE,CAAC;YACV,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC,QAAQ,KAAK,EAAE;IAEhB,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;IAChG,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAe;IACvD,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,yBAAyB,CAAC,OAAO,CAAC,CAAC;QAEvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5C,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;YAClC,kEAAkE;YAClE,MAAM,kBAAkB,GAAG,gCAAgC,UAAU,6BAA6B,CAAC;YACnG,wCAAwC;YACxC,IAAI,eAAe,CAAC,kBAAkB,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,YAAY,EAAE,CAAC;QACtB,qDAAqD;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { X509Certificate } from \"crypto\";\n\n/**\n * Extracts public keys from PEM certificate content\n * @param pemData - The PEM certificate data to parse\n * @returns Array of base64-encoded public key strings\n */\nexport function extractPemCertificateKeys(pemContent: string): string[] {\n const certificatePattern =\n /(-+BEGIN CERTIFICATE-+)(\\n\\r?|\\r\\n?)([A-Za-z0-9+/\\n\\r]+=*)(\\n\\r?|\\r\\n?)(-+END CERTIFICATE-+)/g;\n const publicKeys: string[] = [];\n\n // Match all possible certificates, in the order they are in the file. These will form the chain that is used for x5c\n let match;\n do {\n match = certificatePattern.exec(pemContent);\n if (match) {\n publicKeys.push(match[3]);\n }\n } while (match);\n\n if (publicKeys.length === 0) {\n throw new Error(\"The file at the specified path does not contain a PEM-encoded certificate.\");\n }\n\n return publicKeys;\n}\n\n/**\n * Checks if PEM certificate content can be parsed as X509Certificate\n * @param pemCert - The PEM certificate\n * @returns true if all certificates in the PEM content can be parsed without error\n */\nexport function canParseAsX509Certificate(pemCert: string): boolean {\n try {\n const pemContents = extractPemCertificateKeys(pemCert);\n\n for (let i = 0; i < pemContents.length; i++) {\n const pemContent = pemContents[i];\n // Reconstruct the full PEM format for X509Certificate constructor\n const fullPemCertificate = `-----BEGIN CERTIFICATE-----\\n${pemContent}\\n-----END CERTIFICATE-----`;\n // Attempt to parse as X.509 certificate\n new X509Certificate(fullPemCertificate);\n }\n return true;\n } catch (extractError) {\n // Return false for any error (extraction or parsing)\n return false;\n }\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import childProcess from "node:child_process";
|
|
2
|
-
/**
|
|
3
|
-
* Easy to mock childProcess utils.
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export declare const processUtils: {
|
|
7
|
-
/**
|
|
8
|
-
* Promisifying childProcess.execFile
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
execFile(file: string, params: string[], options?: childProcess.ExecFileOptionsWithStringEncoding): Promise<string | Buffer>;
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=processUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processUtils.d.ts","sourceRoot":"","sources":["../../../src/util/processUtils.ts"],"names":[],"mappings":"AAGA,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,YAAY;IACvB;;;OAGG;mBAEK,MAAM,UACJ,MAAM,EAAE,YACN,YAAY,CAAC,iCAAiC,GACvD,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;CAiB5B,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import childProcess from "node:child_process";
|
|
4
|
-
/**
|
|
5
|
-
* Easy to mock childProcess utils.
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export const processUtils = {
|
|
9
|
-
/**
|
|
10
|
-
* Promisifying childProcess.execFile
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
execFile(file, params, options) {
|
|
14
|
-
return new Promise((resolve, reject) => {
|
|
15
|
-
childProcess.execFile(file, params, options, (error, stdout, stderr) => {
|
|
16
|
-
if (Buffer.isBuffer(stdout)) {
|
|
17
|
-
stdout = stdout.toString("utf8");
|
|
18
|
-
}
|
|
19
|
-
if (Buffer.isBuffer(stderr)) {
|
|
20
|
-
stderr = stderr.toString("utf8");
|
|
21
|
-
}
|
|
22
|
-
if (stderr || error) {
|
|
23
|
-
reject(stderr ? new Error(stderr) : error);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
resolve(stdout);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=processUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processUtils.js","sourceRoot":"","sources":["../../../src/util/processUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;;;OAGG;IACH,QAAQ,CACN,IAAY,EACZ,MAAgB,EAChB,OAAwD;QAExD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;gBACrE,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC5B,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;gBACnC,CAAC;gBACD,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC5B,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;gBACnC,CAAC;gBACD,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC;oBACpB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;gBAC7C,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,MAAM,CAAC,CAAC;gBAClB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport childProcess from \"node:child_process\";\n\n/**\n * Easy to mock childProcess utils.\n * @internal\n */\nexport const processUtils = {\n /**\n * Promisifying childProcess.execFile\n * @internal\n */\n execFile(\n file: string,\n params: string[],\n options?: childProcess.ExecFileOptionsWithStringEncoding,\n ): Promise<string | Buffer> {\n return new Promise((resolve, reject) => {\n childProcess.execFile(file, params, options, (error, stdout, stderr) => {\n if (Buffer.isBuffer(stdout)) {\n stdout = stdout.toString(\"utf8\");\n }\n if (Buffer.isBuffer(stderr)) {\n stderr = stderr.toString(\"utf8\");\n }\n if (stderr || error) {\n reject(stderr ? new Error(stderr) : error);\n } else {\n resolve(stdout);\n }\n });\n });\n },\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptionUtils.d.ts","sourceRoot":"","sources":["../../../src/util/subscriptionUtils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAUtF"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import { formatError } from "./logging.js";
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export function checkSubscription(logger, subscription) {
|
|
8
|
-
if (!subscription.match(/^[0-9a-zA-Z-._ ]+$/)) {
|
|
9
|
-
const error = new Error(`Subscription '${subscription}' contains invalid characters. If this is the name of a subscription, use ` +
|
|
10
|
-
`its ID instead. You can locate your subscription by following the instructions listed here: ` +
|
|
11
|
-
`https://learn.microsoft.com/azure/azure-portal/get-subscription-tenant-id`);
|
|
12
|
-
logger.info(formatError("", error));
|
|
13
|
-
throw error;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=subscriptionUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptionUtils.js","sourceRoot":"","sources":["../../../src/util/subscriptionUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAwB,EAAE,YAAoB;IAC9E,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,IAAI,KAAK,CACrB,iBAAiB,YAAY,4EAA4E;YACvG,8FAA8F;YAC9F,2EAA2E,CAC9E,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;QACpC,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CredentialLogger } from \"./logging.js\";\nimport { formatError } from \"./logging.js\";\n\n/**\n * @internal\n */\nexport function checkSubscription(logger: CredentialLogger, subscription: string): void {\n if (!subscription.match(/^[0-9a-zA-Z-._ ]+$/)) {\n const error = new Error(\n `Subscription '${subscription}' contains invalid characters. If this is the name of a subscription, use ` +\n `its ID instead. You can locate your subscription by following the instructions listed here: ` +\n `https://learn.microsoft.com/azure/azure-portal/get-subscription-tenant-id`,\n );\n logger.info(formatError(\"\", error));\n throw error;\n }\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A function that searches for credentials in the Visual Studio Code credential store.
|
|
3
|
-
*
|
|
4
|
-
* @returns an array of credentials (username and password)
|
|
5
|
-
* @internal
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
export type VSCodeCredentialFinder = () => Promise<Array<{
|
|
9
|
-
account: string;
|
|
10
|
-
password: string;
|
|
11
|
-
}>>;
|
|
12
|
-
//# sourceMappingURL=visualStudioCodeCredentialPlugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visualStudioCodeCredentialPlugin.d.ts","sourceRoot":"","sources":["../../../src/credentials/visualStudioCodeCredentialPlugin.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visualStudioCodeCredentialPlugin.js","sourceRoot":"","sources":["../../../src/credentials/visualStudioCodeCredentialPlugin.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * A function that searches for credentials in the Visual Studio Code credential store.\n *\n * @returns an array of credentials (username and password)\n * @internal\n *\n */\nexport type VSCodeCredentialFinder = () => Promise<Array<{ account: string; password: string }>>;\n"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { MsalBrowserFlowOptions } from "./msalBrowserOptions.js";
|
|
2
|
-
import type { AccessToken } from "@azure/core-auth";
|
|
3
|
-
import type { AuthenticationRecord } from "../types.js";
|
|
4
|
-
import type { CredentialFlowGetTokenOptions } from "../credentials.js";
|
|
5
|
-
/**
|
|
6
|
-
* Methods that are used by InteractiveBrowserCredential
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export interface MsalBrowserClient {
|
|
10
|
-
getActiveAccount(): Promise<AuthenticationRecord | undefined>;
|
|
11
|
-
getToken(scopes: string[], options: CredentialFlowGetTokenOptions): Promise<AccessToken>;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Uses MSAL Browser 2.X for browser authentication,
|
|
15
|
-
* which uses the [Auth Code Flow](https://learn.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow).
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
export declare function createMsalBrowserClient(options: MsalBrowserFlowOptions): MsalBrowserClient;
|
|
19
|
-
//# sourceMappingURL=msalBrowserCommon.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"msalBrowserCommon.d.ts","sourceRoot":"","sources":["../../../../src/msal/browserFlows/msalBrowserCommon.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAYtE,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAc,MAAM,aAAa,CAAC;AAEpE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AA8CvE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,IAAI,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAC;IAC9D,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAC1F;AAKD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,sBAAsB,GAAG,iBAAiB,CAyP1F"}
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT License.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.createMsalBrowserClient = createMsalBrowserClient;
|
|
6
|
-
const tslib_1 = require("tslib");
|
|
7
|
-
const msalBrowser = tslib_1.__importStar(require("@azure/msal-browser"));
|
|
8
|
-
const utils_js_1 = require("../utils.js");
|
|
9
|
-
const errors_js_1 = require("../../errors.js");
|
|
10
|
-
const logger_1 = require("@azure/logger");
|
|
11
|
-
const logging_js_1 = require("../../util/logging.js");
|
|
12
|
-
const tenantIdUtils_js_1 = require("../../util/tenantIdUtils.js");
|
|
13
|
-
const constants_js_1 = require("../../constants.js");
|
|
14
|
-
// We keep a copy of the redirect hash.
|
|
15
|
-
// Check if self and location object is defined.
|
|
16
|
-
const isLocationDefined = typeof self !== "undefined" && self.location !== undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Generates a MSAL configuration that generally works for browsers
|
|
19
|
-
*/
|
|
20
|
-
function generateMsalBrowserConfiguration(options) {
|
|
21
|
-
const tenantId = options.tenantId || constants_js_1.DefaultTenantId;
|
|
22
|
-
const authority = (0, utils_js_1.getAuthority)(tenantId, options.authorityHost);
|
|
23
|
-
return {
|
|
24
|
-
auth: {
|
|
25
|
-
clientId: options.clientId,
|
|
26
|
-
authority,
|
|
27
|
-
knownAuthorities: (0, utils_js_1.getKnownAuthorities)(tenantId, authority, options.disableInstanceDiscovery),
|
|
28
|
-
// If the users picked redirect as their login style,
|
|
29
|
-
// but they didn't provide a redirectUri,
|
|
30
|
-
// we can try to use the current page we're in as a default value.
|
|
31
|
-
redirectUri: options.redirectUri || (isLocationDefined ? self.location.origin : undefined),
|
|
32
|
-
},
|
|
33
|
-
cache: {
|
|
34
|
-
cacheLocation: "sessionStorage",
|
|
35
|
-
storeAuthStateInCookie: true, // Set to true to improve the experience on IE11 and Edge.
|
|
36
|
-
},
|
|
37
|
-
system: {
|
|
38
|
-
loggerOptions: {
|
|
39
|
-
loggerCallback: (0, utils_js_1.defaultLoggerCallback)(options.logger, "Browser"),
|
|
40
|
-
logLevel: (0, utils_js_1.getMSALLogLevel)((0, logger_1.getLogLevel)()),
|
|
41
|
-
piiLoggingEnabled: options.loggingOptions?.enableUnsafeSupportLogging,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
// We keep a copy of the redirect hash.
|
|
47
|
-
const redirectHash = isLocationDefined ? self.location.hash : undefined;
|
|
48
|
-
/**
|
|
49
|
-
* Uses MSAL Browser 2.X for browser authentication,
|
|
50
|
-
* which uses the [Auth Code Flow](https://learn.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow).
|
|
51
|
-
* @internal
|
|
52
|
-
*/
|
|
53
|
-
function createMsalBrowserClient(options) {
|
|
54
|
-
const loginStyle = options.loginStyle;
|
|
55
|
-
if (!options.clientId) {
|
|
56
|
-
throw new errors_js_1.CredentialUnavailableError("A client ID is required in browsers");
|
|
57
|
-
}
|
|
58
|
-
const clientId = options.clientId;
|
|
59
|
-
const logger = options.logger;
|
|
60
|
-
const tenantId = (0, tenantIdUtils_js_1.resolveTenantId)(logger, options.tenantId, options.clientId);
|
|
61
|
-
const additionallyAllowedTenantIds = (0, tenantIdUtils_js_1.resolveAdditionallyAllowedTenantIds)(options?.tokenCredentialOptions?.additionallyAllowedTenants);
|
|
62
|
-
const authorityHost = options.authorityHost;
|
|
63
|
-
const msalConfig = generateMsalBrowserConfiguration(options);
|
|
64
|
-
const disableAutomaticAuthentication = options.disableAutomaticAuthentication;
|
|
65
|
-
const loginHint = options.loginHint;
|
|
66
|
-
let account;
|
|
67
|
-
if (options.authenticationRecord) {
|
|
68
|
-
account = {
|
|
69
|
-
...options.authenticationRecord,
|
|
70
|
-
tenantId,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
// This variable should only be used through calling `getApp` function
|
|
74
|
-
let app;
|
|
75
|
-
/**
|
|
76
|
-
* Return the MSAL account if not set yet
|
|
77
|
-
* @returns MSAL application
|
|
78
|
-
*/
|
|
79
|
-
async function getApp() {
|
|
80
|
-
if (!app) {
|
|
81
|
-
// Prepare the MSAL application
|
|
82
|
-
app = await msalBrowser.PublicClientApplication.createPublicClientApplication(msalConfig);
|
|
83
|
-
// setting the account right after the app is created.
|
|
84
|
-
if (account) {
|
|
85
|
-
app.setActiveAccount((0, utils_js_1.publicToMsal)(account));
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return app;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Loads the account based on the result of the authentication.
|
|
92
|
-
* If no result was received, tries to load the account from the cache.
|
|
93
|
-
* @param result - Result object received from MSAL.
|
|
94
|
-
*/
|
|
95
|
-
async function handleBrowserResult(result) {
|
|
96
|
-
try {
|
|
97
|
-
const msalApp = await getApp();
|
|
98
|
-
if (result && result.account) {
|
|
99
|
-
logger.info(`MSAL Browser V2 authentication successful.`);
|
|
100
|
-
msalApp.setActiveAccount(result.account);
|
|
101
|
-
return (0, utils_js_1.msalToPublic)(clientId, result.account);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
catch (e) {
|
|
105
|
-
logger.info(`Failed to acquire token through MSAL. ${e.message}`);
|
|
106
|
-
}
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Handles the MSAL authentication result.
|
|
111
|
-
* If the result has an account, we update the local account reference.
|
|
112
|
-
* If the token received is invalid, an error will be thrown depending on what's missing.
|
|
113
|
-
*/
|
|
114
|
-
function handleResult(scopes, result, getTokenOptions) {
|
|
115
|
-
if (result?.account) {
|
|
116
|
-
account = (0, utils_js_1.msalToPublic)(clientId, result.account);
|
|
117
|
-
}
|
|
118
|
-
(0, utils_js_1.ensureValidMsalToken)(scopes, result, getTokenOptions);
|
|
119
|
-
logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
|
|
120
|
-
return {
|
|
121
|
-
token: result.accessToken,
|
|
122
|
-
expiresOnTimestamp: result.expiresOn.getTime(),
|
|
123
|
-
refreshAfterTimestamp: result.refreshOn?.getTime(),
|
|
124
|
-
tokenType: "Bearer",
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Uses MSAL to handle the redirect.
|
|
129
|
-
*/
|
|
130
|
-
async function handleRedirect() {
|
|
131
|
-
const msalApp = await getApp();
|
|
132
|
-
return handleBrowserResult((await msalApp.handleRedirectPromise(redirectHash)) || undefined);
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Uses MSAL to retrieve the active account.
|
|
136
|
-
*/
|
|
137
|
-
async function getActiveAccount() {
|
|
138
|
-
const msalApp = await getApp();
|
|
139
|
-
const activeAccount = msalApp.getActiveAccount();
|
|
140
|
-
if (!activeAccount) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
return (0, utils_js_1.msalToPublic)(clientId, activeAccount);
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Uses MSAL to trigger a redirect or a popup login.
|
|
147
|
-
*/
|
|
148
|
-
async function login(scopes = []) {
|
|
149
|
-
const arrayScopes = Array.isArray(scopes) ? scopes : [scopes];
|
|
150
|
-
const loginRequest = {
|
|
151
|
-
scopes: arrayScopes,
|
|
152
|
-
loginHint: loginHint,
|
|
153
|
-
};
|
|
154
|
-
const msalApp = await getApp();
|
|
155
|
-
switch (loginStyle) {
|
|
156
|
-
case "redirect": {
|
|
157
|
-
await app.loginRedirect(loginRequest);
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
case "popup":
|
|
161
|
-
return handleBrowserResult(await msalApp.loginPopup(loginRequest));
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Tries to retrieve the token silently using MSAL.
|
|
166
|
-
*/
|
|
167
|
-
async function getTokenSilent(scopes, getTokenOptions) {
|
|
168
|
-
const activeAccount = await getActiveAccount();
|
|
169
|
-
if (!activeAccount) {
|
|
170
|
-
throw new errors_js_1.AuthenticationRequiredError({
|
|
171
|
-
scopes,
|
|
172
|
-
getTokenOptions,
|
|
173
|
-
message: "Silent authentication failed. We couldn't retrieve an active account from the cache.",
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
const parameters = {
|
|
177
|
-
authority: getTokenOptions?.authority || msalConfig.auth.authority,
|
|
178
|
-
correlationId: getTokenOptions?.correlationId,
|
|
179
|
-
claims: getTokenOptions?.claims,
|
|
180
|
-
account: (0, utils_js_1.publicToMsal)(activeAccount),
|
|
181
|
-
forceRefresh: false,
|
|
182
|
-
scopes,
|
|
183
|
-
};
|
|
184
|
-
try {
|
|
185
|
-
logger.info("Attempting to acquire token silently");
|
|
186
|
-
const msalApp = await getApp();
|
|
187
|
-
const response = await msalApp.acquireTokenSilent(parameters);
|
|
188
|
-
return handleResult(scopes, response);
|
|
189
|
-
}
|
|
190
|
-
catch (err) {
|
|
191
|
-
throw (0, utils_js_1.handleMsalError)(scopes, err, options);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Attempts to retrieve the token in the browser through interactive methods.
|
|
196
|
-
*/
|
|
197
|
-
async function getTokenInteractive(scopes, getTokenOptions) {
|
|
198
|
-
const activeAccount = await getActiveAccount();
|
|
199
|
-
if (!activeAccount) {
|
|
200
|
-
throw new errors_js_1.AuthenticationRequiredError({
|
|
201
|
-
scopes,
|
|
202
|
-
getTokenOptions,
|
|
203
|
-
message: "Silent authentication failed. We couldn't retrieve an active account from the cache.",
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
const parameters = {
|
|
207
|
-
authority: getTokenOptions?.authority || msalConfig.auth.authority,
|
|
208
|
-
correlationId: getTokenOptions?.correlationId,
|
|
209
|
-
claims: getTokenOptions?.claims,
|
|
210
|
-
account: (0, utils_js_1.publicToMsal)(activeAccount),
|
|
211
|
-
loginHint: loginHint,
|
|
212
|
-
scopes,
|
|
213
|
-
};
|
|
214
|
-
const msalApp = await getApp();
|
|
215
|
-
switch (loginStyle) {
|
|
216
|
-
case "redirect":
|
|
217
|
-
// This will go out of the page.
|
|
218
|
-
// Once the InteractiveBrowserCredential is initialized again,
|
|
219
|
-
// we'll load the MSAL account in the constructor.
|
|
220
|
-
await msalApp.acquireTokenRedirect(parameters);
|
|
221
|
-
return { token: "", expiresOnTimestamp: 0, tokenType: "Bearer" };
|
|
222
|
-
case "popup":
|
|
223
|
-
return handleResult(scopes, await app.acquireTokenPopup(parameters));
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Attempts to get token through the silent flow.
|
|
228
|
-
* If failed, get token through interactive method with `doGetToken` method.
|
|
229
|
-
*/
|
|
230
|
-
async function getToken(scopes, getTokenOptions = {}) {
|
|
231
|
-
const getTokenTenantId = (0, tenantIdUtils_js_1.processMultiTenantRequest)(tenantId, getTokenOptions, additionallyAllowedTenantIds) ||
|
|
232
|
-
tenantId;
|
|
233
|
-
if (!getTokenOptions.authority) {
|
|
234
|
-
getTokenOptions.authority = (0, utils_js_1.getAuthority)(getTokenTenantId, authorityHost);
|
|
235
|
-
}
|
|
236
|
-
// We ensure that redirection is handled at this point.
|
|
237
|
-
await handleRedirect();
|
|
238
|
-
if (!(await getActiveAccount()) && !disableAutomaticAuthentication) {
|
|
239
|
-
await login(scopes);
|
|
240
|
-
}
|
|
241
|
-
// Attempts to get the token silently; else, falls back to interactive method.
|
|
242
|
-
try {
|
|
243
|
-
return await getTokenSilent(scopes, getTokenOptions);
|
|
244
|
-
}
|
|
245
|
-
catch (err) {
|
|
246
|
-
if (err.name !== "AuthenticationRequiredError") {
|
|
247
|
-
throw err;
|
|
248
|
-
}
|
|
249
|
-
if (getTokenOptions?.disableAutomaticAuthentication) {
|
|
250
|
-
throw new errors_js_1.AuthenticationRequiredError({
|
|
251
|
-
scopes,
|
|
252
|
-
getTokenOptions,
|
|
253
|
-
message: "Automatic authentication has been disabled. You may call the authenticate() method.",
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
logger.info(`Silent authentication failed, falling back to interactive method ${loginStyle}`);
|
|
257
|
-
return getTokenInteractive(scopes, getTokenOptions);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return {
|
|
261
|
-
getActiveAccount,
|
|
262
|
-
getToken,
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
//# sourceMappingURL=msalBrowserCommon.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"msalBrowserCommon.js","sourceRoot":"","sources":["../../../../src/msal/browserFlows/msalBrowserCommon.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAkFlC,0DAyPC;;AAzUD,yEAAmD;AAGnD,0CASqB;AAIrB,+CAA0F;AAE1F,0CAA4C;AAC5C,sDAAsD;AACtD,kEAIqC;AACrC,qDAAqD;AAErD,uCAAuC;AACvC,gDAAgD;AAChD,MAAM,iBAAiB,GAAG,OAAO,IAAI,KAAK,WAAW,IAAI,IAAI,CAAC,QAAQ,KAA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CAAC;QACtD,CAAC;IACH,CAAC;IACD,OAAO;QACL,gBAAgB;QAChB,QAAQ;KACT,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport * as msalBrowser from \"@azure/msal-browser\";\n\nimport type { MsalBrowserFlowOptions } from \"./msalBrowserOptions.js\";\nimport {\n defaultLoggerCallback,\n ensureValidMsalToken,\n getAuthority,\n getKnownAuthorities,\n getMSALLogLevel,\n handleMsalError,\n msalToPublic,\n publicToMsal,\n} from \"../utils.js\";\n\nimport type { AccessToken, GetTokenOptions } from \"@azure/core-auth\";\nimport type { AuthenticationRecord, MsalResult } from \"../types.js\";\nimport { AuthenticationRequiredError, CredentialUnavailableError } from \"../../errors.js\";\nimport type { CredentialFlowGetTokenOptions } from \"../credentials.js\";\nimport { getLogLevel } from \"@azure/logger\";\nimport { formatSuccess } from \"../../util/logging.js\";\nimport {\n processMultiTenantRequest,\n resolveAdditionallyAllowedTenantIds,\n resolveTenantId,\n} from \"../../util/tenantIdUtils.js\";\nimport { DefaultTenantId } from \"../../constants.js\";\n\n// We keep a copy of the redirect hash.\n// Check if self and location object is defined.\nconst isLocationDefined = typeof self !== \"undefined\" && self.location !== undefined;\n\n/**\n * Generates a MSAL configuration that generally works for browsers\n */\nfunction generateMsalBrowserConfiguration(\n options: MsalBrowserFlowOptions,\n): msalBrowser.Configuration {\n const tenantId = options.tenantId || DefaultTenantId;\n const authority = getAuthority(tenantId, options.authorityHost);\n return {\n auth: {\n clientId: options.clientId!,\n authority,\n knownAuthorities: getKnownAuthorities(tenantId, authority, options.disableInstanceDiscovery),\n // If the users picked redirect as their login style,\n // but they didn't provide a redirectUri,\n // we can try to use the current page we're in as a default value.\n redirectUri: options.redirectUri || (isLocationDefined ? self.location.origin : undefined),\n },\n cache: {\n cacheLocation: \"sessionStorage\",\n storeAuthStateInCookie: true, // Set to true to improve the experience on IE11 and Edge.\n },\n system: {\n loggerOptions: {\n loggerCallback: defaultLoggerCallback(options.logger, \"Browser\"),\n logLevel: getMSALLogLevel(getLogLevel()),\n piiLoggingEnabled: options.loggingOptions?.enableUnsafeSupportLogging,\n },\n },\n };\n}\n\n/**\n * Methods that are used by InteractiveBrowserCredential\n * @internal\n */\nexport interface MsalBrowserClient {\n getActiveAccount(): Promise<AuthenticationRecord | undefined>;\n getToken(scopes: string[], options: CredentialFlowGetTokenOptions): Promise<AccessToken>;\n}\n\n// We keep a copy of the redirect hash.\nconst redirectHash = isLocationDefined ? self.location.hash : undefined;\n\n/**\n * Uses MSAL Browser 2.X for browser authentication,\n * which uses the [Auth Code Flow](https://learn.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow).\n * @internal\n */\nexport function createMsalBrowserClient(options: MsalBrowserFlowOptions): MsalBrowserClient {\n const loginStyle = options.loginStyle;\n if (!options.clientId) {\n throw new CredentialUnavailableError(\"A client ID is required in browsers\");\n }\n const clientId = options.clientId;\n const logger = options.logger;\n const tenantId = resolveTenantId(logger, options.tenantId, options.clientId);\n const additionallyAllowedTenantIds: string[] = resolveAdditionallyAllowedTenantIds(\n options?.tokenCredentialOptions?.additionallyAllowedTenants,\n );\n const authorityHost = options.authorityHost;\n const msalConfig = generateMsalBrowserConfiguration(options);\n const disableAutomaticAuthentication = options.disableAutomaticAuthentication;\n const loginHint = options.loginHint;\n\n let account: AuthenticationRecord | undefined;\n if (options.authenticationRecord) {\n account = {\n ...options.authenticationRecord,\n tenantId,\n };\n }\n\n // This variable should only be used through calling `getApp` function\n let app: msalBrowser.IPublicClientApplication;\n /**\n * Return the MSAL account if not set yet\n * @returns MSAL application\n */\n async function getApp(): Promise<msalBrowser.IPublicClientApplication> {\n if (!app) {\n // Prepare the MSAL application\n app = await msalBrowser.PublicClientApplication.createPublicClientApplication(msalConfig);\n\n // setting the account right after the app is created.\n if (account) {\n app.setActiveAccount(publicToMsal(account));\n }\n }\n\n return app;\n }\n\n /**\n * Loads the account based on the result of the authentication.\n * If no result was received, tries to load the account from the cache.\n * @param result - Result object received from MSAL.\n */\n async function handleBrowserResult(\n result?: msalBrowser.AuthenticationResult,\n ): Promise<AuthenticationRecord | undefined> {\n try {\n const msalApp = await getApp();\n if (result && result.account) {\n logger.info(`MSAL Browser V2 authentication successful.`);\n msalApp.setActiveAccount(result.account);\n return msalToPublic(clientId, result.account);\n }\n } catch (e: any) {\n logger.info(`Failed to acquire token through MSAL. ${e.message}`);\n }\n return;\n }\n\n /**\n * Handles the MSAL authentication result.\n * If the result has an account, we update the local account reference.\n * If the token received is invalid, an error will be thrown depending on what's missing.\n */\n function handleResult(\n scopes: string | string[],\n result?: MsalResult,\n getTokenOptions?: GetTokenOptions,\n ): AccessToken {\n if (result?.account) {\n account = msalToPublic(clientId, result.account);\n }\n ensureValidMsalToken(scopes, result, getTokenOptions);\n logger.getToken.info(formatSuccess(scopes));\n return {\n token: result.accessToken,\n expiresOnTimestamp: result.expiresOn.getTime(),\n refreshAfterTimestamp: result.refreshOn?.getTime(),\n tokenType: \"Bearer\",\n };\n }\n\n /**\n * Uses MSAL to handle the redirect.\n */\n async function handleRedirect(): Promise<AuthenticationRecord | undefined> {\n const msalApp = await getApp();\n return handleBrowserResult((await msalApp.handleRedirectPromise(redirectHash)) || undefined);\n }\n\n /**\n * Uses MSAL to retrieve the active account.\n */\n async function getActiveAccount(): Promise<AuthenticationRecord | undefined> {\n const msalApp = await getApp();\n const activeAccount = msalApp.getActiveAccount();\n if (!activeAccount) {\n return;\n }\n return msalToPublic(clientId, activeAccount);\n }\n\n /**\n * Uses MSAL to trigger a redirect or a popup login.\n */\n async function login(scopes: string | string[] = []): Promise<AuthenticationRecord | undefined> {\n const arrayScopes = Array.isArray(scopes) ? scopes : [scopes];\n const loginRequest: msalBrowser.RedirectRequest = {\n scopes: arrayScopes,\n loginHint: loginHint,\n };\n const msalApp = await getApp();\n switch (loginStyle) {\n case \"redirect\": {\n await app.loginRedirect(loginRequest);\n return;\n }\n case \"popup\":\n return handleBrowserResult(await msalApp.loginPopup(loginRequest));\n }\n }\n\n /**\n * Tries to retrieve the token silently using MSAL.\n */\n async function getTokenSilent(\n scopes: string[],\n getTokenOptions?: CredentialFlowGetTokenOptions,\n ): Promise<AccessToken> {\n const activeAccount = await getActiveAccount();\n if (!activeAccount) {\n throw new AuthenticationRequiredError({\n scopes,\n getTokenOptions,\n message:\n \"Silent authentication failed. We couldn't retrieve an active account from the cache.\",\n });\n }\n\n const parameters: msalBrowser.SilentRequest = {\n authority: getTokenOptions?.authority || msalConfig.auth.authority!,\n correlationId: getTokenOptions?.correlationId,\n claims: getTokenOptions?.claims,\n account: publicToMsal(activeAccount),\n forceRefresh: false,\n scopes,\n };\n\n try {\n logger.info(\"Attempting to acquire token silently\");\n const msalApp = await getApp();\n const response = await msalApp.acquireTokenSilent(parameters);\n return handleResult(scopes, response);\n } catch (err: any) {\n throw handleMsalError(scopes, err, options);\n }\n }\n\n /**\n * Attempts to retrieve the token in the browser through interactive methods.\n */\n async function getTokenInteractive(\n scopes: string[],\n getTokenOptions?: CredentialFlowGetTokenOptions,\n ): Promise<AccessToken> {\n const activeAccount = await getActiveAccount();\n if (!activeAccount) {\n throw new AuthenticationRequiredError({\n scopes,\n getTokenOptions,\n message:\n \"Silent authentication failed. We couldn't retrieve an active account from the cache.\",\n });\n }\n\n const parameters: msalBrowser.RedirectRequest = {\n authority: getTokenOptions?.authority || msalConfig.auth.authority!,\n correlationId: getTokenOptions?.correlationId,\n claims: getTokenOptions?.claims,\n account: publicToMsal(activeAccount),\n loginHint: loginHint,\n scopes,\n };\n const msalApp = await getApp();\n switch (loginStyle) {\n case \"redirect\":\n // This will go out of the page.\n // Once the InteractiveBrowserCredential is initialized again,\n // we'll load the MSAL account in the constructor.\n\n await msalApp.acquireTokenRedirect(parameters);\n return { token: \"\", expiresOnTimestamp: 0, tokenType: \"Bearer\" };\n case \"popup\":\n return handleResult(scopes, await app.acquireTokenPopup(parameters));\n }\n }\n\n /**\n * Attempts to get token through the silent flow.\n * If failed, get token through interactive method with `doGetToken` method.\n */\n async function getToken(\n scopes: string[],\n getTokenOptions: CredentialFlowGetTokenOptions = {},\n ): Promise<AccessToken> {\n const getTokenTenantId =\n processMultiTenantRequest(tenantId, getTokenOptions, additionallyAllowedTenantIds) ||\n tenantId;\n\n if (!getTokenOptions.authority) {\n getTokenOptions.authority = getAuthority(getTokenTenantId, authorityHost);\n }\n\n // We ensure that redirection is handled at this point.\n await handleRedirect();\n\n if (!(await getActiveAccount()) && !disableAutomaticAuthentication) {\n await login(scopes);\n }\n\n // Attempts to get the token silently; else, falls back to interactive method.\n try {\n return await getTokenSilent(scopes, getTokenOptions);\n } catch (err: any) {\n if (err.name !== \"AuthenticationRequiredError\") {\n throw err;\n }\n if (getTokenOptions?.disableAutomaticAuthentication) {\n throw new AuthenticationRequiredError({\n scopes,\n getTokenOptions,\n message:\n \"Automatic authentication has been disabled. You may call the authenticate() method.\",\n });\n }\n logger.info(`Silent authentication failed, falling back to interactive method ${loginStyle}`);\n return getTokenInteractive(scopes, getTokenOptions);\n }\n }\n return {\n getActiveAccount,\n getToken,\n };\n}\n"]}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import type { AuthenticationRecord } from "../types.js";
|
|
2
|
-
import type { BrowserLoginStyle } from "../../credentials/interactiveBrowserCredentialOptions.js";
|
|
3
|
-
import type { LogPolicyOptions } from "@azure/core-rest-pipeline";
|
|
4
|
-
import type { MultiTenantTokenCredentialOptions } from "../../credentials/multiTenantTokenCredentialOptions.js";
|
|
5
|
-
import type { CredentialLogger } from "../../util/logging.js";
|
|
6
|
-
/**
|
|
7
|
-
* Options for the MSAL browser flows.
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export interface MsalBrowserFlowOptions {
|
|
11
|
-
logger: CredentialLogger;
|
|
12
|
-
/**
|
|
13
|
-
* The Client ID of the Microsoft Entra application that users will sign into.
|
|
14
|
-
* This parameter is required on the browser.
|
|
15
|
-
*/
|
|
16
|
-
clientId?: string;
|
|
17
|
-
/**
|
|
18
|
-
* The Microsoft Entra tenant (directory) ID.
|
|
19
|
-
*/
|
|
20
|
-
tenantId?: string;
|
|
21
|
-
/**
|
|
22
|
-
* The authority host to use for authentication requests.
|
|
23
|
-
* Possible values are available through {@link AzureAuthorityHosts}.
|
|
24
|
-
* The default is "https://login.microsoftonline.com".
|
|
25
|
-
*/
|
|
26
|
-
authorityHost?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Result of a previous authentication that can be used to retrieve the cached credentials of each individual account.
|
|
29
|
-
* This is necessary to provide in case the application wants to work with more than one account per
|
|
30
|
-
* Client ID and Tenant ID pair.
|
|
31
|
-
*
|
|
32
|
-
* This record can be retrieved by calling to the credential's `authenticate()` method, as follows:
|
|
33
|
-
*
|
|
34
|
-
* const authenticationRecord = await credential.authenticate();
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
authenticationRecord?: AuthenticationRecord;
|
|
38
|
-
/**
|
|
39
|
-
* Makes getToken throw if a manual authentication is necessary.
|
|
40
|
-
* Developers will need to call to `authenticate()` to control when to manually authenticate.
|
|
41
|
-
*/
|
|
42
|
-
disableAutomaticAuthentication?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* The field determines whether instance discovery is performed when attempting to authenticate.
|
|
45
|
-
* Setting this to `true` will completely disable both instance discovery and authority validation.
|
|
46
|
-
* As a result, it's crucial to ensure that the configured authority host is valid and trustworthy.
|
|
47
|
-
* This functionality is intended for use in scenarios where the metadata endpoint cannot be reached, such as in private clouds or Azure Stack.
|
|
48
|
-
* The process of instance discovery entails retrieving authority metadata from https://login.microsoft.com/ to validate the authority.
|
|
49
|
-
*/
|
|
50
|
-
disableInstanceDiscovery?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Options for multi-tenant applications which allows for additionally allowed tenants.
|
|
53
|
-
*/
|
|
54
|
-
tokenCredentialOptions: MultiTenantTokenCredentialOptions;
|
|
55
|
-
/**
|
|
56
|
-
* Gets the redirect URI of the application. This should be same as the value
|
|
57
|
-
* in the application registration portal. Defaults to `window.location.href`.
|
|
58
|
-
* This field is no longer required for Node.js.
|
|
59
|
-
*/
|
|
60
|
-
redirectUri?: string;
|
|
61
|
-
/**
|
|
62
|
-
* Specifies whether a redirect or a popup window should be used to
|
|
63
|
-
* initiate the user authentication flow. Possible values are "redirect"
|
|
64
|
-
* or "popup" (default) for browser and "popup" (default) for node.
|
|
65
|
-
*
|
|
66
|
-
*/
|
|
67
|
-
loginStyle: BrowserLoginStyle;
|
|
68
|
-
/**
|
|
69
|
-
* loginHint allows a user name to be pre-selected for interactive logins.
|
|
70
|
-
* Setting this option skips the account selection prompt and immediately attempts to login with the specified account.
|
|
71
|
-
*/
|
|
72
|
-
loginHint?: string;
|
|
73
|
-
/**
|
|
74
|
-
* Allows users to configure settings for logging policy options, allow logging account information and personally identifiable information for customer support.
|
|
75
|
-
*/
|
|
76
|
-
loggingOptions?: LogPolicyOptions & {
|
|
77
|
-
/**
|
|
78
|
-
* Allows logging account information once the authentication flow succeeds.
|
|
79
|
-
*/
|
|
80
|
-
allowLoggingAccountIdentifiers?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Allows logging personally identifiable information for customer support.
|
|
83
|
-
*/
|
|
84
|
-
enableUnsafeSupportLogging?: boolean;
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=msalBrowserOptions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"msalBrowserOptions.d.ts","sourceRoot":"","sources":["../../../../src/msal/browserFlows/msalBrowserOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0DAA0D,CAAC;AAClG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wDAAwD,CAAC;AAChH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,gBAAgB,CAAC;IAEzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;;;;;OASG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAE5C;;;OAGG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;IAEzC;;;;;;OAMG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;OAEG;IACH,sBAAsB,EAAE,iCAAiC,CAAC;IAE1D;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,UAAU,EAAE,iBAAiB,CAAC;IAE9B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,gBAAgB,GAAG;QAClC;;WAEG;QACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;QACzC;;WAEG;QACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;KACtC,CAAC;CACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"msalBrowserOptions.js","sourceRoot":"","sources":["../../../../src/msal/browserFlows/msalBrowserOptions.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AuthenticationRecord } from \"../types.js\";\nimport type { BrowserLoginStyle } from \"../../credentials/interactiveBrowserCredentialOptions.js\";\nimport type { LogPolicyOptions } from \"@azure/core-rest-pipeline\";\nimport type { MultiTenantTokenCredentialOptions } from \"../../credentials/multiTenantTokenCredentialOptions.js\";\nimport type { CredentialLogger } from \"../../util/logging.js\";\n\n/**\n * Options for the MSAL browser flows.\n * @internal\n */\nexport interface MsalBrowserFlowOptions {\n logger: CredentialLogger;\n\n /**\n * The Client ID of the Microsoft Entra application that users will sign into.\n * This parameter is required on the browser.\n */\n clientId?: string;\n\n /**\n * The Microsoft Entra tenant (directory) ID.\n */\n tenantId?: string;\n\n /**\n * The authority host to use for authentication requests.\n * Possible values are available through {@link AzureAuthorityHosts}.\n * The default is \"https://login.microsoftonline.com\".\n */\n authorityHost?: string;\n\n /**\n * Result of a previous authentication that can be used to retrieve the cached credentials of each individual account.\n * This is necessary to provide in case the application wants to work with more than one account per\n * Client ID and Tenant ID pair.\n *\n * This record can be retrieved by calling to the credential's `authenticate()` method, as follows:\n *\n * const authenticationRecord = await credential.authenticate();\n *\n */\n authenticationRecord?: AuthenticationRecord;\n\n /**\n * Makes getToken throw if a manual authentication is necessary.\n * Developers will need to call to `authenticate()` to control when to manually authenticate.\n */\n disableAutomaticAuthentication?: boolean;\n\n /**\n * The field determines whether instance discovery is performed when attempting to authenticate.\n * Setting this to `true` will completely disable both instance discovery and authority validation.\n * As a result, it's crucial to ensure that the configured authority host is valid and trustworthy.\n * This functionality is intended for use in scenarios where the metadata endpoint cannot be reached, such as in private clouds or Azure Stack.\n * The process of instance discovery entails retrieving authority metadata from https://login.microsoft.com/ to validate the authority.\n */\n disableInstanceDiscovery?: boolean;\n\n /**\n * Options for multi-tenant applications which allows for additionally allowed tenants.\n */\n tokenCredentialOptions: MultiTenantTokenCredentialOptions;\n\n /**\n * Gets the redirect URI of the application. This should be same as the value\n * in the application registration portal. Defaults to `window.location.href`.\n * This field is no longer required for Node.js.\n */\n redirectUri?: string;\n\n /**\n * Specifies whether a redirect or a popup window should be used to\n * initiate the user authentication flow. Possible values are \"redirect\"\n * or \"popup\" (default) for browser and \"popup\" (default) for node.\n *\n */\n loginStyle: BrowserLoginStyle;\n\n /**\n * loginHint allows a user name to be pre-selected for interactive logins.\n * Setting this option skips the account selection prompt and immediately attempts to login with the specified account.\n */\n loginHint?: string;\n\n /**\n * Allows users to configure settings for logging policy options, allow logging account information and personally identifiable information for customer support.\n */\n loggingOptions?: LogPolicyOptions & {\n /**\n * Allows logging account information once the authentication flow succeeds.\n */\n allowLoggingAccountIdentifiers?: boolean;\n /**\n * Allows logging personally identifiable information for customer support.\n */\n enableUnsafeSupportLogging?: boolean;\n };\n}\n"]}
|