The Simplest Way to Make Cloudflare Workers and Ping Identity Work Like They Should
Teams pair cloudflare workers and ping identity to check user logins at the network edge. Ping Identity issues signed tokens, and Cloudflare Workers checks those tokens before running edge code. This setup stops bad traffic early and keeps backend apps safe from unverified web requests. Edge apps read user claims from the token to allow or block specific actions right away. How cloudflare workers and ping identity share login data The flow starts when a user tries to open a protected web app
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams pair cloudflare workers and ping identity to check user logins at the network edge. Ping Identity issues signed tokens, and Cloudflare Workers checks those tokens before running edge code. This setup stops bad traffic early and keeps backend apps safe from unverified web requests. Edge apps read user claims from the token to allow or block specific actions right away.
How cloudflare workers and ping identity share login data
The flow starts when a user tries to open a protected web app or API. The browser sends the user to Ping Identity to log in with a password and MFA. Once the login succeeds, Ping Identity creates a signed JSON Web Token with user role claims. The browser then sends this token along with every request to the Cloudflare edge network.
A Worker script catches the request at the edge before it hits the origin server. The Worker fetches public keys from Ping Identity to check the digital signature on the token. It also checks the token expiration time and the target audience claim inside the payload. If the signature and claims match, the Worker reads the group roles from the token. The Worker then forwards the clean request to the backend service or runs custom edge logic.
Common token errors and how to scope edge roles
Many teams run into trouble when they use shared service accounts between these two systems. A single broad token with admin rights creates a huge risk if an attacker steals it. Another common issue happens when edge scripts check public keys on every single web request. Calling the Ping Identity key endpoint too often slows down the Worker and triggers rate limits. Teams also fail to log rejected token checks, which hides brute force attacks from security teams.
To fix these issues, scope every token in Ping Identity to the smallest possible role. Give each edge app its own client ID and limit the claims inside each token. Cache the public signing keys in edge storage so the Worker reads them fast locally. Set a short cache timer so the Worker still picks up rotated keys on time. Always send structured logs from the Worker to your central log tool for every failed check.
Ping Identity + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Keeping edge secrets and backend calls safe
Workers often need their own secrets to talk to Ping Identity APIs or backend databases. Never put client secrets or API keys inside the plain Worker script text or code repo. Store those values in encrypted edge secret stores that only the runtime can read. Rotate these secrets on a set schedule in both Ping Identity and Cloudflare at once.
When a Worker calls a backend database or internal API, limit the network path as well. Do not leave backend servers open to the public web when Workers sit in front. Lock down the origin firewall so it only accepts traffic coming from verified edge nodes. Pass the verified user ID from Ping Identity in a signed header to the backend app. This step lets the backend team see which person ran each action in their own logs.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
How does a Cloudflare Worker check a Ping Identity token?
The Worker reads the public key from Ping Identity and checks the token signature at the edge. It also checks the expiration time, issuer name, and user role claims before allowing the request.
Should a Worker fetch signing keys on every request?
No, fetching keys on every hit adds delay and can hit Ping Identity rate limits. Cache the public keys in edge storage with a short timer so checks stay fast and safe.
How do we restrict what a Worker can do with a token?
Create separate app clients in Ping Identity and limit the scopes on each issued token. Make the Worker check for specific group claims before it runs sensitive code or backend calls.
Related guides
In this post