You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sign in with the identity from an authenticating proxy (Cloudflare Access, IAP, ...)
#30682
We're setting up a self-hosted Twenty behind Cloudflare Access, and thanks to these changes everything works. The one gap left is sign-in. The proxy has already verified who the user is, then Twenty asks them to sign in a second time.
Proposal
When Twenty runs behind an authenticating proxy, let it trust the identity the proxy has already verified and sign the user straight in. That seems like the natural next step in this line of work.
Cloudflare Access forwards a signed JWT in the Cf-Access-Jwt-Assertion header on every request. Twenty can verify it against the team's public keys and use the email inside. Google IAP (x-goog-iap-jwt-assertion) and oauth2-proxy follow the same pattern: a signed JWT plus a JWKS URL. One generic "trusted proxy" provider could probably cover all of them.
What we tried
We built a Cloudflare-only version on our fork and checked that it works end to end behind Access. It's a quick implementation, not something we'd call production-ready, so please treat it as inspiration rather than a patch to merge:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Context
Recent releases have made Twenty much easier to run behind an identity-aware reverse proxy:
We're setting up a self-hosted Twenty behind Cloudflare Access, and thanks to these changes everything works. The one gap left is sign-in. The proxy has already verified who the user is, then Twenty asks them to sign in a second time.
Proposal
When Twenty runs behind an authenticating proxy, let it trust the identity the proxy has already verified and sign the user straight in. That seems like the natural next step in this line of work.
Cloudflare Access forwards a signed JWT in the
Cf-Access-Jwt-Assertionheader on every request. Twenty can verify it against the team's public keys and use the email inside. Google IAP (x-goog-iap-jwt-assertion) and oauth2-proxy follow the same pattern: a signed JWT plus a JWKS URL. One generic "trusted proxy" provider could probably cover all of them.What we tried
We built a Cloudflare-only version on our fork and checked that it works end to end behind Access. It's a quick implementation, not something we'd call production-ready, so please treat it as inspiration rather than a patch to merge:
Cofertility@798a6b1
In short:
CF_ACCESS_ENABLED,CF_ACCESS_TEAM_DOMAINandCF_ACCESS_AUD. It's off by default.signInWithCloudflareAccess(origin)mutation:jose, checking its signature, issuer and audience.Open questions
SSOauth provider fine, or would a separate provider value be better?All reactions