The Simplest Way to Make Keycloak and Onelogin Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair keycloak and onelogin to link cloud user directories with local app logins. OneLogin stores the main company roster, while Keycloak handles tokens for internal apps. Many firms use OneLogin as their primary identity source for staff members. At the same time, developers run Keycloak to manage roles for custom services. Linking these two systems gives users one simple way to log in. Staff members use their main work login to reach internal tools and databases. You do not need to manag

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 keycloak and onelogin to link cloud user directories with local app logins. OneLogin stores the main company roster, while Keycloak handles tokens for internal apps.

Many firms use OneLogin as their primary identity source for staff members. At the same time, developers run Keycloak to manage roles for custom services. Linking these two systems gives users one simple way to log in. Staff members use their main work login to reach internal tools and databases. You do not need to manage two separate lists of user passwords.

How keycloak and onelogin share logins and roles

The link between keycloak and onelogin relies on standard web trust protocols. You set up OneLogin as an external identity provider inside your Keycloak realm. When a user visits an internal app, Keycloak asks OneLogin to check them. The user logs into OneLogin and completes a multi-factor check on their phone.

Once OneLogin confirms the user, it sends a signed message back to Keycloak. This message holds the user email, name, and current team groups. Keycloak reads this message and maps the OneLogin groups to local app roles. Then, Keycloak issues its own token so the user can open the app.

This setup keeps your main staff list inside OneLogin. When a worker leaves the company, you disable their OneLogin account once. That person can no longer get new tokens from Keycloak for internal systems. Your security team keeps control over who can log in from one dashboard.

Common failure modes and how to scope roles

Pairing these two systems often fails when group mappings grow too broad. Teams sometimes map a general staff group in OneLogin to an admin role. This mistake gives too many people full rights to production apps and databases. Another problem happens when teams use shared service accounts to bypass slow logins. Shared accounts hide who ran a bad query or changed a server setting.

Long token lifetimes also create big risks between the two login tools. If Keycloak issues tokens that last for days, cut accounts stay active. A worker cut in OneLogin might still use an old Keycloak token. You must set short token lifetimes so Keycloak checks back with OneLogin often.

OneLogin + Keycloak: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix role creep, map narrow OneLogin groups to specific Keycloak roles. Create separate roles for read tasks and write tasks in your apps. Never let a default login grant rights to run changes in production. Also, restrict network paths so only trusted traffic reaches your Keycloak admin console.

Moving beyond app logins to database and server rules

Linking your two identity tools solves the problem of web app logins. Still, engineers still need direct ways to reach databases, servers, and cloud consoles. Standard web tokens do not control what an engineer does inside a database. Once a developer logs in, they often get a broad database role. They can read private tables or run risky commands without a clear log.

Security teams need a way to link OneLogin and Keycloak identities to queries. Every command sent to a server should tie back to one real person. Teams also need a way to rewrite sensitive fields in query results. For example, masking can rewrite emails, phone numbers, card numbers, and national IDs. This step protects private records while engineers fix bugs or check live tables.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Both OpenID Connect and SAML work well to link the two tools. OpenID Connect is often simpler to set up for modern web apps. SAML works well if your team already uses it for other enterprise tools.

How do we keep user roles in sync across both systems?

Use attribute mappers inside Keycloak to read group claims sent by OneLogin. Set the mapper to update local roles every time the user logs in. This rule ensures role changes in OneLogin take effect on the next login.

What happens when a user is removed from OneLogin?

OneLogin blocks the user from starting any new login sessions right away. To stop active sessions, keep your Keycloak access token lifetimes very short. When the short token expires, Keycloak will block the user from refreshing it.

The query runs. The emails stay hidden.