Keycloak SSO for Google Workspace with a SAML profile

Keycloak can be the sign-in for Google Workspace through a SAML SSO profile assigned to organizational units or groups. This page covers the settings Google requires, the build sequence, mapping, and the super admin exception.

On this page

How Keycloak SSO for Google Workspace works with a SAML profile

This section is for the organization that wants Keycloak, rather than Google, to check passwords, MFA and account status when Workspace users sign in. The method is SAML 2.0. Google Workspace accepts third-party identity providers over SAML and OIDC, but this page covers SAML only. In that model Google acts as the service provider, Keycloak acts as the SAML identity provider, and the sign-in behavior is stored in an SSO profile. Google Workspace Admin Help describes these profiles as settings that are assigned to organizational units or groups, not to individual users. That design means you decide early which OUs move to Keycloak sign-in first, and which stay on Google's own authentication while you test.

Two Google-side details shape the Keycloak work. First, a Workspace organization can hold up to 1,000 SAML profiles, so you can split pilot users from production users without building separate tenants. Second, the super admin path is different. Google's documentation says super admin sign-in requires the legacy SSO profile, which supports only one identity provider. Plan for that exception before you assign anything: keep a super admin account that does not depend on Keycloak, record how it is protected, and confirm with Google how the legacy profile behaves in your edition and region, since that behavior is set by Google and can change.

The rest of this page walks through the Keycloak client and the Google profile settings in order: the entity ID, sign-in and sign-out URLs, the change-password URL and the signing certificate. Before you start, confirm which Keycloak realm will host the Workspace client, which hostname Keycloak will publish, and who owns the certificate rotation process. Those three decisions cause most rework when the profile is later moved from a test OU to production.

What you need before configuring Google Workspace SSO

Google Workspace SSO through a SAML profile depends on a few items that must be settled before anyone touches the Google Admin console. The cards below cover the Keycloak release and hostname, the Google account that makes the change, the realm and client plan, the signing certificate, and how existing accounts will be matched.

Keycloak release and hostname

Pick the Keycloak release you will run and confirm it against the current upgrade guidance before building anything, because the 26.8 upgrade notes change several defaults. The sign-in and sign-out URLs Google uses must resolve over HTTPS on a hostname you control, so decide that hostname early and make sure it sits behind your reverse proxy with TLS on all communication.

Current release
26.8.1
Keycloak upgrading guide

Google super admin account

Creating and changing SAML profiles requires a Google Workspace super admin. Confirm who holds that role, that the account uses strong authentication, and that a second super admin exists so a misconfigured profile cannot lock the organization out. Record which account will perform the change and who approves it.

Realm and SAML client plan

Decide which Keycloak realm will act as the identity provider for Google Workspace and whether it is dedicated to workforce sign-in. Plan one SAML client for Google with the entity ID, the assertion consumer location and the sign-in and sign-out endpoints recorded in a worksheet. Keep the realm's administrators and login policies separate from other applications that share the server.

X.509 certificate with RSA or DSA

Google needs an X.509 certificate with an RSA or DSA public key to verify assertions from Keycloak. Decide whether the realm's signing certificate will be uploaded or a dedicated one will be issued, and who owns its expiry date. Google accepts up to two certificates, so plan a rotation window that uploads the new certificate before the old one expires.

Certificates allowed
2

User matching and existing accounts

Decide how Keycloak users will match Google Workspace accounts, usually by email address, and confirm that every existing Google account has a corresponding user in the identity provider. Check for duplicate identities, accounts that exist only in Google, and users who must keep a local password. Settle this before the profile is assigned, because mismatches appear as sign-in failures for real staff.

Organizational unit and group scope

Google assigns SSO profiles to organizational units or groups, not to individual users. Map which organizational units will use Keycloak and which will stay on Google's own sign-in during the pilot. Record the list before the change so that a later assignment does not move unexpected users onto a new sign-in path.

How a Workspace sign-in travels through Keycloak

The sequence starts when a user opens a Google Workspace service and Google redirects the browser to Keycloak, the SAML identity provider, through the SSO profile assigned to the user's organizational unit or group. Keycloak authenticates the user in its realm and returns a SAML response to Google through the browser. The second path is the super admin sign-in, which uses the legacy SSO profile and never reaches the Keycloak SSO profile, so it must be tested and kept reachable. Check that the Keycloak host sits inside the trust boundary you define, and that the admin path is planned separately.

Standard user SSO path through Keycloak, with the separate super admin path shown at the bottom.

Configuring the Keycloak SAML client and Google SSO profile

This sequence connects a Keycloak realm to Google Workspace as a SAML identity provider, so that selected organizational units or groups sign in through Keycloak. Each step ends with a check that proves the configuration matches on both sides before wider rollout.

  1. Confirm the realm and its signing certificate

    The platform team confirms which Keycloak realm will act as the identity provider for Google Workspace, and that the realm holds the users and groups the pilot needs. Keep Google sign-in in a realm that is not used for administrator access, so an error in the Google setup cannot lock out Keycloak administrators. Check the realm's keys and confirm the RSA signing certificate that Keycloak uses for SAML. Google accepts an X.509 certificate with an RSA or DSA public key, so note the active key before you start. The step is done when you can export the realm's SAML metadata and see the certificate listed.

  2. Create the SAML client for Google

    In the Keycloak admin console, the identity team creates a SAML client for Google Workspace using the assertion consumer service URL and entity ID that Google provides in its SSO setup screens. Set the client ID to the value Google expects, enable signed assertions, and set the name identifier format and attribute mappers for email and name as Google's documentation describes. Confirm the exact values in Google's current setup pages, because they are the source of truth for these fields. The step is done when the client saves without errors and its settings match the values Google displays.

  3. Export the Keycloak endpoints and certificate

    From the realm's SAML metadata, the identity team records the Keycloak entity ID, the single sign-on (sign-in) URL and the single logout (sign-out) URL. Export the signing certificate in the format Google's form accepts. Keep these values in a change record, because Google needs each of them exactly as Keycloak publishes them. Use the public URL that users reach, not an internal host name, and confirm it matches the hostname set in the production configuration. The step is done when the four values are written down and the metadata file opens with the same values.

  4. Create the Google SSO profile

    In the Google Admin console, a super admin creates a third-party SAML SSO profile and enters the IdP entity ID, the sign-in page URL, the sign-out page URL and a change-password URL, then uploads the certificate exported from Keycloak. Google allows up to two certificates on one profile, which is useful when you rotate keys later. The profile is saved but not yet assigned to any users. The step is done when the profile shows the Keycloak values and the certificate's expiry date matches the Keycloak realm key you exported.

  5. Test sign-in with a pilot organizational unit

    Assign the new profile to a small pilot organizational unit or group that contains test accounts, not the whole domain. Sign in with a pilot user in a private browser session and confirm Google redirects to Keycloak, the user authenticates, and the session returns to Google Workspace with the expected name and email. Then test sign-out and confirm the sign-out URL behaves as planned. Record any SAML error page and compare the assertion attributes with the mappers in Keycloak. The step is done when the pilot user signs in and out without errors on the test browsers you plan to support.

  6. Assign the profile to the production scope

    After the pilot passes, the Google administrator assigns the SSO profile to the organizational units or groups that should use Keycloak, and confirms that unassigned units still use their existing sign-in method. Google assigns profiles to units or groups rather than to individual users, so review membership of each target unit first. Confirm with Google's current documentation how super admin accounts are handled, since super admin sign-in relies on a legacy SSO profile that supports only one identity provider. The step is done when a sample user in each assigned unit signs in through Keycloak and an unassigned user still signs in the old way.

  7. Document recovery and certificate rotation

    The team writes down the super admin recovery path, the owner of the Keycloak realm key, and the steps to upload a replacement certificate to Google before the current one expires. Because Google accepts two certificates, the replacement can be added alongside the current one, tested with a pilot unit, and then the old one removed. Confirm with the Keycloak and Google documentation how key rotation is scheduled in your environment. The step is done when a named owner has reviewed the runbook and has performed one dry-run rotation in a test realm.

Mapping Keycloak users and groups to Google Workspace accounts

This table compares the identity elements that must line up between Keycloak and Google Workspace, from the NameID value to the organizational unit or group that receives the SSO profile. Read each row as a check to complete before the profile goes live. The main takeaway is that Google matches the sign-in identity to an existing user by primary email, and profiles are assigned to containers, not to individuals.

