Bring your own identity provider per tenant with Keycloak organizations

Learn how to let each business customer sign in with its own Entra ID, Okta or SAML provider through Keycloak organizations, with domain routing and managed membership.

On this page

Why each tenant brings its own identity provider to Keycloak organizations

A B2B SaaS or shared-platform team often finds that its customers want to sign in with their own Microsoft Entra ID, Okta or SAML directory instead of a shared login. Keycloak organizations answer this need: each organization can have its own linked identity provider, and users are routed to it by their email domain. The Organizations feature, documented in the Keycloak server administration guide, lets you manage member organizations, their domains and the identity providers attached to them inside a single realm, so one customer's sign-in policy does not have to live in a separate deployment.

This matters most when tenants have their own corporate directories and security teams that expect control over authentication, such as MFA rules, session length or offboarding through their own IdP. It also matters when a customer's compliance review asks where sign-in decisions are made. A shared provider is usually enough when all users belong to one company, when your own directory or a single social or enterprise login covers every audience, or when tenants simply need access to the same application without their own authentication policy. In that case, organization membership and roles can carry the tenant context without a per-tenant identity provider.

Before you commit, confirm which identity providers your customers actually use, whether each one supports the protocol and attribute mappings you need, and who in your organization or the customer's will own the provider configuration after go-live. Ask whether any customer requires a dedicated realm or only a dedicated provider, since that choice changes administration, token size and upgrade effort. Verify the current organization and domain capabilities against the release you plan to run, because this area of Keycloak has changed across recent versions.

How a tenant user reaches the right identity provider

The flow starts when a user enters an email address on the Keycloak login page in the realm. Keycloak matches the email domain to a verified domain on an organization, then sends the user to that organization's linked identity provider through brokering. After the upstream provider authenticates the user, Keycloak issues its own tokens to the client application, which should check that the organization claim matches the tenant it expects. Confirm that each domain is verified and that the identity-first login setting is enabled for the organization before testing.

Identity-first login routes a user from email domain to the tenant's linked provider.

Dedicated, shared and domain-routed providers compared

A dedicated provider gives each organization its own identity provider configuration in Keycloak, pointing at that customer's Entra ID tenant, Okta org or SAML identity provider. The customer's directory team usually supplies the metadata and registers the Keycloak broker endpoint in its own environment, so trust, signing keys and claim mappings stay scoped to that tenant. The Keycloak server administration guide documents the brokering settings to review for each provider.

  • Who configures it: Your administrators create the provider and link it to the organization, but the customer's directory administrator completes the upstream registration.
  • Upstream registrations: Each tenant registers its own application in its directory, so the registration count grows with every customer.
  • Isolation: Certificates, client secrets and mappers are separate per tenant, so a change for one customer cannot affect another.
  • Leaving a tenant: Deleting the organization and its provider is a contained change in Keycloak, but the customer should remove the registration from its own directory, and you should review accounts that were linked to that provider.
  • Ongoing effort: Rotations of secrets and certificates repeat for every tenant, so count them in your operating model.

Before committing to this model, confirm how your Keycloak version scopes provider settings to an organization and estimate the onboarding steps per tenant with your own automation.

Configuration options and when each fits

This table compares the main configuration choices for linking each customer to its own identity provider in a Keycloak organization. Read each row for the fit and the trade-off, then check which options your Keycloak version exposes in its Organizations settings before you commit to a design.

Configuration choiceWhen it fitsTrade-off to weigh
OIDC providerCustomer runs Entra ID, Okta or another OpenID Connect provider and can supply a client registrationNeeds client ID, secret and redirect handling per tenant; secret rotation becomes a recurring task
SAML 2.0 providerCustomer's directory only offers SAML, or its security team requires itCertificate and metadata renewals must be tracked per tenant; attribute mapping is usually more manual
Domain linkingCustomer owns one or more email domains and wants users with those domains routed to its providerEach domain must be verified and kept unique across organizations; domain changes need admin review
Identity-first loginTenants have their own provider and users should type an email address before seeing a sign-in methodUsers with unlinked or personal addresses need a fallback path; support staff must explain the first step
Provider chooserUsers belong to several organizations or use a mix of providers and local accountsLogin page shows more options and can confuse users who expect their employer's sign-in only
Shared provider across tenantsSeveral tenants trust the same corporate directory or a provider you operate for a group of business unitsChanges affect every linked organization at once; isolation between tenants relies on membership and mappers
Dedicated provider per tenantEach customer requires its own provider settings, claim rules and audit trailHighest admin effort per onboarding and offboarding; more secrets and configurations to review and retire
Managed membership on first loginOnboarding should add a user to the organization when they first authenticate through the linked providerUsers who should not have access must be filtered at the provider or by a later review, since any domain match can join
Mapper and role syncApplication needs group, role or organization claims from the customer's directory on every sign-inStale roles persist until the next login unless the process is tested; mapper errors can grant or deny access silently

