Skip to main content

Google Workspace SSO for AlmaForge

Last verified: December 1, 2026

Connect AlmaForge to Google Workspace with OpenID Connect (OIDC) and map Google Groups to AlmaForge roles. Users sign in with their Workspace account and receive roles from their current group memberships.

Prerequisites​

AlmaForge cluster​

Use a running cluster. If you already have an admin CLI profile, run this on your workstation and confirm the active profile points to your cluster.

Terminal
alma status

If Google will be your first SSO connector, use the local admin identity on the Auth Service host to apply it. See Connect your first identity provider.

Have the public HTTPS address of the Proxy Service ready. You will use this address to build the Google redirect URI.

Google Workspace admin​

You need a Google Workspace Super Admin account protected by MFA to authorize domain-wide delegation. You also need an active Workspace admin account with permission to read directory groups and memberships. Set this account's email in googleAdminEmail. The service account impersonates this user at sign-in, and the account does not need to be a Super Admin.

Google Groups​

Have at least one Google Group in your Workspace organization ready to map to AlmaForge roles. AlmaForge matches groups by their full primary email address (for example, admins@example.com), not by display name. Use a direct member of a mapped group for the first sign-in test. This tests the connector and role mapping without adding nested-group resolution to the first check.

Google Cloud project​

Google Workspace manages users and groups, while Google Cloud manages OAuth apps and API credentials. Even if you do not run any workloads on Google Cloud, Google requires a project in your Workspace organization to hold the OAuth 2.0 consent screen and client ID, enable the Cloud Identity API, and own the service account that queries Google Groups.

Create a dedicated project for SSO or reuse an existing one in the same organization. You need permission to configure OAuth clients, enable APIs, and create a service account and JSON key. The project, OAuth client, enabled API, service account, and JSON key do not incur Google Cloud usage charges.

Network access from Auth Service hosts​

The Auth Service completes Google sign-in and looks up the user's groups before assigning AlmaForge roles. Allow outbound HTTPS (TCP port 443) from every Auth Service host to these endpoints.

  • accounts.google.com provides Google's OIDC configuration.
  • oauth2.googleapis.com exchanges the browser's authorization code for tokens.
  • www.googleapis.com provides the public keys used to verify the ID token.
  • cloudidentity.googleapis.com returns the user's group memberships.

Run this check from each Auth Service host.

Terminal
for host in accounts.google.com oauth2.googleapis.com www.googleapis.com \    cloudidentity.googleapis.com; do    curl -sS --max-time 10 -o /dev/null -w "${host}: HTTP %{http_code}\n" "https://${host}/"  done

An HTTP response confirms connectivity. If curl reports HTTP 000, check DNS, firewall, proxy, or TLS settings before continuing.

Console only

Google provides no API for configuring this OAuth 2.0 consent screen, so there is no Terraform resource or gcloud command for it. Complete this step in the Google Cloud Console.

  1. In the Google Cloud Console, select your project. In the search bar, type Google Auth Platform and open the Google Auth Platform result.

    Google Cloud search result for Google Auth Platform

  2. In Overview, click Get started. If you already configured the consent screen, open Audience, verify that it is Internal, and continue to Step 2.

    Get started on the Google Auth Platform overview

  3. Under App Information, enter AlmaForge as the app name, choose a support email, and click Next.

    App Information form with the app name and support email field

  4. Under Audience, select Internal and click Next. This limits sign-in to users in your Workspace organization.

    Audience form with Internal selected

  5. Under Contact Information, add an email address for project notices, then click Next.

    Contact Information form with the email address field

  6. Review Google's user data policy. If you agree, select the checkbox, then click Continue and Create.

    Finish screen with the user data policy checkbox

Once Google creates the consent screen, enable the Cloud Identity API in the same project.

Step 2. Enable the Cloud Identity API​

The Auth Service queries this API at sign-in for both direct and nested group memberships.

Google Cloud Console. Open the Cloud Identity API page, select the same project you used in Step 1, and click Enable.

Cloud Identity API in the Google Cloud Console

CLI. To enable the API from a terminal, replace <project-id> with the project ID from Step 1 and run the following commands.

Terminal
gcloud services enable cloudidentity.googleapis.com --project=<project-id>gcloud services list --enabled --project=<project-id> \    --filter='config.name=cloudidentity.googleapis.com' --format='value(config.name)'cloudidentity.googleapis.com

