Skip to content

Add Cloudflare Zero Trust service token support#12

Open
romainfrayssinet wants to merge 2 commits intonewmaterialco:mainfrom
romainfrayssinet:feature/cloudflare-zero-trust
Open

Add Cloudflare Zero Trust service token support#12
romainfrayssinet wants to merge 2 commits intonewmaterialco:mainfrom
romainfrayssinet:feature/cloudflare-zero-trust

Conversation

@romainfrayssinet
Copy link

Summary

  • Adds CF-Access-Client-ID and CF-Access-Client-Secret HTTP headers to the WebSocket upgrade request when Cloudflare Zero Trust credentials are configured
  • Credentials are stored securely in the Keychain, consistent with the existing gateway token pattern
  • Settings UI includes a new Cloudflare Zero Trust section with an enable/disable toggle that collapses the credential fields when inactive

How it works

Cloudflare Access requires service token headers to be present in the initial HTTP upgrade request — they cannot be sent after the WebSocket connection is established. Switching from webSocketTask(with: URL) to webSocketTask(with: URLRequest) allows injecting these headers at the right moment.

The feature is fully opt-in: leaving the toggle off keeps the existing behaviour unchanged.

Injects CF-Access-Client-ID and CF-Access-Client-Secret headers at
WebSocket upgrade time when configured. Credentials stored in Keychain.
Settings UI includes a toggle to enable/disable with animated fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant