Is it possible to use cloudflare zero trust as OIDC identity provider for self hosted…
- User
Is it possible to use cloudflare zero trust as OIDC identity provider for self hosted apps? This means we should be able to register cloudflare as IDP in the self hosted app(ie, client id, client secret, redirect uri).
Assistant
No, Cloudflare Zero Trust (specifically Cloudflare Access) cannot act as a direct OIDC Identity Provider (IdP) in the way you're describing, where your self-hosted application would initiate an OIDC flow directly with Cloudflare as the IdP, using client ID, client secret, and redirect URIs.
Here's why and how Cloudflare Zero Trust does provide identity to your applications:
Why Cloudflare Zero Trust is NOT an OIDC Identity Provider:
- Primary Function: Cloudflare Zero Trust (Access component) is primarily an access proxy and policy enforcement point, not an identity provider. It sits in front of your applications.
- Integration with IdPs: Cloudflare Access is designed to integrate with existing identity providers (like Okta, Azure AD, Google Workspace, OneLogin, PingOne, etc.) or use its own one-time PIN (OTP) system. It consumes identity from these external IdPs, rather than issuing identity itself as an OIDC IdP would.
- Missing OIDC Endpoints: A true OIDC IdP exposes standard endpoints like
/.well-known/openid-configuration,/authorize,/token,/userinfo,/jwks. Cloudflare Access does not expose these endpoints for your applications to connect to directly as an OIDC client. - No Client Registration: Cloudflare Access does not have a mechanism for you to register your self-hosted application as an OIDC client with a
client_idandclient_secretto obtain tokens directly from Cloudflare.
How Cloudflare Zero Trust Does Provide Identity to Your Applications (The Cloudflare Access Way):
Instead of being an OIDC IdP, Cloudflare Access provides identity information to your applications through HTTP headers or by allowing your application to validate its Access JWTs.
Here's the typical flow:
- User Request: A user tries to access your
self-hosted-app.example.com. - Cloudflare Intercepts: Cloudflare, acting as a reverse proxy, intercepts the request.
- Access Policy Check: Cloudflare Access checks its policies for
self-hosted-app.example.com. - User Authentication (via external IdP or OTP): If the user is not authenticated, Cloudflare Access redirects them to a Cloudflare-hosted login page. On this page, the user authenticates using the IdP you configured (e.g., Okta, Azure AD) or via an email OTP.
- CF Access JWT/Cookie Issued: Upon successful authentication, Cloudflare Access issues a signed JWT (JSON Web Token) and a session cookie to the user's browser. This JWT contains claims about the user (email, name, groups, etc.).
- Request Forwarded to Your App: The user's browser then makes the request to
self-hosted-app.example.comagain, now including the Cloudflare Access JWT/cookie. - Identity Injection: Cloudflare validates the JWT/cookie. If valid, it injects specific HTTP headers into the request before forwarding it to your
self-hosted-app's origin server.- Common headers include:
Cf-Access-Authenticated-User-Email: The user's email address.Cf-Access-Authenticated-User-ID: A unique user ID.Cf-Access-Groups: JSON array of groups the user belongs to (if configured).Cf-Access-JWT-Assertion: The full signed JWT issued by Cloudflare Access.
- Common headers include:
- Your App Consumes Headers: Your self-hosted application then reads these headers to identify the user. For instance, your app might look for
Cf-Access-Authenticated-User-Emailto know who is accessing it. - Optional JWT Validation: For higher security, your application can optionally take the
Cf-Access-JWT-Assertionheader and validate its signature using Cloudflare's public keys (retrieved fromhttps://<your-team-domain>.cloudflareaccess.com/cdn-cgi/access/certs). This ensures the identity information hasn't been tampered with.
In summary:
Cloudflare Zero Trust is an access control layer that leverages existing identity providers. It passes authenticated user identity through headers to your applications, rather than directly acting as an OIDC IdP for them to connect to.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.