Step 3. Create an OAuth client ID​

  1. In OAuth overview, click Create OAuth client. You can also open Clients and click Create client.

    Create OAuth client button on the Google Auth Platform overview

  2. Set these fields.

    • Application type: Web application
    • Name: AlmaForge

    Application type menu with Web application selected

  3. Set the URL fields.

    • Authorized JavaScript origins: Leave blank.
    • Authorized redirect URIs: Click Add URI and enter https://almaforge.example.com/api/v1/oidc/callback. Replace almaforge.example.com with your public Proxy Service hostname. Keep https:// and omit the trailing slash.

    OAuth web client form with the AlmaForge callback URI

  4. Click Create. Save the Client ID and Client secret before you close the dialog. Google shows the secret only at creation.

    OAuth client created dialog with the client secret redacted

  5. In Clients, confirm that the new web application appears in the list.

    Clients list showing the new AlmaForge web application

Use the saved client ID and secret in Step 6.

Treat the OAuth client secret as a password

Anyone with the client secret can impersonate AlmaForge to Google's OAuth endpoints. Store it in the same secret manager you use for production credentials. Do not commit it to Git.

Step 4. Create a service account​

Google does not include group memberships in the ID token, so AlmaForge uses a service account to read them from the Cloud Identity API. Create it with the Google Cloud Console or Terraform.

Create the service account in the Console​

Open IAM & Admin → Service Accounts, then click Create service account.

Create service account button in the Google Cloud Console

Set Service account name to almaforge-group-sync and click Create and continue.

Google Cloud form for naming the service account

Leave Permissions and Principals with access blank, then click Done. The service account gets its Google Groups access through Workspace domain-wide delegation in Step 5.

Open the service account you just created and go to Details. Copy the numeric Unique ID (also called OAuth 2 Client ID). You will paste it into the Workspace admin console in Step 5.

Service account Details tab showing the numeric Unique ID

Open Keys and click Add key.

Add key button on the Google Cloud service account Keys tab

Choose Create new key, select JSON, then click Create.

Google Cloud service account key dialog with JSON selected

Save the downloaded key as google-sa.json. You will install it on every Auth Service host in Step 6.

Create the service account with Terraform​

In a new private working directory, save service-account.tf. It creates the service account and its JSON key. Keep the state, state backups, and exported key out of source control.

If you use local Google credentials, run gcloud auth application-default login before running Terraform. Replace <project-id> with the project ID from Step 1.

Terminal
umask 077terraform initterraform apply -var='project_id=<project-id>'terraform output -raw service_account_client_id109876543210987654321terraform output -raw google_service_account_json > google-sa.json

Use the numeric ID in Step 5. Install google-sa.json in Step 6.

If Google reports Service account key creation is disabled in either the Console or Terraform, a Google Cloud organization policy is blocking JSON keys on this project. Ask your Google Cloud organization administrator whether the project can use a service account key, or see Google's service account policy troubleshooting.

Treat the service-account JSON as a private key

The file contains an RSA private key. Anyone who reads it can impersonate the service account and, through domain-wide delegation, any Workspace admin you grant it. Store it with the same care you give production SSH private keys.

Step 5. Grant domain-wide delegation​

Console only

Google requires a Workspace Super Admin to grant domain-wide delegation in the Google Admin console. Terraform and gcloud can create the service account, but the Workspace grant is a separate step.

Sign in to the Google Admin console with a dedicated Workspace Super Admin account protected by MFA. Open Domain-wide delegation and click Add new. Paste:

  • Client ID: the numeric Unique ID you copied in Step 4. Not the OAuth client ID from Step 3, which is a different value.
  • OAuth scopes: https://www.googleapis.com/auth/cloud-identity.groups.readonly

Domain-wide delegation form with the Cloud Identity scope

Click Authorize. In the delegation list, find the numeric client ID and open View details. Confirm that it lists https://www.googleapis.com/auth/cloud-identity.groups.readonly. If your organization uses multi-party approval, another Super Admin must approve the request. AlmaForge uses this scope to read groups as the Workspace user named in googleAdminEmail in Step 6.

The delegated admin is not the service account

The googleAdminEmail on the connector must be the email of a real Workspace admin user (for example, admin@example.com), not the ...@project.iam.gserviceaccount.com email of the service account itself. The service account impersonates that admin to read groups. Without a real admin identity to impersonate, the API call fails with an unauthorized_client error.

Step 6. Apply the OIDCConnector​

From the workstation where you saved google-sa.json in Step 4, copy the key to each Auth Service host over SSH. Replace operator@auth.example.com with the SSH user and address for that host.

Terminal
chmod 0600 ./google-sa.jsonscp -p ./google-sa.json operator@auth.example.com:google-sa.json

On each Auth Service host, sign in as the user who received the key and install it at the same path. almad runs as root, so only root needs read access to the installed file.

Terminal
sudo install -o root -g root -m 0600 \    "$HOME/google-sa.json" /etc/almaforge/google-sa.json

In a multi-node Auth Service cluster, every host needs an identical key at this exact path. The instance that handles a login reads the file locally. See High availability to prevent intermittent login failures.

After verifying the installed file, remove the staging copy from the SSH user's home directory.

Write a YAML file describing the connector. Set googleServiceAccount to a ${file:PATH} reference. The Auth Service resolves the reference when it builds the connector, so the key stays on disk:

google.yaml:

examples/sso/google-workspace/almad.d/google.yaml
# Google Workspace connector with Cloud Identity group lookup.
apiVersion: almaforge.com/v1
kind: OIDCConnector
metadata:
name: google
spec:
display: Google
issuerURL: https://accounts.google.com
clientID: <oauth-client-id>
clientSecret: <oauth-client-secret>
# Use a Workspace admin who can read group memberships. The service account
# acts as this user during sign-in.
googleAdminEmail: admin@example.com
googleServiceAccount: ${file:/etc/almaforge/google-sa.json}
# Use the group's primary email under value and list existing AlmaForge roles.
# Members of the group receive those roles at sign-in.
claimsToRoles:
- claim: groups
value: admins@example.com
roles: [admin, access]
- claim: groups
value: developers@example.com
roles: [access]

Replace:

  • <oauth-client-id> and <oauth-client-secret> with the values from Step 3.
  • googleAdminEmail with a real Workspace admin email (see the warning in Step 5).
  • The path inside ${file:...} with the path at which you placed the service-account JSON on every Auth Service host.
  • The claimsToRoles entries with your own Google Group addresses and AlmaForge roles. Google Groups are matched by full email address, not by name. Use admins@example.com, not just admins.
Alternative: embed the service account JSON inline

For development clusters, lab setups, or single-node deployments where you do not want to manage a file on disk, embed the full service-account JSON directly in the connector resource instead:

google-inline-service-account.yaml:

examples/sso/google-workspace/almad.d/google-inline-service-account.yaml
# Dev-only Google Workspace connector with the service-account key inline.
apiVersion: almaforge.com/v1
kind: OIDCConnector
metadata:
name: google
spec:
display: Google
issuerURL: https://accounts.google.com
clientID: <oauth-client-id>
clientSecret: <oauth-client-secret>
# Use a Workspace admin who can read group memberships. The service account
# acts as this user during sign-in.
googleAdminEmail: admin@example.com
googleServiceAccount: |
{
"type": "service_account",
"project_id": "example-alma-sso",
"private_key_id": "f06e...",
"private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
"client_email": "almaforge-group-sync@example-alma-sso.iam.gserviceaccount.com",
"client_id": "11...76",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/almaforge-group-sync%40example-alma-sso.iam.gserviceaccount.com"
}
# Use the group's primary email under value and list existing AlmaForge roles.
# Members of the group receive those roles at sign-in.
claimsToRoles:
- claim: groups
value: admins@example.com
roles: [admin, access]

googleServiceAccount accepts either a file reference or an inline value. An inline value places a high-value secret directly in the cluster state store. It is returned by alma get oidcconnector/google -o yaml --with-secrets and included in any backup of the backend. Prefer the ${file:PATH} form for production. Keep the inline form for development clusters only.

Test break-glass before applying

AlmaForge has no local accounts. If this is the only connector, a wrong claim mapping or expired client secret prevents new logins. Confirm your break-glass procedure works before applying the connector to a production cluster.

If you have a cluster admin profile, apply the connector from your workstation.

Terminal
alma apply -f google.yaml

If this is your first connector, securely copy google.yaml to the Auth Service host and apply it there using the local admin identity.

Terminal
sudo alma apply -f google.yaml

If you chose inline JSON and have an existing cluster admin profile, apply that file from your workstation:

Terminal
alma apply -f google-inline-service-account.yaml

For the first connector, apply the inline file on the Auth Service host using the local admin identity:

Terminal
sudo alma apply -f google-inline-service-account.yaml

Step 7. Verify the connector​

Open the cluster's audit log for your test account. See SSO verification for event fields and the distinction from service logs.

Keep your admin session open. From a separate workstation or OS account, sign in as a direct member of a mapped Google Group. This tests the connector and role mapping without nested-group resolution. If you use nested groups, repeat the test with a nested member after the direct login succeeds. Replace the example proxy address with yours.

Terminal
alma login --proxy=almaforge.example.com

Choose Google in the browser. The test passes when alma prints the roles expected for that user. With the example mapping, a test user who belongs only to developers@example.com receives access.

If this is the cluster's first connector, also sign in with an account mapped to admin. Confirm that alma prints the admin role before closing the local admin session on the Auth Service host.

Audit events from a successful sign-in

A successful first-time login emits a UserLogin event and the CertificateCreate event for the certificate it mints:

JSON
{
"kind": "AuditEvent",
"apiVersion": "almaforge.com/v1",
"spec": {
"id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"index": 0,
"timestamp": "2026-03-30T15:58:58.999000Z",
"clusterName": "almaforge.example.com",
"code": "T1001I",
"type": "UserLogin",
"verb": "login",
"actor": {
"name": "alice@example.com",
"type": "user"
},
"status": {
"success": true
},
"userLogin": {
"method": "oidc",
"attributes": {
"connector_id": "google",
"connector_type": "oidc",
"email": "alice@example.com",
"name": "Alice Example",
"request_id": "8f0c1e6a-2f7e-4a7a-9f1e-1f0b6d0f1a2b",
"username": "alice@example.com"
}
}
}
}
JSON
{
"kind": "AuditEvent",
"apiVersion": "almaforge.com/v1",
"spec": {
"id": "2f1a8b3c-5d6e-4f70-8a91-b2c3d4e5f607",
"index": 0,
"timestamp": "2026-03-30T15:58:58.999000Z",
"clusterName": "almaforge.example.com",
"code": "TC000I",
"type": "CertificateCreate",
"verb": "create",
"certificateCreate": {
"certType": "user",
"identity": {
"user": "alice@example.com",
"roles": [
"access"
],
"logins": [
"tester",
"ec2-user",
"root"
],
"traits": {
"email": [
"alice@example.com"
],
"groups": [
"developers@example.com"
],
"name": [
"Alice Example"
]
}
}
}
}
}

The key field to check is the groups trait on the CertificateCreate event. It contains the full Google Group email addresses (not display names) returned by the Cloud Identity API for that user. Compare those addresses with the claimsToRoles entries that grant the expected roles. If groups is empty or contains null:

  • The googleAdminEmail on the connector is not a real Workspace admin, or domain-wide delegation is not configured for the service account.
  • The user is a member of groups outside your Workspace domain and Cloud Identity is failing closed (see External group lockout).
  • The Cloud Identity API is not enabled on the Google Cloud project.

Read the full audit-event breakdown on the generic OIDC verification section.

Troubleshooting​

Google rejects the redirect URI​

If Google shows Error 400: redirect_uri_mismatch, open the OAuth client from Step 3. Its Authorized redirect URIs value must exactly match the connector callback URL, including the https:// scheme, hostname, and /api/v1/oidc/callback path. Omit the trailing slash.

Google rejects delegated access​

If Google returns unauthorized_client during group lookup, open the delegation entry from Step 5. Check that the client ID is the numeric Unique ID of the service account from Step 4, not the OAuth client ID from Step 3, and that the exact Cloud Identity scope is listed. Confirm any required approval has been granted.

If the grant is new, wait a few minutes and test again. Google says delegation can take up to 24 hours to propagate. See Google's delegation error reference.

No roles match the login​

The login is rejected when no mapping assigns a role. Check these conditions first:

  • The user is a member of at least one group listed in claimsToRoles.
  • Every claimsToRoles value is the group's full primary email address.

Use Inspect Groups in Google Admin to verify the user's memberships. Then inspect the Auth Service journal for group-lookup errors. With ALMA_LOG_LEVEL=debug, sign in again and read the claims from the ID token:

