Openid Architecture

Published
Length
3 min read

Luis Felipe Dias

All posts

An openid architecture lets apps check who a user is through a central identity provider. It works by adding an identity token on top of standard OAuth flows. Most teams set up this flow to unify logins across cloud tools and internal apps. When teams grant broad roles during login, users often gain too much system reach. How openid architecture works in practice Three main parts make up this login model. The user wants to log in, and the client app needs proof of identity. The identity provi

Zero Trust Architecture + OpenID Connect (OIDC): the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

An openid architecture lets apps check who a user is through a central identity provider. It works by adding an identity token on top of standard OAuth flows. Most teams set up this flow to unify logins across cloud tools and internal apps. When teams grant broad roles during login, users often gain too much system reach.

How openid architecture works in practice

Three main parts make up this login model. The user wants to log in, and the client app needs proof of identity. The identity provider checks the user and sends back a signed token. This setup keeps passwords out of the client app.

First, the client app sends the user to the identity provider login page. The user enters their password and passes a second factor check. Next, the provider redirects the user back to the app with a temporary code. The app trades this code for an identity token and an access token.

The identity token is a JSON object signed by the provider key. It holds claims like the user email, group names, and token life span. The client app checks the cryptographic signature against the provider public key list. Once checked, the app reads the claims and starts a local user session.

Choosing the right login flow for your apps

Web apps with a back end use the authorization code flow for safety. This flow keeps token trades on the server and away from the browser. Single-page apps and mobile apps add a proof key step to block code theft. Machine-to-machine scripts skip user login and trade client keys for access tokens.

Teams also use the user info endpoint when tokens must stay small. Instead of packing every group into the token, the app queries this endpoint. It sends the access token and gets back fresh profile data. This keeps browser cookies small and stops header size errors.

What identity tokens solve and where gaps remain

This login model solves the problem of scattered passwords across many apps. When a worker leaves the team, admins disable one account at the provider. Token checks also give apps a standard way to read user groups. Teams no longer need custom directory code inside every single web app.

Zero Trust Architecture + OpenID Connect (OIDC): architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, an identity token only proves who logged in at the start. It does not check what commands or queries a user runs after login. Once a user maps to a database role, that role keeps the session active. The token cannot block a bad query or mask a phone number in results.

Shared service roles make this gap much worse for security teams. Ten engineers might log in with their own emails and map to one admin role. Database logs then show the shared role name instead of the real person. Teams lose track of who ran a delete command during an incident.

Long token life spans also create risk during active sessions. If an admin revokes a user at the provider, existing app sessions often stay live. The app waits until the token expires before checking with the provider again. Closing this gap requires control over every action during the live session.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.

Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.

Frequently asked questions

What is the difference between OIDC and OAuth?

OAuth grants an app permission to act on a resource using an access token. OIDC adds an identity token so the app knows who the user is.

How does an app verify an identity token?

The app fetches the public keys from the identity provider discovery endpoint. It checks the token signature, the issuer name, the audience, and the expiration time.

Why do identity tokens fail to control database queries?

Identity tokens only handle the initial login handshake and group mapping. They do not inspect or filter the SQL statements a user sends after logging in.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.