How to link a customer's identity provider to an organization

This sequence connects one customer's Entra ID, Okta or SAML provider to a Keycloak organization so that the customer's users sign in through their own directory and join the organization automatically. Each step ends with a check that confirms the link works before the next step starts.

  1. Enable the organizations feature in the realm

    Confirm that the Organizations feature is available in the realm that will host your tenants, then turn it on in the realm settings or through the deployment's feature configuration, following the server administration guide for your Keycloak version. The administrator who makes this change should also record the Keycloak version and realm name in the change ticket, since the feature's behavior is tied to the release you run. Done means the Organizations menu appears in the admin console for that realm and an empty organization list loads without errors.

  2. Create the organization and its settings

    Create the organization for the customer with its name, alias and any attributes your application needs to read later. Decide at this point whether users can be members without an invitation and whether the organization will hold one identity provider or several, because these choices shape the later steps. Done means the organization appears in the list, and an administrator can open it and see the members and identity provider tabs.

  3. Verify the customer's email domain

    Add the domains the customer uses for sign-in to the organization, then prove ownership of each one through the verification method your Keycloak version offers, which typically means the customer publishes a record or confirms control of an address on the domain. Ask the customer to confirm the exact list of domains, including any subsidiary domains, before you start, because a missing domain sends those users to the wrong login path. Done means each domain shows as verified in the organization and a test address on that domain is recognized during sign-in.

  4. Register Keycloak as an application in the customer's provider

    Ask the customer's identity team to create an application registration in their Entra ID tenant, Okta org or SAML provider, and give them the Keycloak broker redirect URI and metadata your Keycloak version generates for the identity provider. Review the redirect URI character by character against the Keycloak host, realm and alias, because a single mismatch produces an error at the provider. For SAML, check the entity ID, assertion consumer URL and signing certificate on both sides. Done means the customer returns the client ID, the secret or certificate, and the metadata URL or XML, and you can see them listed in the provider's application.

  5. Add the provider to the organization

    In Keycloak, create the identity provider with the customer's values and attach it to the organization so that users from the verified domains are routed to it. Map the claims or SAML attributes you need, such as email and name, and decide which attribute drives matching for existing accounts. Done means the provider appears under the organization's identity providers tab, its status shows as enabled, and the discovery or metadata fetch completes without errors.

  6. Configure identity-first login

    Set the realm's login flow so that the user enters an email address first, and Keycloak uses the domain to select the organization's provider. Keep a local login path available for administrators and for any user outside the verified domains, and check how the login page behaves for a domain with no provider. Done means that an address on a verified domain goes straight to the customer's sign-in page, while an address on an unrelated domain shows the standard login options.

  7. Test sign-in with a domain user

    Sign in with a test account on the customer's verified domain, ideally one created by the customer for this purpose, and confirm that the browser reaches the customer's provider, returns to Keycloak without a redirect error, and lands in the application with the expected organization claim. Repeat the test with a user who has never signed in before to check first-login account creation and attribute mapping. Log the event and token contents for both tests. Done means both sign-ins succeed and the test user appears in the organization's member list.

  8. Set managed membership and confirm removal

    Turn on managed membership for the organization so that users who sign in from a verified domain are added automatically, and confirm with the customer what happens when a user leaves their company. Test removal by disabling the test account at the provider and checking how Keycloak handles the existing session and the membership record. Done means a new domain user joins the organization without an admin action, and the customer has signed off on the offboarding behavior you observed.

Where domain routing and brokering projects fail

The most common failure in per-tenant brokering is a domain that routes to the wrong place or to nowhere. Before any identity provider is linked, confirm that each domain is verified and owned by exactly one organization. An unverified domain cannot safely drive home-realm discovery, and two organizations claiming overlapping domains (for example, a parent company and a subsidiary that share a root) produce ambiguous routing that users experience as a login loop or an unexpected landing page. Check the domain list on every organization during setup, and check again when a customer adds a subdomain. Ask each customer to prove domain control before you record it, and document who approved that record.

The second group of failures sits in the trust configuration between Keycloak and the customer's directory. A redirect URI registered at the customer's Entra ID or Okta tenant must match the broker callback URL that your Keycloak realm generates for that identity provider alias, character for character, including the hostname and the path. SAML is stricter: the entity ID, ACS URL and signing certificate in the imported metadata must match what the customer's provider holds, and a rotated signing certificate silently breaks sign-in until the metadata is refreshed. Make metadata import and a test sign-in part of the sign-off checklist, and record the certificate expiry date so the rotation has an owner.

Two failures appear after go-live. The first is an email claim that does not match the customer's domain, for example a user whose address is a personal mailbox or an alias on another domain. Domain routing keys on the email, so these users fall back to the local login or fail to link. Confirm with each customer which claim carries the email and whether it is always a verified address. The second is a user who already exists locally with the same email. Decide in advance whether the brokered login links to that account or is blocked, and test that path with a pre-existing user before the customer's staff arrive. Finally, attribute mappers that read a claim such as a department or a group will break when the customer renames or restructures its directory, so review mappers after any directory change and add a test user who exercises each mapped attribute.

Security and operational controls for tenant identity providers

Once each tenant can sign in through its own identity provider, Keycloak becomes the trust broker between customer directories and your applications. The controls below cover transport, admin exposure, token validation, domain trust, secret handling and login visibility, and each one is a setting or process you can verify before onboarding the first tenant.

TLS on every connection

Keycloak's production guide calls for TLS on all communication, including traffic between the reverse proxy and Keycloak, and between Keycloak and each upstream identity provider's metadata and token endpoints. Confirm that every tenant's metadata URL and OIDC endpoints use HTTPS, that certificate validation is not disabled on any broker, and that certificate renewal for the proxy is owned and monitored. A plaintext hop in a brokered flow exposes tenant credentials.

Production guide

Separate admin and public hostnames

Expose the admin console and Administration REST API on a different hostname or context path from public frontend URLs, and restrict paths at the reverse proxy. Tenant onboarding automation calls the Admin REST API, so this surface needs its own network rules, access logging and credentials. Check that a tenant user cannot reach admin paths through the public login hostname, and that automation tokens are scoped to the onboarding task.

Production guide

Validate backchannel logout tokens

The Keycloak 26.8 upgrade notes make signature validation of backchannel logout tokens from external providers mandatory. Before you rely on logout propagation for a tenant's Entra ID, Okta or SAML-linked provider, test that a logout token signed with the wrong key or altered claims is rejected, and that the expected issuer and audience are checked. Record the test result per provider so a provider change triggers a retest.

Upgrading guide

Trusting unverified domains

Domain routing sends a user to a provider based on the email domain they type, so a domain claimed by one organization must not be accepted for another. Require verified domain ownership before a domain is linked to an organization, and review who can add domains through delegated administration. Without this control, a tenant could claim a domain it does not own and route another company's staff into its provider. Illustrative case: a trial tenant adds a partner's domain and captures their sign-ins.

Server admin guide

Client secret storage and rotation

Each brokered identity provider uses a client secret or certificate that Keycloak holds to talk to the customer's directory. Store these values in a secrets manager rather than in exported realm files, restrict who can read them in the admin console, and plan rotation with the customer, since the provider side must change too. Ask each tenant who owns the secret at their identity provider, when it expires, and how the handover will be recorded.

Login failure logging

Login failures are persisted to the database by default in Keycloak 26.8, which gives you a record of failed sign-ins per tenant. Decide retention for that data, who can query it, and how it is separated by organization so one tenant's support team does not see another's failures. Pair it with metrics at /metrics on the management interface, enabled with --metrics-enabled=true, so spikes in failures from one provider surface quickly.

Metrics guide

Questions teams ask before linking tenant identity providers

What does it cost to link a tenant's identity provider to Keycloak?