ElementWhat it must match or doWhere it is setCommon failure
NameID or sign-in identifierCarries the value Google uses to find the user, normally the primary email addressKeycloak SAML client mapper or NameID format; confirm the format Google expects in your profileNameID carries a username without a domain, so Google cannot match the account
Primary email attributeKeycloak user email must equal the Google primary email exactly, including case handling you have verifiedKeycloak user profile and the email mapper on the SAML clientAliases or secondary addresses are used in Keycloak while Google holds a different primary
Given and family nameOptional profile attributes sent as SAML attributes so Google displays the correct nameUser attribute mappers on the Keycloak SAML clientNames are blank or mapped to the wrong attribute, leaving display names inconsistent
Existing Google userThe account must already exist in Google Workspace with the same primary email; the SSO profile does not create usersGoogle Admin console user directory, or your provisioning toolUsers sign in to Keycloak successfully but Google returns an error because no matching account exists
Organizational unit or group assignmentGoogle applies an SSO profile to an OU or group, so users inherit it through membershipGoogle Admin console SSO profile assignment (confirm current options in the Google Workspace Admin Help)A user moves OU and loses the profile, or sits in two containers with conflicting settings
Super admin accountsSuper admin sign-in needs the legacy SSO profile, which supports only one identity providerGoogle Admin console legacy SSO setting for super adminsTeams assume the new profile covers super admins and lock out the admin path during rollout

How super admin sign-in is handled

Most users sign in through a SAML SSO profile that Keycloak answers. The profile holds the IdP entity ID, sign-in and sign-out URLs, the change-password URL and the X.509 certificate Google checks on each assertion. You assign it to organizational units or groups, so the scope of the change follows your directory structure rather than individual accounts. Google allows up to 1,000 SAML profiles per organization, which leaves room to stage a pilot before a wider rollout.

  • Profile assignment: Attach the profile to a small organizational unit first, then widen it once sign-in and sign-out behave as expected.
  • Certificate handling: Upload the current signing certificate and keep a second one ready, since Google accepts up to two certificates for rotation.
  • Sign-out behavior: Test that the sign-out URL ends the Google session as your security team expects, not only the Keycloak session.
  • Change-password path: Confirm where users go when they must change a password, and that Keycloak's flow matches your policy.
  • Fallback for users: Decide whether a user locked out of Keycloak has any other route into Google Workspace, and who approves it.

Confirm each assignment and certificate step against the current Google Workspace Admin Help article before you change production profiles.

Security settings for the Keycloak and Google SAML trust

The Google SAML trust is only as strong as the Keycloak endpoints behind it, the certificate Google verifies, and the people allowed to change the SSO profile. The cards below cover those layers in the order a deployment team usually hardens them.

TLS on every Keycloak endpoint

Keycloak's production guide calls for TLS on all communication. For this trust, that means the sign-in page, the SAML metadata URL, the single sign-on endpoint and the single logout endpoint all serve HTTPS with a certificate your team manages and renews. Check that the hostname in the metadata matches the certificate names, because a mismatch breaks sign-in in ways that are hard to trace. Confirm the certificate chain with a clean client before you assign the profile to any organizational unit.

Keycloak production guide

Keep the admin console off the SSO hostname

Google only needs the public realm endpoints for sign-in. The admin console and Administration REST API should sit on a different hostname or context path, reached through a reverse proxy that restricts paths. If the public SSO hostname also serves /admin, anyone who can reach the login page can reach the admin surface. Ask your proxy team to confirm which paths are published externally and to block the admin paths for all public sources.

Two-certificate rotation window

A Google SAML profile accepts up to two X.509 certificates, which lets you add the next signing certificate before retiring the current one. Use that overlap window: upload the new certificate, switch Keycloak's realm signing key to match, test a sign-in with a pilot organizational unit, then remove the old certificate. Keep the RSA or DSA public key requirement in mind when you generate or import keys. Record the expiry date of every certificate in your certificate inventory.

Certificates allowed
2
Google SSO setup

Signing and clock settings

Decide whether Keycloak signs SAML assertions, responses or both, and confirm that Google accepts the signing configuration your Keycloak client uses. Keep the server clock synchronized with a trusted time source on every Keycloak node, since SAML assertions carry validity windows that fail when clocks drift. Verify the assertion's NotBefore and NotOnOrAfter values in a test sign-in, and confirm the chosen signing algorithm with Google's current documentation before go-live.

Session and MFA policy in Keycloak

Google trusts Keycloak's authentication decision, so Keycloak's session and MFA settings define the actual sign-in strength for Workspace users. Set realm session idle and maximum lifetimes, require a second factor for the Google client through an authentication flow, and decide how long a user can stay signed in before reauthentication. Test a sign-in from a new browser to confirm that the MFA step runs before the SAML response is issued, not only on the Keycloak account page.

Keycloak admin guide

Restrict who can change the SSO profile