Terminal
journalctl -u almad -f | grep 'Extracted claims'

Extracted claims appears before the Workspace group lookup, so the line may not contain the group email addresses used for role mapping. Check the nearby group-lookup error in the Auth Service journal. For PERMISSION_DENIED, confirm that the directory reader can see the user's groups. Also check whether Google enforces its documented searchTransitiveGroups license requirements on your Workspace edition. AlmaForge calls searchTransitiveGroups for both direct and nested memberships.

After a successful login, inspect spec.traits.groups in the user record for the resolved group addresses. See Claims, traits, and role templates.

The connector omits the Workspace admin​

If alma apply fails with spec.googleAdminEmail is required when spec.googleServiceAccount is set, add the Workspace admin email that the service account will impersonate under spec.googleAdminEmail, then re-apply the connector.

External group lockout​

The Auth Service journal reports that the user is a member of an external Google Workspace group. AlmaForge rejects a lookup containing an external identity-mapped group instead of using an incomplete group list. Either move affected users out of the external groups or block access to external groups at the Workspace level.

The delegated Workspace admin is disabled​

Group lookup fails when the admin account named in googleAdminEmail is disabled. With the group-based mappings in this guide, a missing group list leaves no matching role and the login is rejected. Inspect the Auth Service journal for the Google API error. Track the admin account alongside your other privileged accounts, and update googleAdminEmail before retiring it.

Operations​

Break-glass access​

Test break-glass access before relying on this connector. Google-specific recovery cases include a rotated service-account key or revoked domain-wide delegation, alongside expired client secrets and incorrect claimsToRoles mappings.

Revocation​

Removing a user from a Google Group takes effect on their next sign-in. Existing certificates remain valid until they expire. For an immediate cutoff, lock the user.

Secret storage​

Use ${file:PATH} to keep the service-account private key on disk. Inline googleServiceAccount and clientSecret values are stored in the backend and its backups. Follow Secret storage to protect them or load the client secret from a file or environment variable.

Service account key rotation​

Rotate service-account keys according to your credential policy:

  1. Generate a new JSON key in IAM & Admin → Service Accounts → your-sa → Keys → Add key → Create new key → JSON.
  2. Replace the file referenced by ${file:...} on every Auth Service host. Use the same configuration management tool you used to deploy it originally (Ansible, Puppet, cloud-init, Kubernetes secret mounts).
  3. Confirm a test login works.
  4. Delete the old key in Google Cloud.

The connector reads the file on the next login. No almad restart is required. If you use inline googleServiceAccount instead, re-apply the connector with the new JSON.

Lifecycle​

Apply connector changes before testing the next login. No almad restart is needed. See When connector changes take effect for discovery caching and IdP-side changes.

Track the Workspace admin named in googleAdminEmail alongside your other privileged accounts. If that account is suspended or disabled, group lookup fails on the next sign-in. Update googleAdminEmail on the connector before retiring the account.

High availability​

AlmaForge reads the service-account JSON on the Auth Service instance that handles each login callback. In a multi-node Auth Service cluster, a missing or stale file on one instance causes intermittent login failures. Deploy the file through configuration management so every Auth Service host has an identical copy at the same path.

Every Auth Service instance also calls the Cloud Identity API and Google OAuth endpoints independently. Each instance caches the OIDC discovery document for one hour. See High availability on the generic OIDC page for the full list of per-instance assumptions.

Monitoring​

Monitor the audit log for login outcomes. For diagnostics, inspect the Auth journal for token validation and group lookup, and the Proxy journal for browser callbacks. On each service host, tail OIDC-related messages with:

Terminal
journalctl -u almad -f | grep -Ei 'google|oidc'

Check UserLogin failures and their spec.status.error field. See SSO verification for event codes, certificate fields, and debug-only journal copies. Collect records from audit event storage for SIEM ingestion. Collect service diagnostics from the journal separately.

Removal​

Delete the connector resource:

Terminal
alma delete oidcconnector/google

Existing sessions issued through the connector remain valid until their certificates expire. No new sessions will be issued.

On the Google side, you can also decommission the supporting resources: revoke the domain-wide delegation in the Workspace admin console, delete the service account and its keys in Google Cloud IAM, and delete the OAuth client credentials. Disabling the Cloud Identity API on the project is optional.

References​