The cost depends on the written scope, and DeployOpen does not publish a price list, so a quote follows from the scope agreed in writing before work starts. The main cost drivers are the number of identity providers, their protocols (OIDC or SAML), whether domain routing and identity-first login are in scope, how many tenants share a provider, and how much automation is needed for membership. Ask any quote to separate one-time setup work (configuring the first provider, the login flow and test sign-ins) from recurring work such as onboarding new tenants, upgrades and support, which may be handled under a retainer. Ask the provider to list the Keycloak version, the database and the hosting environment each assumption depends on.

How long does the first tenant take to link compared with later tenants?

The first tenant usually takes longest because it sets the pattern: the organization, the identity provider configuration, the domain claim, the login flow and the attribute and role mappings. Later tenants reuse that pattern, so the work shifts to confirming their domain, metadata or client registration and testing their sign-in. Duration depends on how quickly the customer's identity team responds, how many protocol details need checking, and whether shared providers are used. No duration is fixed here, so ask for a timeline in the written scope that names the customer dependencies for each step.

What does the customer need to provide before linking its identity provider?

The customer has to supply the facts that Keycloak cannot discover on its own. Typically this includes:

  • The email domains that should route to its identity provider, and proof that it controls them
  • Its provider's metadata or client registration details, such as the OIDC issuer and client credentials or the SAML metadata
  • The attributes, group claims or roles it wants mapped into the application
  • A named contact who can test sign-in and approve the change before it goes live

Ask the customer to confirm these items early, because missing domain proof or group claims are common reasons a link stalls.

Can an internal team link tenant identity providers without outside help?

Yes, if the team already runs Keycloak in production and has people who understand OIDC, SAML, realm and organization administration, and the security review process for federated sign-in. Many teams start by handling the first tenant with a partner so the pattern is documented, then take over onboarding of later tenants. The factors to weigh are the skills available, the number of tenants expected, how often provider configurations change, and who is accountable for a failed sign-in at 2 a.m. DeployOpen plans, implements and documents this work in the client's own infrastructure, and it can hand over the runbook so your team can continue.

How should a tenant's identity provider be offboarded?

Offboarding means removing the provider link without locking out users who should still have access, and it should be a planned change. The usual sequence is to confirm with the customer which users will move to another sign-in method, disable new sign-ins through the provider, remove the domain routing and provider link from the organization, review which accounts remain and how they are handled, and record the change in your audit trail. Ask whether the scope covers user cleanup, token and session revocation, and the documentation of the change. Check that removing a provider does not break other tenants that share it.

Does Keycloak issue a compliance certification for a tenant identity setup?

No. Keycloak is an open source project licensed under Apache 2.0, and the project does not issue audit reports, attestations or certifications for a deployment. DeployOpen prepares configuration, controls and evidence for compliance assessments, but it does not issue audit reports or certifications either. Independent auditors and certification bodies perform that assessment. Ask your auditor which evidence they expect for federated sign-in, such as provider configuration records, access reviews and logs of administrative changes, and plan to collect it during the build.

What security checks should happen before a tenant provider goes live?

Before go-live, confirm that the provider's signing certificates and metadata are validated, that domain routing sends only the intended addresses to that provider, and that a user from one tenant cannot sign in to another tenant's organization. Test sign-in, sign-out and logout behavior, and check the handling of backchannel logout tokens. Keycloak's 26.8 upgrade notes state that signature validation of backchannel logout tokens from external providers is mandatory, so verify that your configuration works with it. Confirm that TLS is enforced on every hop and that admin access is restricted to authorized staff.

Limits to confirm in your environment before you commit

The organization feature and per-tenant provider design depend on details that change by release, by upstream provider and by the customer's own rules. Confirm each item below against your target Keycloak version and your environment before you agree on scope.

Keycloak version and organization behavior

Organization features, including linked identity providers and domain routing, change between releases. Pin the exact version you plan to run, then test linking, domain-based identity-first login and managed membership on that version in a staging realm. The current release is 26.8.1, but a deployment built on an older minor line may behave differently. Ask whether any organization behavior you rely on is still opt-in or changed in your target release.

Keycloak docs

Supported upstream provider configurations