Changes to a Google SSO profile can redirect sign-in for every user in an assigned organizational unit, so treat profile administration as a privileged role. Limit Google Admin console access to the people who own the SSO profile, require a change ticket for edits to entity IDs, URLs or certificates, and review the admin audit log after each change. Confirm with Google how super admin sign-in is handled, because the legacy SSO profile that super admins require supports only one identity provider.

Common Google Workspace SSO failures and their causes

This table pairs each common failure with its likely cause and the fix to try first when Keycloak sign-in to Google Workspace breaks. Read it top to bottom during setup and again during testing, because several failures look identical from the user's browser. The main takeaway is that most failures trace back to a mismatch between the SAML profile in Google and the client in Keycloak, not to Google itself.

FailureLikely causeFix
Sign-in fails with an invalid request or unknown issuerEntity ID in the Google SAML profile does not match the Keycloak SAML client or realm descriptorCopy the entity ID from the Keycloak realm descriptor exactly, including case and trailing characters, then retest with a single user
Assertion rejected at the assertion consumer URLACS URL in the Keycloak client does not match the Google ACS URL, often because the hostname or realm path differsSet the valid redirect and ACS values in Keycloak to the Google-provided URL, save, and clear cached sessions before testing
Google reports the certificate is invalid or unusableCertificate uploaded is not X.509 with an RSA or DSA public key, or the wrong realm key was exportedExport the active realm signing certificate in the required format and upload it to Google's SAML profile
Sign-in breaks after a key changeCertificate has expired or was rotated in Keycloak without updating GoogleUpload the new certificate as the second slot, test, then remove the old one; keep two certificates during rotation
Users are redirected to Google but deniedPrimary email in Google does not match the username or email claim Keycloak sendsAlign the Keycloak user email with the Google primary address, or map the NameID and email attributes to the value Google expects
Some users sign in and others do notTheir Keycloak accounts lack the email value or use a different domain alias than the Google primary emailCompare the failing user's primary email with the attribute sent in the SAML response and correct the account record
Users still get the password-less or old sign-in pathSAML profile is not applied to the organizational unit or group containing the userAssign the profile to the correct OU or group in the Admin console and confirm the user's OU membership
SAML profile appears set but has no effect for some usersProfile was assigned to a parent OU while the user sits in a child OU that has its own override, or to a group the user is not inTrace the user's effective OU path and assign the profile at the level Google applies to that user
Sign-out does not return users to a pageSign-out URL is blank or points to a URL Keycloak does not accept as a post-logout redirectSet the sign-out URL in the Google profile and add the same destination to the Keycloak client's valid post-logout redirect URIs
Users remain signed in to Keycloak after leaving GoogleSingle logout is not configured in Keycloak, so the upstream session survivesConfirm the logout settings on the Keycloak client and test with a separate browser session
Super admins cannot sign in through KeycloakSuper admin sign-in requires the legacy SSO profile, which supports only one identity provider, and the new profile was assigned to themKeep at least one super admin on the password path, configure the legacy profile for super admins, and document a recovery owner before changing profiles

Questions buyers ask before configuring Keycloak SSO for Google Workspace

What drives the effort and cost of setting up Keycloak SSO for Google Workspace?

The work scales with how many Google Workspace domains, organizational units and groups need different sign-in rules, and with how much of the Keycloak side is already built. The main cost components are discovery of your current directory and sign-in flows, Keycloak realm and client design, the SAML profile configuration in Google, testing across test and production users, and the handover documentation. Costs go up when the source of identity is not yet clean, when several Keycloak realms or upstream identity providers feed the same domain, or when super admin sign-in has to be designed alongside the standard profile. Ask any quote to list each of these as a separate line item tied to the written scope, and to state which items are one-time and which recur, such as certificate rotation and ongoing support.

How long does a pilot take, and what sets the timeline?

A pilot's length is set by the number of organizational units or groups you want to test, the number of identity owners who must sign off, and how quickly your admins can make changes in the Google Admin console. Google assigns SSO profiles to organizational units or groups rather than to individual users, so a pilot can be limited to one test unit before wider rollout, which keeps the blast radius small. Timelines also depend on whether a Keycloak realm, client and test users already exist, and on how long certificate and change approvals take inside your organization. Agree the pilot exit criteria in writing before work starts, and confirm the schedule against your own change calendar rather than a generic estimate.

What must our team provide before the work starts?

