@cloudflare/workers-auth 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cf/index.d.mts +4 -4
- package/dist/cf/index.mjs +13 -3
- package/dist/{chunk-NDZDTP46.mjs → chunk-2K52M2W5.mjs} +99 -62
- package/dist/{chunk-PGZZHNWG.mjs → chunk-F2REEYJC.mjs} +4 -2
- package/dist/{file-format-DDVG6IGi.d.mts → file-format-DLf_MRuS.d.mts} +5 -1
- package/dist/index.d.mts +6 -7
- package/dist/index.mjs +1 -1
- package/dist/{keyring-preference-DCQufwLw.d.mts → keyring-preference-DIwv0hwY.d.mts} +3 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/wrangler/index.d.mts +2 -2
- package/dist/wrangler/index.mjs +3 -2
- package/package.json +2 -2
package/dist/cf/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as ConfigStorage, A as AuthConfigStorage, U as UserAuthConfig, f as OAuthFlowContext, g as ProfileStore } from '../file-format-
|
|
2
|
-
import { C as CliDescriptor, A as AuthContext, a as CloudflareAuth, U as UserPreferences, K as KeyringPreferenceContext, S as SetKeyringPreferenceResult } from '../keyring-preference-
|
|
3
|
-
export { b as CloudflareLoginProps } from '../keyring-preference-
|
|
1
|
+
import { a as ConfigStorage, A as AuthConfigStorage, U as UserAuthConfig, f as OAuthFlowContext, g as ProfileStore } from '../file-format-DLf_MRuS.mjs';
|
|
2
|
+
import { C as CliDescriptor, A as AuthContext, a as CloudflareAuth, U as UserPreferences, K as KeyringPreferenceContext, S as SetKeyringPreferenceResult } from '../keyring-preference-DIwv0hwY.mjs';
|
|
3
|
+
export { b as CloudflareLoginProps } from '../keyring-preference-DIwv0hwY.mjs';
|
|
4
4
|
import '@cloudflare/workers-utils';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -14,7 +14,7 @@ declare const defaultAuthConfigStorage: (profile?: string) => AuthConfigStorage;
|
|
|
14
14
|
declare const readAuthConfigFile: (profile?: string) => UserAuthConfig | undefined;
|
|
15
15
|
declare const writeAuthConfigFile: (config: UserAuthConfig, profile?: string) => void;
|
|
16
16
|
|
|
17
|
-
declare const CF_CLIENT_REGISTERED_SCOPES: readonly ["access:read", "access:write", "account:read", "account_api_tokens:create", "agw:read", "agw:run", "agw:write", "ai:read", "ai:write", "ai-search:read", "ai-search:run", "ai-search:write", "aiaudit:read", "aiaudit:write", "aig:read", "aig:write", "auditlogs:read", "billing:read", "billing:write", "browser:read", "browser:write", "cfone:read", "cfone:write", "cloudchamber:write", "connectivity:admin", "connectivity:bind", "connectivity:read", "constellation:write", "containers:write", "d1:write", "dex:read", "dex:write", "dns_analytics:read", "dns_records:edit", "dns_records:read", "dns_settings:read", "email_routing:read", "email_routing:write", "email_sending:read", "email_sending:write", "firstpartytags:write", "images:read", "images:write", "lb:edit", "lb:read", "logpush:read", "logpush:write", "mcp_portals:read", "mcp_portals:write", "notebook-examples:read", "notebook-managed:read", "notification:read", "notification:write", "oauth_account_ssl_and_certificates_write", "offline", "openid", "pages:read", "pages:write", "pipelines:read", "pipelines:setup", "pipelines:write", "query_cache:write", "queues:write", "r2_catalog:write", "radar:read", "rag:read", "rag:write", "registrar:read", "registrar:write", "secrets_store:read", "secrets_store:write", "sso-connector:read", "sso-connector:write", "ssl_certs:write", "teams:pii", "teams:read", "teams:secure_location", "teams:write", "url_scanner:read", "url_scanner:write", "user:read", "vectorize:write", "workers:read", "workers:write", "workers_builds:read", "workers_builds:write", "workers_deployments:read", "workers_kv:write", "workers_observability:read", "workers_observability:write", "workers_observability_telemetry:write", "workers_routes:write", "workers_scripts:write", "workers_tail:read", "zone:read", "account-analytics.read", "account-ssl-and-certificates.write", "ssl-and-certificates.read", "ssl-and-certificates.write", "registrar-domains.read", "registrar-domains.admin", "logs.read", "logs.write", "websearch.run", "snippets.read", "snippets.write", "access-acct.read", "access-acct.revoke", "access-acct.write", "access-app.read", "access-app.revoke", "access-app.write", "access-audit-log.read", "access-certificate.read", "access-certificate.write", "access-custom-page.read", "access-custom-page.write", "access-device-posture.read", "access-device-posture.write", "access-group.read", "access-group.write", "access-idp.read", "access-idp.write", "access-key.read", "access-key.write", "access-org.read", "access-org.revoke", "access-org.write", "access-policy-test.read", "access-policy-test.write", "access-policy.read", "access-policy.write", "access-population.read", "access-population.write", "access-saml-certificate.read", "access-saml-certificate.write", "access-scim-log.read", "access-seats.write", "access-service-token.read", "access-service-token.write", "access-ssh-auditing.read", "access-ssh-auditing.write", "access-tag.read", "access-tag.write", "access-users.read", "access-users.write", "access.read", "access.revoke", "access.write", "account-api-gateway.read", "account-api-gateway.write", "account-custom-asset.read", "account-custom-asset.write", "account-custom-error-rules.read", "account-custom-error-rules.write", "account-custom-pages.read", "account-custom-pages.write", "account-disable-esc.read", "account-disable-esc.write", "account-dns-settings.read", "account-dns-settings.write", "account-firewall-access-rules.read", "account-firewall-access-rules.write", "account-logs.read", "account-logs.write", "account-rule-lists.read", "account-rule-lists.write", "account-rulesets.read", "account-rulesets.write", "account-security-center-insights.read", "account-security-center-insights.write", "account-settings.read", "account-settings.write", "account-ssl-and-certificates.read", "account-waf.read", "account-waf.write", "account-waiting-rooms.read", "address-maps.read", "address-maps.write", "agent-memory.write", "agw.read", "agw.run", "agw.write", "ai-search.index", "ai-search.metadata_read", "ai-search.read", "ai-search.run", "ai-search.write", "ai.read", "ai.write", "aiaudit.read", "aiaudit.write", "aig.metadata_read", "aig.read", "aig.run", "aig.write", "analytics.read", "api-gateway.read", "api-gateway.write", "apps.write", "argotunnel.read", "argotunnel.write", "artifacts.read", "artifacts.write", "bot-management-feedback.read", "bot-management-feedback.write", "bot-management.read", "bot-management.write", "browser-rendering.read", "browser-rendering.write", "cache-settings.read", "cache-settings.write", "cache.purge", "calls.read", "calls.write", "casb.read", "casb.write", "cf-agents.read", "cf-agents.write", "challenge-widgets.read", "challenge-widgets.write", "chinanetwork-steering.read", "chinanetwork-steering.write", "cloud-connector.read", "cloud-connector.write", "cloud-email-security.read", "cloud-email-security.write", "cloudchamber.read", "cloudchamber.write", "cloudforce-one.read", "cloudforce-one.write", "config-settings.read", "config-settings.write", "connectivity-directory.admin", "connectivity-directory.bind", "connectivity-directory.read", "constellation.read", "constellation.write", "containers.read", "containers.write", "custom-errors.read", "custom-errors.write", "custom-pages.read", "custom-pages.write", "d1.metadata_read", "d1.read", "d1.write", "ddos-botnet-feed.read", "ddos-botnet-feed.write", "ddos-protection.read", "ddos-protection.write", "dls.read", "dls.write", "dns-firewall.read", "dns-firewall.write", "dns-view.read", "dns-view.write", "dns.read", "dns.write", "domain-page-shield.read", "domain-page.shield", "dynamic-redirect.read", "dynamic-redirect.write", "email-routing-account-rule.read", "email-routing-address.read", "email-routing-address.write", "email-routing-rule.read", "email-routing-rule.write", "email-routing-suppression.read", "email-routing-suppression.write", "email-security-dmarcreports.read", "email-security-dmarcreports.write", "email-sending.read", "email-sending.write", "fbm.admin", "fbm.read", "fbm.write", "field-extractor.read", "field-extractor.write", "firewall-for-ai.read", "firewall-for-ai.write", "firewall-services.read", "firewall-services.write", "flagship.evaluate", "flagship.read", "flagship.write", "fraud-detection-pii.read", "fraud-detection.read", "fraud-detection.write", "fraud-events.write", "fraud-feedback.read", "fraud-feedback.write", "healthcheck.read", "healthcheck.write", "http-applications.read", "http-applications.write", "http-ddos-managed-ruleset.read", "http-ddos-managed-ruleset.write", "images.metadata_read", "images.read", "images.write", "integration.write", "intel.read", "intel.write", "iot.read", "iot.write", "ip-prefix-bgp-on-demand.read", "ip-prefix-bgp-on-demand.write", "ip-prefix.read", "ip-prefix.write", "k2.consume", "k2.produce", "k2.read", "k2.write", "l4-ddos-managed-ruleset.read", "l4-ddos-managed-ruleset.write", "load-balancers-account.read", "load-balancers-account.write", "load-balancers.read", "load-balancers.write", "load-balancing-monitors-and-pools.read", "load-balancing-monitors-and-pools.write", "magic-firewall.read", "magic-firewall.write", "magic-transit.read", "magic-transit.write", "magic-wan.read", "magic-wan.write", "managed-headers.read", "managed-headers.write", "mass-url-redirects.read", "mass-url-redirects.write", "mcp-portals.read", "mcp-portals.write", "memberships.read", "memberships.write", "messaging.edit", "messaging.metadata_read", "messaging.read", "moq.read", "moq.write", "notifications.read", "notifications.write", "origin.read", "origin.write", "page-rules.read", "page-rules.write", "page-shield.read", "page.read", "page.shield", "page.write", "pages.metadata_read", "payments-gateway.read", "payments-gateway.write", "pcaps-api.read", "pcaps-api.write", "pipelines.read", "pipelines.send", "pipelines.write", "precursor.read", "precursor.write", "pubsub.read", "pubsub.write", "query-cache.read", "query-cache.write", "queues.metadata_read", "queues.read", "queues.write", "r2-catalog-sql.read", "r2-catalog.read", "r2-catalog.write", "radar.read", "rag.read", "rag.run", "rag.write", "realtime.admin", "realtime.read", "realtime.write", "registrar-sandbox-domains.admin", "registrar-sandbox-domains.read", "reports-application-security-report.read", "request-tracer.read", "resource-library.read", "resource-library.write", "resource-sharing.read", "response-compression.read", "response-compression.write", "sanitize.read", "sanitize.write", "secrets-store.read", "secrets-store.write", "select-configuration.read", "select-configuration.write", "stream.metadata_read", "stream.read", "stream.write", "tag.read", "tag.write", "teams-cds-compute-account.read", "teams-cds-compute-account.write", "teams-connector-cloudflared.monitoring", "teams-connector-cloudflared.read", "teams-connector-cloudflared.write", "teams-connector-warp.read", "teams-connector-warp.write", "teams-connectors.read", "teams-connectors.write", "teams-dex.read", "teams-dex.write", "teams-networks.read", "teams-networks.write", "teams-pii.read", "teams-resilience.read", "teams-resilience.write", "teams-secure.location", "teams.read", "teams.report", "teams.write", "transform-rules.read", "transform-rules.write", "trust-and-safety.read", "trust-and-safety.write", "url-scanner.read", "url-scanner.write", "user-details.read", "user-details.write", "vectorize.read", "vectorize.write", "waiting-rooms.read", "waiting-rooms.write", "web3-hostnames.read", "web3-hostnames.write", "websearch.metadata_read", "websearch.read", "websearch.write", "workers-ci.read", "workers-ci.write", "workers-kv-storage.metadata_read", "workers-kv-storage.read", "workers-kv-storage.write", "workers-observability-telemetry.write", "workers-observability.read", "workers-observability.write", "workers-r2-bucket-item.read", "workers-r2-bucket-item.write", "workers-r2.metadata_read", "workers-r2.read", "workers-r2.write", "workers-routes.read", "workers-routes.write", "workers-scripts.bind", "workers-scripts.read", "workers-scripts.write", "workers-tail.read", "workers_ai.metadata_read", "zaraz.edit", "zaraz.read", "zaraz.write", "zone-access.read", "zone-access.revoke", "zone-access.write", "zone-custom-asset.read", "zone-custom-asset.write", "zone-disable-esc.read", "zone-disable-esc.write", "zone-dns-settings.read", "zone-dns-settings.write", "zone-observability.read", "zone-observability.write", "zone-security-center-insights.read", "zone-security-center-insights.write", "zone-settings.read", "zone-settings.write", "zone-transform-rules.read", "zone-transform-rules.write", "zone-versioning.read", "zone-versioning.write", "zone-waf.read", "zone-waf.write", "zone.read", "zone.write"];
|
|
17
|
+
declare const CF_CLIENT_REGISTERED_SCOPES: readonly ["access:read", "access:write", "account:read", "account_api_tokens:create", "agw:read", "agw:run", "agw:write", "ai:read", "ai:write", "ai-search:read", "ai-search:run", "ai-search:write", "aiaudit:read", "aiaudit:write", "aig:read", "aig:write", "auditlogs:read", "billing:read", "billing:write", "browser:read", "browser:write", "cfone:read", "cfone:write", "cloudchamber:write", "connectivity:admin", "connectivity:bind", "connectivity:read", "constellation:write", "containers:write", "d1:write", "dex:read", "dex:write", "dns_analytics:read", "dns_records:edit", "dns_records:read", "dns_settings:read", "email_routing:read", "email_routing:write", "email_sending:read", "email_sending:write", "firstpartytags:write", "hyperdrive-planetscale:setup", "images:read", "images:write", "lb:edit", "lb:read", "logpush:read", "logpush:write", "mcp_portals:read", "mcp_portals:write", "notebook-examples:read", "notebook-managed:read", "notification:read", "notification:write", "oauth_account_ssl_and_certificates_write", "offline", "openid", "pages:read", "pages:write", "pipelines:read", "pipelines:setup", "pipelines:write", "query_cache:write", "queues:write", "r2_catalog:write", "radar:read", "rag:read", "rag:write", "registrar:read", "registrar:write", "secrets_store:read", "secrets_store:write", "sso-connector:read", "sso-connector:write", "ssl_certs:write", "teams:pii", "teams:read", "teams:secure_location", "teams:write", "url_scanner:read", "url_scanner:write", "user:read", "vectorize:write", "workers:read", "workers:write", "workers_builds:read", "workers_builds:write", "workers_deployments:read", "workers_kv:write", "workers_observability:read", "workers_observability:write", "workers_observability_telemetry:write", "workers_routes:write", "workers_scripts:write", "workers_tail:read", "zone:read", "account-analytics.read", "account-ssl-and-certificates.write", "ssl-and-certificates.read", "ssl-and-certificates.write", "registrar-domains.read", "registrar-domains.admin", "logs.read", "logs.write", "websearch.run", "snippets.read", "snippets.write", "access-acct.read", "access-acct.revoke", "access-acct.write", "access-app.read", "access-app.revoke", "access-app.write", "access-audit-log.read", "access-certificate.read", "access-certificate.write", "access-custom-page.read", "access-custom-page.write", "access-device-posture.read", "access-device-posture.write", "access-group.read", "access-group.write", "access-idp.read", "access-idp.write", "access-key.read", "access-key.write", "access-org.read", "access-org.revoke", "access-org.write", "access-policy-test.read", "access-policy-test.write", "access-policy.read", "access-policy.write", "access-population.read", "access-population.write", "access-saml-certificate.read", "access-saml-certificate.write", "access-scim-log.read", "access-seats.write", "access-service-token.read", "access-service-token.write", "access-ssh-auditing.read", "access-ssh-auditing.write", "access-tag.read", "access-tag.write", "access-users.read", "access-users.write", "access.read", "access.revoke", "access.write", "account-api-gateway.read", "account-api-gateway.write", "account-custom-asset.read", "account-custom-asset.write", "account-custom-error-rules.read", "account-custom-error-rules.write", "account-custom-pages.read", "account-custom-pages.write", "account-disable-esc.read", "account-disable-esc.write", "account-dns-settings.read", "account-dns-settings.write", "account-firewall-access-rules.read", "account-firewall-access-rules.write", "account-logs.read", "account-logs.write", "account-rule-lists.read", "account-rule-lists.write", "account-rulesets.read", "account-rulesets.write", "account-security-center-insights.read", "account-security-center-insights.write", "account-settings.read", "account-settings.write", "account-ssl-and-certificates.read", "account-waf.read", "account-waf.write", "account-waiting-rooms.read", "address-maps.read", "address-maps.write", "agent-memory.write", "agw.read", "agw.run", "agw.write", "ai-search.index", "ai-search.metadata_read", "ai-search.read", "ai-search.run", "ai-search.write", "ai.read", "ai.write", "aiaudit.read", "aiaudit.write", "aig.metadata_read", "aig.read", "aig.run", "aig.write", "analytics.read", "api-gateway.read", "api-gateway.write", "apps.write", "argotunnel.read", "argotunnel.write", "artifacts.read", "artifacts.write", "bot-management-feedback.read", "bot-management-feedback.write", "bot-management.read", "bot-management.write", "browser-rendering.read", "browser-rendering.write", "cache-settings.read", "cache-settings.write", "cache.purge", "calls.read", "calls.write", "casb.read", "casb.write", "cf-agents.read", "cf-agents.write", "challenge-widgets.read", "challenge-widgets.write", "chinanetwork-steering.read", "chinanetwork-steering.write", "cloud-connector.read", "cloud-connector.write", "cloud-email-security.read", "cloud-email-security.write", "cloudchamber.read", "cloudchamber.write", "cloudforce-one.read", "cloudforce-one.write", "config-settings.read", "config-settings.write", "connectivity-directory.admin", "connectivity-directory.bind", "connectivity-directory.read", "constellation.read", "constellation.write", "containers.read", "containers.write", "custom-errors.read", "custom-errors.write", "custom-pages.read", "custom-pages.write", "d1.metadata_read", "d1.read", "d1.write", "ddos-botnet-feed.read", "ddos-botnet-feed.write", "ddos-protection.read", "ddos-protection.write", "dls.read", "dls.write", "dns-firewall.read", "dns-firewall.write", "dns-view.read", "dns-view.write", "dns.read", "dns.write", "domain-page-shield.read", "domain-page.shield", "dynamic-redirect.read", "dynamic-redirect.write", "email-routing-account-rule.read", "email-routing-address.read", "email-routing-address.write", "email-routing-rule.read", "email-routing-rule.write", "email-routing-suppression.read", "email-routing-suppression.write", "email-security-dmarcreports.read", "email-security-dmarcreports.write", "email-sending.read", "email-sending.write", "fbm.admin", "fbm.read", "fbm.write", "field-extractor.read", "field-extractor.write", "firewall-for-ai.read", "firewall-for-ai.write", "firewall-services.read", "firewall-services.write", "flagship.evaluate", "flagship.read", "flagship.write", "fraud-detection-pii.read", "fraud-detection.read", "fraud-detection.write", "fraud-events.write", "fraud-feedback.read", "fraud-feedback.write", "healthcheck.read", "healthcheck.write", "http-applications.read", "http-applications.write", "http-ddos-managed-ruleset.read", "http-ddos-managed-ruleset.write", "images.metadata_read", "images.read", "images.write", "integration.write", "intel.read", "intel.write", "iot.read", "iot.write", "ip-prefix-bgp-on-demand.read", "ip-prefix-bgp-on-demand.write", "ip-prefix.read", "ip-prefix.write", "k2.consume", "k2.produce", "k2.read", "k2.write", "l4-ddos-managed-ruleset.read", "l4-ddos-managed-ruleset.write", "load-balancers-account.read", "load-balancers-account.write", "load-balancers.read", "load-balancers.write", "load-balancing-monitors-and-pools.read", "load-balancing-monitors-and-pools.write", "magic-firewall.read", "magic-firewall.write", "magic-transit.read", "magic-transit.write", "magic-wan.read", "magic-wan.write", "managed-headers.read", "managed-headers.write", "mass-url-redirects.read", "mass-url-redirects.write", "mcp-portals.read", "mcp-portals.write", "memberships.read", "memberships.write", "messaging.edit", "messaging.metadata_read", "messaging.read", "moq.read", "moq.write", "notifications.read", "notifications.write", "origin.read", "origin.write", "page-rules.read", "page-rules.write", "page-shield.read", "page.read", "page.shield", "page.write", "pages.metadata_read", "payments-gateway.read", "payments-gateway.write", "pcaps-api.read", "pcaps-api.write", "pipelines.read", "pipelines.send", "pipelines.write", "precursor.read", "precursor.write", "pubsub.read", "pubsub.write", "query-cache.read", "query-cache.write", "queues.metadata_read", "queues.read", "queues.write", "r2-catalog-sql.read", "r2-catalog.read", "r2-catalog.write", "radar.read", "rag.read", "rag.run", "rag.write", "realtime.admin", "realtime.read", "realtime.write", "registrar-sandbox-domains.admin", "registrar-sandbox-domains.read", "reports-application-security-report.read", "request-tracer.read", "resource-library.read", "resource-library.write", "resource-sharing.read", "response-compression.read", "response-compression.write", "sanitize.read", "sanitize.write", "secrets-store.read", "secrets-store.write", "select-configuration.read", "select-configuration.write", "stream.metadata_read", "stream.read", "stream.write", "tag.read", "tag.write", "teams-cds-compute-account.read", "teams-cds-compute-account.write", "teams-connector-cloudflared.monitoring", "teams-connector-cloudflared.read", "teams-connector-cloudflared.write", "teams-connector-warp.read", "teams-connector-warp.write", "teams-connectors.read", "teams-connectors.write", "teams-dex.read", "teams-dex.write", "teams-networks.read", "teams-networks.write", "teams-pii.read", "teams-resilience.read", "teams-resilience.write", "teams-secure.location", "teams.read", "teams.report", "teams.write", "transform-rules.read", "transform-rules.write", "trust-and-safety.read", "trust-and-safety.write", "url-scanner.read", "url-scanner.write", "user-details.read", "user-details.write", "vectorize.read", "vectorize.write", "waiting-rooms.read", "waiting-rooms.write", "web3-hostnames.read", "web3-hostnames.write", "websearch.metadata_read", "websearch.read", "websearch.write", "workers-ci.read", "workers-ci.write", "workers-kv-storage.metadata_read", "workers-kv-storage.read", "workers-kv-storage.write", "workers-observability-telemetry.write", "workers-observability.read", "workers-observability.write", "workers-r2-bucket-item.read", "workers-r2-bucket-item.write", "workers-r2.metadata_read", "workers-r2.read", "workers-r2.write", "workers-routes.read", "workers-routes.write", "workers-scripts.bind", "workers-scripts.read", "workers-scripts.write", "workers-tail.read", "workers_ai.metadata_read", "zaraz.edit", "zaraz.read", "zaraz.write", "zone-access.read", "zone-access.revoke", "zone-access.write", "zone-custom-asset.read", "zone-custom-asset.write", "zone-disable-esc.read", "zone-disable-esc.write", "zone-dns-settings.read", "zone-dns-settings.write", "zone-observability.read", "zone-observability.write", "zone-security-center-insights.read", "zone-security-center-insights.write", "zone-settings.read", "zone-settings.write", "zone-transform-rules.read", "zone-transform-rules.write", "zone-versioning.read", "zone-versioning.write", "zone-waf.read", "zone-waf.write", "zone.read", "zone.write"];
|
|
18
18
|
type ClientRegisteredScope = (typeof CF_CLIENT_REGISTERED_SCOPES)[number];
|
|
19
19
|
declare const CF_REGISTERED_BUT_UNGRANTABLE_SCOPES: readonly ["billing:read", "billing:write", "email_routing:read", "email_sending:read", "notebook-managed:read", "oauth_account_ssl_and_certificates_write"];
|
|
20
20
|
type UngrantableScope = (typeof CF_REGISTERED_BUT_UNGRANTABLE_SCOPES)[number];
|
package/dist/cf/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import { createAuthConfigFileHelpers, createPreferences, createKeyringPreference, createFileStorage, createCloudflareAuth, createCloudflareProfileStore } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
2
|
+
import { createAuthConfigFileHelpers, createPreferences, createKeyringPreference, createFileStorage, createCloudflareAuth, createCloudflareProfileStore } from '../chunk-F2REEYJC.mjs';
|
|
3
|
+
import '../chunk-2K52M2W5.mjs';
|
|
4
4
|
import { __name } from '../chunk-VAZEJK55.mjs';
|
|
5
5
|
import { getEnvironmentVariableFactory, getGlobalConfigPath, getCloudflareApiEnvironmentFromEnv } from '@cloudflare/workers-utils';
|
|
6
6
|
import path from 'node:path';
|
|
@@ -77,6 +77,7 @@ var CF_CLIENT_REGISTERED_SCOPES = [
|
|
|
77
77
|
"email_sending:read",
|
|
78
78
|
"email_sending:write",
|
|
79
79
|
"firstpartytags:write",
|
|
80
|
+
"hyperdrive-planetscale:setup",
|
|
80
81
|
"images:read",
|
|
81
82
|
"images:write",
|
|
82
83
|
"lb:edit",
|
|
@@ -526,13 +527,21 @@ var CF_REGISTERED_BUT_UNGRANTABLE_SCOPES = [
|
|
|
526
527
|
"notebook-managed:read",
|
|
527
528
|
"oauth_account_ssl_and_certificates_write"
|
|
528
529
|
];
|
|
530
|
+
var CF_EXPLICIT_ONLY_SCOPES = [
|
|
531
|
+
"hyperdrive-planetscale:setup"
|
|
532
|
+
];
|
|
529
533
|
var CF_UNGRANTABLE_SCOPE_SET = new Set(
|
|
530
534
|
CF_REGISTERED_BUT_UNGRANTABLE_SCOPES
|
|
531
535
|
);
|
|
532
536
|
var CF_REQUESTABLE_SCOPES = CF_CLIENT_REGISTERED_SCOPES.filter(
|
|
533
537
|
(scope) => !CF_UNGRANTABLE_SCOPE_SET.has(scope)
|
|
534
538
|
);
|
|
535
|
-
var
|
|
539
|
+
var CF_EXPLICIT_ONLY_SCOPE_SET = new Set(
|
|
540
|
+
CF_EXPLICIT_ONLY_SCOPES
|
|
541
|
+
);
|
|
542
|
+
var DefaultScopeKeys = CF_REQUESTABLE_SCOPES.filter(
|
|
543
|
+
(scope) => !CF_EXPLICIT_ONLY_SCOPE_SET.has(scope)
|
|
544
|
+
);
|
|
536
545
|
function setLoginScopeKeys(scopes) {
|
|
537
546
|
DefaultScopeKeys = scopes;
|
|
538
547
|
}
|
|
@@ -574,6 +583,7 @@ var CF_CLI = {
|
|
|
574
583
|
displayName: CF_DISPLAY_NAME,
|
|
575
584
|
commands: {
|
|
576
585
|
login: "cf auth login",
|
|
586
|
+
logout: "cf auth logout",
|
|
577
587
|
whoami: "cf auth whoami",
|
|
578
588
|
createProfile: "cf auth create",
|
|
579
589
|
deviceLogin: "cf auth login"
|
|
@@ -254,7 +254,7 @@ See https://developers.cloudflare.com/cloudflare-one/access-controls/service-cre
|
|
|
254
254
|
);
|
|
255
255
|
if (output.error) {
|
|
256
256
|
throw new UserError(
|
|
257
|
-
|
|
257
|
+
`To use ${options.cliDisplayName} with Cloudflare Access, please install \`cloudflared\` from https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation`,
|
|
258
258
|
{ telemetryMessage: "user access missing cloudflared" }
|
|
259
259
|
);
|
|
260
260
|
}
|
|
@@ -541,7 +541,7 @@ function getCachedTemporaryPreviewAccount(storage) {
|
|
|
541
541
|
return temporaryPreviewAccount;
|
|
542
542
|
}
|
|
543
543
|
__name(getCachedTemporaryPreviewAccount, "getCachedTemporaryPreviewAccount");
|
|
544
|
-
async function requestPowSolution(temporaryAccountLogger) {
|
|
544
|
+
async function requestPowSolution(temporaryAccountLogger, cliDisplayName) {
|
|
545
545
|
const response = await fetch(getTemporaryPreviewChallengeUrl(), {
|
|
546
546
|
method: "POST",
|
|
547
547
|
headers: { "Content-Type": "application/json" },
|
|
@@ -573,7 +573,7 @@ async function requestPowSolution(temporaryAccountLogger) {
|
|
|
573
573
|
}
|
|
574
574
|
if (!Number.isInteger(k) || !Number.isInteger(g) || k <= 0 || g <= 0 || k * g > POW_MAX_ITERATIONS || Buffer.from(seed, "base64url").length !== 32) {
|
|
575
575
|
throw new FatalError(
|
|
576
|
-
|
|
576
|
+
`The proof-of-work challenge is not supported by this version of ${cliDisplayName}.`,
|
|
577
577
|
{
|
|
578
578
|
telemetryMessage: "deploy temporary account challenge difficulty unsupported"
|
|
579
579
|
}
|
|
@@ -583,8 +583,8 @@ async function requestPowSolution(temporaryAccountLogger) {
|
|
|
583
583
|
return solveChallenge({ challengeToken, seed, k, g });
|
|
584
584
|
}
|
|
585
585
|
__name(requestPowSolution, "requestPowSolution");
|
|
586
|
-
async function createTemporaryPreviewAccount(temporaryAccountLogger, request) {
|
|
587
|
-
const pow = await requestPowSolution(temporaryAccountLogger);
|
|
586
|
+
async function createTemporaryPreviewAccount(temporaryAccountLogger, request, cliDisplayName = "Wrangler") {
|
|
587
|
+
const pow = await requestPowSolution(temporaryAccountLogger, cliDisplayName);
|
|
588
588
|
const response = await fetch(getTemporaryPreviewUrl(), {
|
|
589
589
|
method: "POST",
|
|
590
590
|
headers: { "Content-Type": "application/json" },
|
|
@@ -661,7 +661,7 @@ async function getOrCreateTemporaryPreviewAccount(options) {
|
|
|
661
661
|
if (cachedPreviewAccount) {
|
|
662
662
|
if (options.request?.eventCode) {
|
|
663
663
|
throw new UserError(
|
|
664
|
-
|
|
664
|
+
`A temporary account is already cached. Rerun without --event-code to reuse it, or run \`${options.logoutCommand ?? "wrangler logout"}\` and retry to create an account for this event.`,
|
|
665
665
|
{
|
|
666
666
|
telemetryMessage: "deploy temporary event cache conflict"
|
|
667
667
|
}
|
|
@@ -680,7 +680,8 @@ async function getOrCreateTemporaryPreviewAccount(options) {
|
|
|
680
680
|
}
|
|
681
681
|
const temporaryPreviewAccount = await createTemporaryPreviewAccount(
|
|
682
682
|
options.temporaryAccountLogger,
|
|
683
|
-
options.request
|
|
683
|
+
options.request,
|
|
684
|
+
options.cliDisplayName
|
|
684
685
|
);
|
|
685
686
|
options.storage.write(temporaryPreviewAccount);
|
|
686
687
|
return { account: temporaryPreviewAccount, cached: false };
|
|
@@ -975,6 +976,7 @@ function toErrorClass(rawError, description, uri) {
|
|
|
975
976
|
return error;
|
|
976
977
|
}
|
|
977
978
|
__name(toErrorClass, "toErrorClass");
|
|
979
|
+
var TOKEN_REQUEST_TIMEOUT_MS = 3e4;
|
|
978
980
|
function isReturningFromAuthServer(query, state, logger) {
|
|
979
981
|
if (query.error) {
|
|
980
982
|
const error = Array.isArray(query.error) ? query.error[0] : query.error;
|
|
@@ -1021,7 +1023,7 @@ async function getAuthURL(scopes, clientId, redirectUri, state, generators) {
|
|
|
1021
1023
|
});
|
|
1022
1024
|
}
|
|
1023
1025
|
__name(getAuthURL, "getAuthURL");
|
|
1024
|
-
async function exchangeRefreshTokenForAccessToken(logger, isNonInteractiveOrCI2, clientId, storage) {
|
|
1026
|
+
async function exchangeRefreshTokenForAccessToken(logger, isNonInteractiveOrCI2, clientId, storage, cliDisplayName) {
|
|
1025
1027
|
const storedRefreshToken = readStoredAuthState({
|
|
1026
1028
|
warningLogger: logger,
|
|
1027
1029
|
storage
|
|
@@ -1034,7 +1036,12 @@ async function exchangeRefreshTokenForAccessToken(logger, isNonInteractiveOrCI2,
|
|
|
1034
1036
|
refresh_token: storedRefreshToken?.value ?? "",
|
|
1035
1037
|
client_id: clientId
|
|
1036
1038
|
});
|
|
1037
|
-
const response = await fetchAuthToken(
|
|
1039
|
+
const response = await fetchAuthToken(
|
|
1040
|
+
params,
|
|
1041
|
+
logger,
|
|
1042
|
+
isNonInteractiveOrCI2,
|
|
1043
|
+
cliDisplayName
|
|
1044
|
+
);
|
|
1038
1045
|
if (response.status >= 400) {
|
|
1039
1046
|
let tokenExchangeResErr = void 0;
|
|
1040
1047
|
try {
|
|
@@ -1081,7 +1088,7 @@ async function exchangeRefreshTokenForAccessToken(logger, isNonInteractiveOrCI2,
|
|
|
1081
1088
|
}
|
|
1082
1089
|
}
|
|
1083
1090
|
__name(exchangeRefreshTokenForAccessToken, "exchangeRefreshTokenForAccessToken");
|
|
1084
|
-
async function exchangeAuthCodeForAccessToken(state, logger, isNonInteractiveOrCI2, clientId, redirectUri) {
|
|
1091
|
+
async function exchangeAuthCodeForAccessToken(state, logger, isNonInteractiveOrCI2, clientId, redirectUri, cliDisplayName) {
|
|
1085
1092
|
const { authorizationCode, codeVerifier = "" } = state;
|
|
1086
1093
|
if (!codeVerifier) {
|
|
1087
1094
|
logger.warn("No code verifier is being sent.");
|
|
@@ -1095,7 +1102,12 @@ async function exchangeAuthCodeForAccessToken(state, logger, isNonInteractiveOrC
|
|
|
1095
1102
|
client_id: clientId,
|
|
1096
1103
|
code_verifier: codeVerifier
|
|
1097
1104
|
});
|
|
1098
|
-
const response = await fetchAuthToken(
|
|
1105
|
+
const response = await fetchAuthToken(
|
|
1106
|
+
params,
|
|
1107
|
+
logger,
|
|
1108
|
+
isNonInteractiveOrCI2,
|
|
1109
|
+
cliDisplayName
|
|
1110
|
+
);
|
|
1099
1111
|
if (!response.ok) {
|
|
1100
1112
|
const { error } = await getJSONFromResponse(response, logger);
|
|
1101
1113
|
if (error === "invalid_grant") {
|
|
@@ -1123,7 +1135,7 @@ async function exchangeAuthCodeForAccessToken(state, logger, isNonInteractiveOrC
|
|
|
1123
1135
|
return accessContext;
|
|
1124
1136
|
}
|
|
1125
1137
|
__name(exchangeAuthCodeForAccessToken, "exchangeAuthCodeForAccessToken");
|
|
1126
|
-
async function fetchAuthToken(body, logger, isNonInteractiveOrCI2) {
|
|
1138
|
+
async function fetchAuthToken(body, logger, isNonInteractiveOrCI2, cliDisplayName) {
|
|
1127
1139
|
const headers = {
|
|
1128
1140
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
1129
1141
|
};
|
|
@@ -1137,7 +1149,8 @@ async function fetchAuthToken(body, logger, isNonInteractiveOrCI2) {
|
|
|
1137
1149
|
);
|
|
1138
1150
|
const accessHeaders = await getCloudflareAccessHeaders({
|
|
1139
1151
|
logger,
|
|
1140
|
-
isNonInteractiveOrCI: isNonInteractiveOrCI2
|
|
1152
|
+
isNonInteractiveOrCI: isNonInteractiveOrCI2,
|
|
1153
|
+
cliDisplayName
|
|
1141
1154
|
});
|
|
1142
1155
|
Object.assign(headers, accessHeaders);
|
|
1143
1156
|
}
|
|
@@ -1146,7 +1159,8 @@ async function fetchAuthToken(body, logger, isNonInteractiveOrCI2) {
|
|
|
1146
1159
|
const response = await fetch(getTokenUrlFromEnv(), {
|
|
1147
1160
|
method: "POST",
|
|
1148
1161
|
body: body.toString(),
|
|
1149
|
-
headers
|
|
1162
|
+
headers,
|
|
1163
|
+
signal: AbortSignal.timeout(TOKEN_REQUEST_TIMEOUT_MS)
|
|
1150
1164
|
});
|
|
1151
1165
|
if (!response.ok) {
|
|
1152
1166
|
logger.debug(
|
|
@@ -1159,7 +1173,7 @@ async function fetchAuthToken(body, logger, isNonInteractiveOrCI2) {
|
|
|
1159
1173
|
} catch (e) {
|
|
1160
1174
|
logger.debug("Failed to fetch auth token:", e);
|
|
1161
1175
|
const cause = e?.cause;
|
|
1162
|
-
const code = typeof cause?.code === "string" ? ` (${cause.code})` : "";
|
|
1176
|
+
const code = e?.name === "TimeoutError" ? ` (timed out after ${TOKEN_REQUEST_TIMEOUT_MS / 1e3} seconds)` : typeof cause?.code === "string" ? ` (${cause.code})` : "";
|
|
1163
1177
|
throw new ErrorAuthServerUnreachable(
|
|
1164
1178
|
`Could not reach the Cloudflare auth server at ${getTokenUrlFromEnv()}${code}.`,
|
|
1165
1179
|
{ cause: e, telemetryMessage: "user oauth token endpoint unreachable" }
|
|
@@ -1194,6 +1208,44 @@ async function getJSONFromResponse(response, logger) {
|
|
|
1194
1208
|
__name(getJSONFromResponse, "getJSONFromResponse");
|
|
1195
1209
|
|
|
1196
1210
|
// src/callback-server.ts
|
|
1211
|
+
function renderOauthErrorPage(cliDisplayName, detail) {
|
|
1212
|
+
const escape = /* @__PURE__ */ __name((value) => value.replace(
|
|
1213
|
+
/[&<>"']/g,
|
|
1214
|
+
(character) => ({
|
|
1215
|
+
"&": "&",
|
|
1216
|
+
"<": "<",
|
|
1217
|
+
">": ">",
|
|
1218
|
+
'"': """,
|
|
1219
|
+
"'": "'"
|
|
1220
|
+
})[character]
|
|
1221
|
+
), "escape");
|
|
1222
|
+
const codeRow = detail.code ? `<p>Code: <code>${escape(detail.code)}</code></p>` : "";
|
|
1223
|
+
const descriptionRow = detail.description ? `<p class="detail">${escape(detail.description)}</p>` : "";
|
|
1224
|
+
const escapedDisplayName = escape(cliDisplayName);
|
|
1225
|
+
return esm_default`
|
|
1226
|
+
<!doctype html>
|
|
1227
|
+
<html lang="en">
|
|
1228
|
+
<head>
|
|
1229
|
+
<meta charset="utf-8" />
|
|
1230
|
+
<title>${escapedDisplayName} login failed</title>
|
|
1231
|
+
<style>
|
|
1232
|
+
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; max-width: 720px; margin: 4rem auto; padding: 0 1rem; color: #1f2933; line-height: 1.5; }
|
|
1233
|
+
h1 { color: #c12d3f; }
|
|
1234
|
+
code { background: #f5f7fa; padding: 0.15em 0.3em; border-radius: 3px; }
|
|
1235
|
+
p.detail { background: #f5f7fa; padding: 1rem; border-radius: 4px; white-space: pre-wrap; }
|
|
1236
|
+
</style>
|
|
1237
|
+
</head>
|
|
1238
|
+
<body>
|
|
1239
|
+
<h1>${escapedDisplayName} login failed</h1>
|
|
1240
|
+
<p>The Cloudflare OAuth provider returned an error.</p>
|
|
1241
|
+
${codeRow}
|
|
1242
|
+
${descriptionRow}
|
|
1243
|
+
<p>You can close this tab and return to your terminal for more details.</p>
|
|
1244
|
+
</body>
|
|
1245
|
+
</html>
|
|
1246
|
+
`;
|
|
1247
|
+
}
|
|
1248
|
+
__name(renderOauthErrorPage, "renderOauthErrorPage");
|
|
1197
1249
|
async function getOauthToken(options, state, ctx, generators) {
|
|
1198
1250
|
const urlToOpen = await getAuthURL(
|
|
1199
1251
|
options.scopes,
|
|
@@ -1235,40 +1287,8 @@ async function getOauthToken(options, state, ctx, generators) {
|
|
|
1235
1287
|
}
|
|
1236
1288
|
__name(finish, "finish");
|
|
1237
1289
|
function renderErrorPage(detail) {
|
|
1238
|
-
const escape = /* @__PURE__ */ __name((s) => s.replace(
|
|
1239
|
-
/[&<>"']/g,
|
|
1240
|
-
(c) => ({
|
|
1241
|
-
"&": "&",
|
|
1242
|
-
"<": "<",
|
|
1243
|
-
">": ">",
|
|
1244
|
-
'"': """,
|
|
1245
|
-
"'": "'"
|
|
1246
|
-
})[c]
|
|
1247
|
-
), "escape");
|
|
1248
|
-
const codeRow = detail.code ? `<p>Code: <code>${escape(detail.code)}</code></p>` : "";
|
|
1249
|
-
const descriptionRow = detail.description ? `<p class="detail">${escape(detail.description)}</p>` : "";
|
|
1250
|
-
const body = `<!doctype html>
|
|
1251
|
-
<html lang="en">
|
|
1252
|
-
<head>
|
|
1253
|
-
<meta charset="utf-8" />
|
|
1254
|
-
<title>Wrangler login failed</title>
|
|
1255
|
-
<style>
|
|
1256
|
-
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; max-width: 720px; margin: 4rem auto; padding: 0 1rem; color: #1f2933; line-height: 1.5; }
|
|
1257
|
-
h1 { color: #c12d3f; }
|
|
1258
|
-
code { background: #f5f7fa; padding: 0.15em 0.3em; border-radius: 3px; }
|
|
1259
|
-
p.detail { background: #f5f7fa; padding: 1rem; border-radius: 4px; white-space: pre-wrap; }
|
|
1260
|
-
</style>
|
|
1261
|
-
</head>
|
|
1262
|
-
<body>
|
|
1263
|
-
<h1>Wrangler login failed</h1>
|
|
1264
|
-
<p>The Cloudflare OAuth provider returned an error.</p>
|
|
1265
|
-
${codeRow}
|
|
1266
|
-
${descriptionRow}
|
|
1267
|
-
<p>You can close this tab and return to your terminal for more details.</p>
|
|
1268
|
-
</body>
|
|
1269
|
-
</html>`;
|
|
1270
1290
|
res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
|
|
1271
|
-
res.end(
|
|
1291
|
+
res.end(renderOauthErrorPage(ctx.cliDisplayName, detail));
|
|
1272
1292
|
}
|
|
1273
1293
|
__name(renderErrorPage, "renderErrorPage");
|
|
1274
1294
|
assert2(req.url, "This request doesn't have a URL");
|
|
@@ -1321,7 +1341,8 @@ async function getOauthToken(options, state, ctx, generators) {
|
|
|
1321
1341
|
ctx.logger,
|
|
1322
1342
|
ctx.isNonInteractiveOrCI,
|
|
1323
1343
|
options.clientId,
|
|
1324
|
-
options.redirectUri
|
|
1344
|
+
options.redirectUri,
|
|
1345
|
+
ctx.cliDisplayName
|
|
1325
1346
|
);
|
|
1326
1347
|
res.writeHead(307, {
|
|
1327
1348
|
Location: options.granted.url
|
|
@@ -1453,7 +1474,7 @@ async function readJson(response, logger) {
|
|
|
1453
1474
|
}
|
|
1454
1475
|
}
|
|
1455
1476
|
__name(readJson, "readJson");
|
|
1456
|
-
async function buildDeviceAuthHeaders(logger, isNonInteractiveOrCI2) {
|
|
1477
|
+
async function buildDeviceAuthHeaders(logger, isNonInteractiveOrCI2, cliDisplayName) {
|
|
1457
1478
|
const headers = {
|
|
1458
1479
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
1459
1480
|
};
|
|
@@ -1463,18 +1484,26 @@ async function buildDeviceAuthHeaders(logger, isNonInteractiveOrCI2) {
|
|
|
1463
1484
|
);
|
|
1464
1485
|
Object.assign(
|
|
1465
1486
|
headers,
|
|
1466
|
-
await getCloudflareAccessHeaders({
|
|
1487
|
+
await getCloudflareAccessHeaders({
|
|
1488
|
+
logger,
|
|
1489
|
+
isNonInteractiveOrCI: isNonInteractiveOrCI2,
|
|
1490
|
+
cliDisplayName
|
|
1491
|
+
})
|
|
1467
1492
|
);
|
|
1468
1493
|
}
|
|
1469
1494
|
return headers;
|
|
1470
1495
|
}
|
|
1471
1496
|
__name(buildDeviceAuthHeaders, "buildDeviceAuthHeaders");
|
|
1472
|
-
async function requestDeviceAuthorization(scopes, clientId, logger, isNonInteractiveOrCI2) {
|
|
1497
|
+
async function requestDeviceAuthorization(scopes, clientId, logger, isNonInteractiveOrCI2, cliDisplayName) {
|
|
1473
1498
|
const params = new URLSearchParams({
|
|
1474
1499
|
client_id: clientId,
|
|
1475
1500
|
scope: [...scopes, "offline_access"].join(" ")
|
|
1476
1501
|
});
|
|
1477
|
-
const headers = await buildDeviceAuthHeaders(
|
|
1502
|
+
const headers = await buildDeviceAuthHeaders(
|
|
1503
|
+
logger,
|
|
1504
|
+
isNonInteractiveOrCI2,
|
|
1505
|
+
cliDisplayName
|
|
1506
|
+
);
|
|
1478
1507
|
const deviceAuthUrl = getDeviceAuthUrl();
|
|
1479
1508
|
logger.debug("Fetching device authorization from", deviceAuthUrl);
|
|
1480
1509
|
const response = await fetch(deviceAuthUrl, {
|
|
@@ -1502,13 +1531,18 @@ Enable debug logging to see the full response.`,
|
|
|
1502
1531
|
return deviceAuth;
|
|
1503
1532
|
}
|
|
1504
1533
|
__name(requestDeviceAuthorization, "requestDeviceAuthorization");
|
|
1505
|
-
async function pollDeviceToken(deviceCode, clientId, logger, isNonInteractiveOrCI2) {
|
|
1534
|
+
async function pollDeviceToken(deviceCode, clientId, logger, isNonInteractiveOrCI2, cliDisplayName) {
|
|
1506
1535
|
const params = new URLSearchParams({
|
|
1507
1536
|
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
1508
1537
|
device_code: deviceCode,
|
|
1509
1538
|
client_id: clientId
|
|
1510
1539
|
});
|
|
1511
|
-
const response = await fetchAuthToken(
|
|
1540
|
+
const response = await fetchAuthToken(
|
|
1541
|
+
params,
|
|
1542
|
+
logger,
|
|
1543
|
+
isNonInteractiveOrCI2,
|
|
1544
|
+
cliDisplayName
|
|
1545
|
+
);
|
|
1512
1546
|
const body = await readJson(response, logger);
|
|
1513
1547
|
const error = getStringMember(body, "error");
|
|
1514
1548
|
if (error !== void 0) {
|
|
@@ -1547,7 +1581,8 @@ async function getOauthTokenViaDeviceFlow(options, ctx) {
|
|
|
1547
1581
|
options.scopes,
|
|
1548
1582
|
options.clientId,
|
|
1549
1583
|
logger,
|
|
1550
|
-
isNonInteractiveOrCI2
|
|
1584
|
+
isNonInteractiveOrCI2,
|
|
1585
|
+
ctx.cliDisplayName
|
|
1551
1586
|
);
|
|
1552
1587
|
const authDomain = getAuthDomainFromEnv();
|
|
1553
1588
|
assertTrustedVerificationUrl(deviceAuth.verification_uri, {
|
|
@@ -1570,7 +1605,7 @@ async function getOauthTokenViaDeviceFlow(options, ctx) {
|
|
|
1570
1605
|
);
|
|
1571
1606
|
logger.log(
|
|
1572
1607
|
esm_default`
|
|
1573
|
-
To authorize ${ctx.
|
|
1608
|
+
To authorize ${ctx.cliDisplayName}, please visit:
|
|
1574
1609
|
|
|
1575
1610
|
${deviceAuth.verification_uri}
|
|
1576
1611
|
|
|
@@ -1604,7 +1639,8 @@ Opening a link in your default browser: ${verificationUrl}`);
|
|
|
1604
1639
|
deviceAuth.device_code,
|
|
1605
1640
|
options.clientId,
|
|
1606
1641
|
logger,
|
|
1607
|
-
isNonInteractiveOrCI2
|
|
1642
|
+
isNonInteractiveOrCI2,
|
|
1643
|
+
ctx.cliDisplayName
|
|
1608
1644
|
);
|
|
1609
1645
|
} catch (e) {
|
|
1610
1646
|
logger.debug("Ignoring transient error while polling for token:", e);
|
|
@@ -1636,7 +1672,7 @@ Enable debug logging to see the full response.`,
|
|
|
1636
1672
|
continue;
|
|
1637
1673
|
case "access_denied":
|
|
1638
1674
|
throw new UserError(
|
|
1639
|
-
`Consent denied. You must grant consent to ${ctx.
|
|
1675
|
+
`Consent denied. You must grant consent to ${ctx.cliDisplayName} in order to login.
|
|
1640
1676
|
If you don't want to do this consider passing an API token via the \`CLOUDFLARE_API_TOKEN\` environment variable.`,
|
|
1641
1677
|
{ telemetryMessage: "user device-flow consent denied" }
|
|
1642
1678
|
);
|
|
@@ -1801,7 +1837,8 @@ function createOAuthFlow(ctx) {
|
|
|
1801
1837
|
ctx.logger,
|
|
1802
1838
|
ctx.isNonInteractiveOrCI,
|
|
1803
1839
|
getClientId(),
|
|
1804
|
-
storage
|
|
1840
|
+
storage,
|
|
1841
|
+
ctx.cliDisplayName
|
|
1805
1842
|
);
|
|
1806
1843
|
storage.write({
|
|
1807
1844
|
oauth_token,
|
|
@@ -1814,7 +1851,7 @@ function createOAuthFlow(ctx) {
|
|
|
1814
1851
|
ctx.logger.debug(
|
|
1815
1852
|
`Token refresh failed: ${e instanceof Error ? e.message : String(e)}`
|
|
1816
1853
|
);
|
|
1817
|
-
return e instanceof ErrorAuthServerUnreachable ? "unreachable" : "rejected";
|
|
1854
|
+
return e instanceof ErrorAuthServerUnreachable || e instanceof Error && e.name === "TimeoutError" ? "unreachable" : "rejected";
|
|
1818
1855
|
}
|
|
1819
1856
|
}
|
|
1820
1857
|
__name(refreshToken, "refreshToken");
|
|
@@ -1951,7 +1988,7 @@ function createOAuthFlow(ctx) {
|
|
|
1951
1988
|
async function activateTemporaryAccount() {
|
|
1952
1989
|
if (!ctx.temporary) {
|
|
1953
1990
|
throw new UserError(
|
|
1954
|
-
|
|
1991
|
+
`Temporary preview accounts are not supported by ${ctx.cliDisplayName}.`,
|
|
1955
1992
|
{ telemetryMessage: "user temporary account unsupported" }
|
|
1956
1993
|
);
|
|
1957
1994
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import { stringifyFile, parseFile, dedent, createCredentialStorageContext, createOAuthFlow, getAuthFromEnv, createProfileStore, validateAccountId, getCloudflareAccountIdFromEnv, getAuthConfigFilePath, getEncryptedAuthConfigFilePath, scrubEncryptedCredentials, validateProfileName, getCloudflareAuthUseKeyringFromEnv } from './chunk-
|
|
2
|
+
import { stringifyFile, parseFile, dedent, createCredentialStorageContext, createOAuthFlow, getAuthFromEnv, createProfileStore, validateAccountId, getCloudflareAccountIdFromEnv, getAuthConfigFilePath, getEncryptedAuthConfigFilePath, scrubEncryptedCredentials, validateProfileName, getCloudflareAuthUseKeyringFromEnv } from './chunk-2K52M2W5.mjs';
|
|
3
3
|
import { __name } from './chunk-VAZEJK55.mjs';
|
|
4
4
|
import { existsSync, rmSync, mkdirSync, writeFileSync, chmodSync, readFileSync as readFileSync$1, readdirSync } from 'node:fs';
|
|
5
5
|
import path3 from 'node:path';
|
|
@@ -814,7 +814,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
814
814
|
purgeOnLoginOrLogout: configCache.purgeConfigCaches,
|
|
815
815
|
clientId: descriptor.clientId,
|
|
816
816
|
consent: descriptor.consent,
|
|
817
|
-
|
|
817
|
+
cliDisplayName: descriptor.displayName,
|
|
818
818
|
deviceLoginCommand: descriptor.commands.deviceLogin,
|
|
819
819
|
redirectUri: descriptor.redirectUri,
|
|
820
820
|
storageFactory: credentialStorage.storageFactory,
|
|
@@ -827,6 +827,8 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
827
827
|
descriptor.fileFormat,
|
|
828
828
|
descriptor.getTemporaryAccountConfigPath
|
|
829
829
|
),
|
|
830
|
+
cliDisplayName: descriptor.displayName,
|
|
831
|
+
logoutCommand: descriptor.commands.logout,
|
|
830
832
|
prompt: createTemporaryTermsPrompt({
|
|
831
833
|
temporaryAccountLogger,
|
|
832
834
|
prompt: ctx.prompt
|
|
@@ -97,6 +97,10 @@ declare function generateRandomState(lengthOfState: number): string;
|
|
|
97
97
|
interface OAuthFlowTemporaryContext {
|
|
98
98
|
/** Persistence backend for the cached temporary preview account. */
|
|
99
99
|
storage: TemporaryAccountStorage;
|
|
100
|
+
/** Consumer name used in temporary-account errors. */
|
|
101
|
+
cliDisplayName?: string;
|
|
102
|
+
/** Consumer command used to clear a cached temporary account. */
|
|
103
|
+
logoutCommand?: string;
|
|
100
104
|
/**
|
|
101
105
|
* Hook to customise the terms-acceptance interactive prompt
|
|
102
106
|
* - question: the question to ask a user in interactive mode.
|
|
@@ -195,7 +199,7 @@ interface OAuthFlowContext {
|
|
|
195
199
|
* into the copy the flow prints to the user — "To authorize <name>, please
|
|
196
200
|
* visit ...". Consumer-specific, so it is required.
|
|
197
201
|
*/
|
|
198
|
-
|
|
202
|
+
cliDisplayName: string;
|
|
199
203
|
/**
|
|
200
204
|
* The command that restarts the device authorization flow (e.g.
|
|
201
205
|
* `"wrangler login --device"`), quoted when a device code is denied,
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as OAuthFlowLogger, U as UserAuthConfig, A as AuthConfigStorage, C as CredentialStore, F as FileFormat } from './file-format-
|
|
2
|
-
export { a as ConfigStorage, D as DeactivateDirectoryResult, b as DirectoryBindingOperations, c as DirectoryBindingsStorage, L as LoginOrRefreshFailureReason, d as LoginOrRefreshResult, e as LoginProps, f as OAuthFlowContext, P as ProfileConfigOperations, g as ProfileStore, T as TemporaryAccountRequest, h as TemporaryPreviewAccount, i as createOAuthFlow, j as createProfileStore, k as generateAuthUrl, l as generateRandomState, v as validateProfileName } from './file-format-
|
|
1
|
+
import { O as OAuthFlowLogger, U as UserAuthConfig, A as AuthConfigStorage, C as CredentialStore, F as FileFormat } from './file-format-DLf_MRuS.mjs';
|
|
2
|
+
export { a as ConfigStorage, D as DeactivateDirectoryResult, b as DirectoryBindingOperations, c as DirectoryBindingsStorage, L as LoginOrRefreshFailureReason, d as LoginOrRefreshResult, e as LoginProps, f as OAuthFlowContext, P as ProfileConfigOperations, g as ProfileStore, T as TemporaryAccountRequest, h as TemporaryPreviewAccount, i as createOAuthFlow, j as createProfileStore, k as generateAuthUrl, l as generateRandomState, v as validateProfileName } from './file-format-DLf_MRuS.mjs';
|
|
3
3
|
import { ApiCredentials } from '@cloudflare/workers-utils';
|
|
4
4
|
import { SpawnSyncReturns } from 'node:child_process';
|
|
5
5
|
|
|
@@ -54,11 +54,8 @@ declare function domainUsesAccess(domain: string, logger: OAuthFlowLogger, previ
|
|
|
54
54
|
* Get the headers needed to authenticate with an Access-protected domain.
|
|
55
55
|
*
|
|
56
56
|
* @param domain The hostname of the Access-protected domain (e.g. `"example.com"`).
|
|
57
|
-
* @param options
|
|
58
|
-
*
|
|
59
|
-
* optional `previewToken` that is added as the `cf_workers_preview_token`
|
|
60
|
-
* query parameter when probing for Access and when invoking `cloudflared
|
|
61
|
-
* access login`, so detection works on unpublished `<name>.workers.dev` hosts.
|
|
57
|
+
* @param options Logger, interactivity, CLI presentation, cancellation, and
|
|
58
|
+
* optional preview-token inputs for Access authentication.
|
|
62
59
|
* @returns
|
|
63
60
|
* - Service token headers (`CF-Access-Client-Id` + `CF-Access-Client-Secret`) if env vars are set
|
|
64
61
|
* - A `Cookie: CF_Authorization=...` header if obtained via `cloudflared` (interactive only)
|
|
@@ -71,6 +68,8 @@ declare function domainUsesAccess(domain: string, logger: OAuthFlowLogger, previ
|
|
|
71
68
|
declare function getAccessHeaders(domain: string, options: {
|
|
72
69
|
logger: OAuthFlowLogger;
|
|
73
70
|
isNonInteractiveOrCI?: () => boolean;
|
|
71
|
+
/** Consumer name used in actionable error messages. */
|
|
72
|
+
cliDisplayName: string;
|
|
74
73
|
/** Aborts a pending `cloudflared` authorization and kills its process. */
|
|
75
74
|
signal?: AbortSignal;
|
|
76
75
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
export { EncryptedFileCredentialStore, FileCredentialStore, LinuxSecretToolKeyProvider, MacSecurityKeyProvider, NapiKeyringKeyProvider, PINNED_KEYRING_VERSION, PKCE_CHARSET, TEMPORARY_TERMS_NOTICE, TEMPORARY_TERMS_PROMPT, clearAccessCaches, clearCredentialStorageState, createCredentialStorageContext, createOAuthFlow, createProfileStore, decryptString, domainUsesAccess, encryptString, findKeyringBinding, generateAuthUrl, generateKey, generateRandomState, generateVerificationUrl, getAccessHeaders, getAuthConfigFilePath, getAuthFromEnv, getAuthUrlFromEnv, getCloudflareAPITokenFromEnv, getCloudflareAccountIdFromEnv, getCloudflareAuthUseKeyringFromEnv, getCloudflareGlobalAuthEmailFromEnv, getCloudflareGlobalAuthKeyFromEnv, getEncryptedAuthConfigFilePath, getKeyringAccountName, getKeyringInstallDir, installKeyringBindingSync, parseEncryptedEnvelope, probeSecretTool, readStoredAuthState, resetCredentialStorageState, resolveKeyProvider, scrubEncryptedCredentials, setKeyProviderFactoryForTesting, setKeyringEntryFactory, setLinuxSecretToolRunner, setMacSecurityCommandRunner, setNpmRunner, validateProfileName } from './chunk-
|
|
2
|
+
export { EncryptedFileCredentialStore, FileCredentialStore, LinuxSecretToolKeyProvider, MacSecurityKeyProvider, NapiKeyringKeyProvider, PINNED_KEYRING_VERSION, PKCE_CHARSET, TEMPORARY_TERMS_NOTICE, TEMPORARY_TERMS_PROMPT, clearAccessCaches, clearCredentialStorageState, createCredentialStorageContext, createOAuthFlow, createProfileStore, decryptString, domainUsesAccess, encryptString, findKeyringBinding, generateAuthUrl, generateKey, generateRandomState, generateVerificationUrl, getAccessHeaders, getAuthConfigFilePath, getAuthFromEnv, getAuthUrlFromEnv, getCloudflareAPITokenFromEnv, getCloudflareAccountIdFromEnv, getCloudflareAuthUseKeyringFromEnv, getCloudflareGlobalAuthEmailFromEnv, getCloudflareGlobalAuthKeyFromEnv, getEncryptedAuthConfigFilePath, getKeyringAccountName, getKeyringInstallDir, installKeyringBindingSync, parseEncryptedEnvelope, probeSecretTool, readStoredAuthState, resetCredentialStorageState, resolveKeyProvider, scrubEncryptedCredentials, setKeyProviderFactoryForTesting, setKeyringEntryFactory, setLinuxSecretToolRunner, setMacSecurityCommandRunner, setNpmRunner, validateProfileName } from './chunk-2K52M2W5.mjs';
|
|
3
3
|
import './chunk-VAZEJK55.mjs';
|
|
4
4
|
|
|
5
5
|
createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as OAuthFlowContext, m as TemporaryAccountLogger, n as OAuthConsentPages, F as FileFormat, C as CredentialStore, T as TemporaryAccountRequest, d as LoginOrRefreshResult, U as UserAuthConfig } from './file-format-
|
|
1
|
+
import { f as OAuthFlowContext, m as TemporaryAccountLogger, n as OAuthConsentPages, F as FileFormat, C as CredentialStore, T as TemporaryAccountRequest, d as LoginOrRefreshResult, U as UserAuthConfig } from './file-format-DLf_MRuS.mjs';
|
|
2
2
|
import { ApiCredentials, ComplianceConfig } from '@cloudflare/workers-utils';
|
|
3
3
|
|
|
4
4
|
/** Minimal shape of the interactive `select` prompt's options for account selection. */
|
|
@@ -63,6 +63,8 @@ interface CliDescriptor {
|
|
|
63
63
|
/** Commands surfaced in auth guidance. */
|
|
64
64
|
commands: {
|
|
65
65
|
login: string;
|
|
66
|
+
/** Command that clears cached auth state. */
|
|
67
|
+
logout: string;
|
|
66
68
|
whoami: string;
|
|
67
69
|
createProfile: string;
|
|
68
70
|
/**
|