Each customer may run Entra ID, Okta, or a SAML identity provider with different settings for signing keys, metadata, claim names, and group mapping. Build a test matrix from the providers your customers actually use, and record which attributes and claims each one sends. Do not assume that a configuration working for one customer will work for another. Confirm how each provider handles logout and token signature validation.

Organization and provider capacity

The number of organizations, linked identity providers, and members each database and cluster can carry depends on your load, your database, and your high availability design. Ask the vendor and your own test team for limits they have measured, and run a load test with your expected tenant count before you commit. Confirm that your database is one of the supported production databases and that the cluster design uses synchronous replication where the project requires it.

HA overview

Token size for multi-organization users

A user who belongs to many organizations can receive a large token if organization claims are included in every token. Large tokens can increase header size and slow requests through proxies and applications. Decide which organization data belongs in the token, which can be fetched on demand, and test the largest membership you expect. Confirm the header size limits of your reverse proxy and load balancers.

Customer policy on external identity providers

Some customers do not allow their staff to sign in through a provider the customer does not control, or they require a specific authentication method, session length, or logging standard. Ask each customer's security or procurement team which identity providers they accept, who owns the client registration in their tenant, and how they want access revoked. Record the answers in the onboarding checklist, because they decide whether a per-tenant provider is allowed at all.

What DeployOpen needs from you to scope this work

A written scope starts with the tenant list: every customer or business unit that will sign in through its own identity provider, the email domains each one uses, and whether any tenant needs more than one domain or a shared provider with another tenant. Include the identity provider type for each tenant (Microsoft Entra ID, Okta, or a generic SAML 2.0 or OIDC provider), the metadata or discovery details your team can export, and the admin contact who can approve the trust relationship and confirm group or role mappings. Ask each contact to confirm which users must be auto-enrolled into the organization and which should be invited, because that choice decides how membership is managed later. Also tell us whether any tenant has existing Keycloak users that must be linked to the new provider, since account linking changes the migration work.

Next, list the applications that will trust the tokens issued for these organizations, with their protocol (OIDC or SAML), redirect URIs, and whether they read an organization claim. Describe the target Keycloak deployment as well: the version you run or plan to run, the database engine and its high availability design, the public hostname and reverse proxy in front of it, and where the admin console will be reachable. Confirm whether Keycloak will be deployed on Kubernetes with the Operator or on virtual machines, because that determines how client and provider configuration is managed. Confirm too who will own the Keycloak admin role after handover.

Finally, agree the acceptance tests before work starts. For each tenant, define the sign-in path to test (domain entry, identity-first login, and direct link), the expected result for a user from an unlisted domain, the expected behavior when a tenant's identity provider is disabled, and the offboarding check that removes access. Ask your security team which logs and evidence they need to review for each tenant. Confirm with your identity provider administrators the test accounts and any conditional access policies that will apply to Keycloak sign-ins, since these can block tests if they are not planned. These inputs together let DeployOpen price and schedule the work as a fixed-scope engagement, with the scope, deliverables, and timeline set in writing before work starts.

How DeployOpen scopes, delivers and supports tenant identity provider work

DeployOpen plans, implements, tests, documents and supports self-hosted Keycloak inside your own infrastructure, including the organizations, identity provider links and domain routing that let each business customer sign in with its own identity provider. Engagements are agreed as fixed-scope work with written deliverables before any build starts.

How we scope

  • Inventory the tenants, their identity providers and the protocols each one uses, such as OIDC or SAML.
  • Define which organizations, verified domains and identity-first login rules the written scope covers.
  • Agree in writing which tenant admins, managed membership rules and audit evidence are in and out of scope.

How we build

  • Configure organizations, linked identity providers, domain routing and shared provider settings in a non-production realm first.
  • Test sign-in, first login, managed membership and sign-out for each tenant type with representative test accounts.
  • Document the configuration as code where your team wants it, so each new tenant follows the same reviewed path.

How we hand over

  • Deliver written configuration records, runbooks for onboarding and offboarding a tenant, and a list of open decisions.
  • Train your administrators on verifying a domain, rotating an upstream client secret and checking a broken login.
  • Provide test results and retest notes so your security and compliance teams can review the setup independently.

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer after handover, scoped in writing.
  • Plan Keycloak upgrades and review release notes for changes that affect identity provider linking or login flows.
  • Retest tenant sign-in paths after material changes to identity providers, domains or Keycloak versions.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.