Your team needs to provide four things: administrator access to the Google Workspace Admin console with rights to create SSO profiles and assign them, administrator access to the Keycloak realm and its clients, named identity owners who approve which users and groups sign in through Keycloak, and the X.509 certificate that Google will validate. Google requires an RSA or DSA public key in that certificate and accepts up to two certificates for rotation, so decide early who owns the key pair, where the private key is stored and when it expires. You will also need the sign-in, sign-out and change-password URLs your Keycloak instance will expose, which depend on your reverse proxy and hostname design. Confirm these owners and access paths in the statement of work.

Can our internal team set up Keycloak SSO for Google Workspace alone?

An internal team with Keycloak administration experience and Google Workspace super admin access can do the work alone, provided it has time to test and the right change approvals. The tasks are not especially large in isolation, but the risk sits in the details: a wrong entity ID, an unsupported certificate, or a missed super admin sign-in path can lock users out. Google also notes that super admin sign-in requires the legacy SSO profile, which supports only one identity provider, so your team must plan that path separately. Decide whether your staff have current hands-on time for both platforms, whether they can run a pilot without disrupting production, and whether a second person can review the configuration. If any answer is no, a partner-led engagement with a written scope can cover the gaps.

Do we need to upgrade Keycloak before configuring Google SSO?

Not necessarily, but you should confirm your Keycloak version and plan any upgrade as a separate, earlier change. The current Keycloak release is 26.8.1, published October 13, 2026, and the 26.8 upgrade notes include changes that can affect a sign-in setup, such as enforced SMTP StartTLS and mandatory signature validation of backchannel logout tokens from external providers. If your deployment runs an older release or uses the deprecated multi-site feature, the upgrade path becomes a prerequisite that changes the schedule. Keycloak documents that minor releases may introduce opt-in breaking changes, so read the upgrade guide for your current version before adding a new SAML client. Ask the provider to state which version the scope assumes and what happens if an upgrade is needed.

Does the work include SCIM or Google user provisioning?

SSO and provisioning are separate decisions, so confirm them explicitly in the written scope. The SAML profile covers sign-in: it tells Google where to send users to authenticate and which certificate to trust, but it does not by itself create or update Google user accounts in Keycloak. If your organization needs accounts created, changed or removed automatically, that is a provisioning design involving user sources, attribute mapping, group rules and offboarding, and it adds effort and testing. Ask whether provisioning is in scope, which source of truth drives it, and who signs off on deprovisioning behavior. If it is out of scope, state how users will be created in Google before their first sign-in.

What does the engineer need to check after the SAML profile is live?

After go-live, the engineer should verify the sign-in and sign-out flow for a test user in each assigned organizational unit, confirm that the certificate is accepted and that rotation is scheduled, and check that the change-password URL resolves correctly. Review the Keycloak side as well: confirm the TLS configuration, the reverse proxy path restrictions, and that the admin console is reachable on a separate hostname from public frontend URLs. Test a denied user to confirm access is blocked where expected, and confirm that a super admin can still sign in through the documented legacy path. Record the results and the owner of each check so the handover is auditable.

How DeployOpen scopes and delivers Keycloak SSO for Google Workspace

DeployOpen plans, builds, tests and documents Keycloak as the sign-in for Google Workspace inside infrastructure you control. Each engagement starts with a written scope that names the organizational units or groups, the Keycloak realm and the super admin approach before any configuration changes are made.

How we scope

  • Written scope names the Keycloak realm, client settings and the Google Workspace organizational units or groups that will receive the SSO profile.
  • Scope records the entity ID, sign-in and sign-out URLs, change-password URL and certificate sources agreed with your identity team.
  • Scope states how super admin sign-in is handled, including the legacy SSO profile limit and the local recovery path you keep.

How we build

  • We configure the Keycloak SAML client and the Google Workspace SAML profile against a test organizational unit before any production assignment.
  • Certificate handling covers the RSA or DSA key Google expects, with planning for the two-certificate rotation window.
  • Testing covers sign-in, sign-out, password change redirects and access denial for users outside the assigned units or groups.

How we hand over

  • Deliverables include the configured Keycloak client, the Google Workspace profile settings and a runbook for each assignment.
  • Documentation records who owns each certificate, its expiry checkpoints and the steps to rotate it without interrupting sign-in.
  • Handover covers the super admin recovery procedure, so administrators know how to sign in if the identity provider is unavailable.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades and continuous testing for the Keycloak deployment are available as a retainer.
  • Changes to assignments, certificates or Keycloak upgrades are handled as new written scope so the baseline stays documented.

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.