By default, Workforce Identity Federation sessions have a maximum duration of 12 hours. With extended session length, you can configure sessions that last up to 90 days for the following:
OAuth apps owned by Google Cloud projects: Configured using project scopes (
restricted_project). Workforce users can maintain an uninterrupted connection to OAuth apps owned by the specified project without daily reauthentication against your external identity provider (IdP).Supported Google Cloud applications: Configured using application scopes (
restricted_client_application). Workforce users can maintain an uninterrupted connection to supported applications, such as the Gemini Enterprise mobile and desktop apps, without daily reauthentication against your external IdP.
To maintain security throughout extended sessions, Google Cloud periodically synchronizes user attributes and group memberships directly from your external identity provider (IdP) in the background.
This document describes how to define extended session policies using the Access Context Manager API with project-scoped and application-scoped controls, configure your workforce pool provider, and manage active bindings.
How extended session length works
Workforce Identity Federation uses Access Context Manager Google Cloud access bindings to configure extended session length:
Google Cloud access binding: Administrators define a session length policy using Access Context Manager that applies organization-wide across all workforce pools in your organization. Policies grant extended sessions of up to 90 days using either one of the following:
Project scope (
restricted_project): Applies extended sessions to OAuth apps owned by the designated Google Cloud project.Application scope (
restricted_client_application): Applies extended sessions to supported Google Cloud applications.
Background attribute synchronization:
OIDC: Supported using either an OIDC Authorization Code flow with the
offline_accessscope (using refresh tokens to periodically refresh user attributes and group memberships from your external IdP in the background) or through SCIM provisioning.SAML: For SAML providers, user attributes and group memberships are kept up-to-date using SCIM provisioning.
Staleness protection: If user attributes cannot be refreshed from the external IdP within 24 hours (for example, if the user is deprovisioned or credentials are revoked at the IdP), Google Cloud terminates the session.
Session revocation: To sign a user out immediately, before their extended session expires, revoke the user's sessions.
Before you begin
Before configuring extended session length, ensure you have the required Identity and Access Management permissions and APIs enabled:
Required roles and permissions
To get the permissions that you need to configure extended session length, ask your administrator to grant you the following IAM roles:
- Configure workforce identity pool providers: Workforce Pool Admin (
roles/iam.workforcePoolAdmin) on the workforce pool or organization. - Manage Access Context Manager cloud access bindings: Cloud Access Binding Admin (
roles/accesscontextmanager.gcpAccessAdmin) at the organization level. This role provides the permissions required to create, view, update, and delete Access Context Manager access bindings.
Enable APIs
Enable the Access Context Manager and IAM APIs in your project:
gcloud services enable \
accesscontextmanager.googleapis.com \
iam.googleapis.com
Supported applications
Application scopes (restricted_client_application) support only the following Google Cloud applications. To scope a policy to an application, set the name field to the exact, case-sensitive application name:
| Application | Application name |
|---|---|
| Gemini Enterprise mobile app (Android) | Gemini Enterprise mobile Android |
| Gemini Enterprise mobile app (iOS) | Gemini Enterprise mobile IOS |
| Gemini Enterprise desktop app | Gemini Enterprise Desktop |
Identifying applications by OAuth client ID (clientId) isn't supported.
Limitations and Requirements
Before configuring extended session length, review the following requirements and limitations:
- Supported scopes: Session settings must be configured within
scopedAccessSettingsusing one of the following client scopes:restricted_projectscope: Applies to OAuth apps owned by a Google Cloud project. Specify the project by its project number (projects/{PROJECT_NUMBER}).restricted_client_applicationscope: Applies to supported Google Cloud applications. Specify the application by its application name (thenamefield).- You must use one of the exact application names listed in Supported applications.
- Scoping by OAuth client ID (
clientId) is not supported for Workforce Identity Federation bindings and will be rejected. You must identify the application using thenamefield.
- Session duration range: Session duration must be between a minimum of 1 hour (
3600s) and a maximum of 90 days (7776000s). - Session settings parameter requirements:
session_length_enabled: Must be set totrue.session_length: Required duration between 1 hour (3600s) and 90 days (7776000s).session_reauth_method: Must be unset or set toLOGIN.use_oidc_max_age: Must be unset or set tofalse.max_inactivity: Must be unset (or default0s). Idle session timeouts are not supported forrestricted_projectbindings andrestricted_client_applicationbindings.
- Supported identity providers:
- OIDC with the authorization code flow: Requires the
offline_accessscope so that your IdP issues refresh tokens, or SCIM provisioning for users and groups with--scim-usage=enabled-for-users-groupsset on the workforce identity pool provider. - OIDC with the implicit flow and SAML 2.0: Requires SCIM provisioning for users and groups, and
--scim-usage=enabled-for-users-groupsset on the workforce identity pool provider. Extended session length isn't supported with--scim-usage=enabled-for-groups.
- OIDC with the authorization code flow: Requires the
- Attribute staleness threshold: A fixed 24-hour staleness threshold is enforced. If Google Cloud cannot refresh user attributes from your IdP within 24 hours, the session is invalidated and the user must reauthenticate.
- Access Context Manager constraints:
- Single organizational binding: Extended session length bindings for workforce pools must target the organization's "all workforce pools" principal (
principalSet://cloudresourcemanager.googleapis.com/organizations/{ORG_ID}/type/WorkforcePool). Because this federated principal identifier applies organization-wide across all workforce pools in your organization, only one such binding can exist per organization. To configure extended sessions for multiple projects, applications, or a combination of both, include multiplerestricted_projectandrestricted_client_applicationscope blocks within the binding's singlescopedAccessSettingslist. - Access levels (
access_levels,dry_run_access_levels) are not supported on workforce pool bindings. - Top-level
sessionSettingsdirectly on theGcpUserAccessBindingare not supported for workforce pool bindings; settings must be defined withinscopedAccessSettings.activeSettings.sessionSettings.
- Single organizational binding: Extended session length bindings for workforce pools must target the organization's "all workforce pools" principal (
Configure the workforce pool provider
To allow extended session length, your workforce pool provider must be configured to support background attribute refresh. You can configure the provider to use either the OIDC or SAML protocol.
Configure an OIDC provider
If your OIDC provider uses the implicit flow (--web-sso-response-type=id-token), token-based attribute refresh isn't available. Configure SCIM instead, or switch the provider to the authorization code flow.
Background attribute refresh for OIDC providers can be handled using either refresh tokens (offline_access scope) or SCIM provisioning. If using token-based attribute refresh:
- In your external IdP, configure an OIDC application with Authorization Code Flow and enable Offline Access so that a refresh token is returned.
- In Google Cloud, add
offline_accessto the additional scopes on your OIDC workforce pool provider.
Offline access must be configured on all workforce identity pools in your Google Cloud organization for the extended session length policy to have the intended effect.
gcloud
If your provider already has existing additional scopes, include them alongside offline_access so they are not overwritten:
gcloud iam workforce-pools providers update-oidc PROVIDER_ID \
--workforce-pool=WORKFORCE_POOL_NAME \
--location=global \
--web-sso-additional-scopes="offline_access[,EXISTING_ADDITIONAL_SCOPES]"
Replace the following:
PROVIDER_ID: The name of your workforce identity pool provider.WORKFORCE_POOL_NAME: The name of your workforce identity pool.EXISTING_ADDITIONAL_SCOPES: Any comma-separated additional scopes previously configured on the provider. If you have no existing additional scopes, omit this parameter.
REST API
Send a PATCH request to update the provider. Include any existing additional scopes alongside offline_access:
PATCH https://iam.googleapis.com/v1/locations/global/workforcePools/WORKFORCE_POOL_NAME/providers/PROVIDER_ID?updateMask=oidc.webSsoConfig.additionalScopes
Request body:
{
"oidc": {
"webSsoConfig": {
"additionalScopes": [
"offline_access"
]
}
}
}
Replace the following:
WORKFORCE_POOL_NAME: The name of your workforce identity pool.PROVIDER_ID: The ID of your workforce identity pool provider.
Configure SCIM for SAML and OIDC implicit flow providers
For SAML providers, and for OIDC providers that use the implicit flow, background attribute refresh requires SCIM provisioning:
- Set up a SCIM tenant for your workforce pool provider.
- Configure user and group provisioning from your identity provider to the SCIM endpoint.
- After all users and groups are synced to Google Cloud, set
--scim-usage=enabled-for-users-groupson your workforce identity pool provider. Extended session length isn't supported with--scim-usage=enabled-for-groups.
For step-by-step instructions, see SCIM provisioning for Workforce Identity Federation and "Enable SCIM for users and groups" for Microsoft Entra ID or Okta.
Example policy configuration for Google Cloud projects
Create a GcpUserAccessBinding resource that assigns the extended session length policy to your organization's workforce pools, scoping the policy to OAuth apps owned by a Google Cloud project.
gcloud
Define the policy in a YAML file named esl-binding.yaml:
scopedAccessSettings:
- scope:
clientScope:
restrictedProject:
name: projects/PROJECT_NUMBER
activeSettings:
sessionSettings:
sessionLength: 7776000s
sessionLengthEnabled: true
sessionReauthMethod: LOGIN
Create the access binding:
gcloud access-context-manager cloud-bindings create \
--organization=ORG_ID \
--federated-principal="principalSet://cloudresourcemanager.googleapis.com/organizations/ORG_ID/type/WorkforcePool" \
--binding-file="esl-binding.yaml"
Replace the following:
ORG_ID: Your Google Cloud organization ID (for example,123456789012).PROJECT_NUMBER: The Google Cloud project number to apply extended session length to (for example,987654321098). All OAuth apps owned by this project receive the extended session length.sessionLength: The session duration in seconds followed bys. For example,7776000sspecifies a 90-day session.sessionLengthEnabled: Set totrue.sessionReauthMethod: Set toLOGIN(or leave unset).
REST API
Send a POST request to the Access Context Manager API:
POST https://accesscontextmanager.googleapis.com/v1/organizations/ORG_ID/gcpUserAccessBindings
JSON request body:
{
"principal": {
"federatedPrincipal": "principalSet://cloudresourcemanager.googleapis.com/organizations/ORG_ID/type/WorkforcePool"
},
"scopedAccessSettings": [
{
"scope": {
"clientScope": {
"restrictedProject": {
"name": "projects/PROJECT_NUMBER"
}
}
},
"activeSettings": {
"sessionSettings": {
"sessionLength": "7776000s",
"sessionLengthEnabled": true,
"sessionReauthMethod": "LOGIN"
}
}
}
]
}
Replace the following:
ORG_ID: Your Google Cloud organization ID (for example,123456789012).PROJECT_NUMBER: The Google Cloud project number to apply extended session length to (for example,987654321098). All OAuth apps owned by this project receive the extended session length.sessionLength: The session duration in seconds followed bys. For example,7776000sspecifies a 90-day session.sessionLengthEnabled: Set totrue.sessionReauthMethod: Set toLOGIN(or leave unset).
Example policy configuration for Google Cloud applications
Create a GcpUserAccessBinding resource that assigns the extended session length policy to your organization's workforce pools, scoping the policy to supported Google Cloud applications using the restricted_client_application scope. This example uses the application names for the Gemini Enterprise mobile apps. For the full list of supported applications, see Supported applications.
gcloud
Define the policy in a YAML file named esl-app-binding.yaml:
scopedAccessSettings:
- scope:
clientScope:
restrictedClientApplication:
name: "Gemini Enterprise mobile Android"
activeSettings:
sessionSettings:
sessionLength: 7776000s
sessionLengthEnabled: true
sessionReauthMethod: LOGIN
- scope:
clientScope:
restrictedClientApplication:
name: "Gemini Enterprise mobile IOS"
activeSettings:
sessionSettings:
sessionLength: 7776000s
sessionLengthEnabled: true
sessionReauthMethod: LOGIN
Create the access binding:
gcloud access-context-manager cloud-bindings create \
--organization=ORG_ID \
--federated-principal="principalSet://cloudresourcemanager.googleapis.com/organizations/ORG_ID/type/WorkforcePool" \
--binding-file="esl-app-binding.yaml"
Replace the following:
ORG_ID: Your Google Cloud organization ID (for example,123456789012).name: The exact name of a supported application. Identifying applications by OAuth client ID (clientId) is not supported.sessionLength: The session duration in seconds followed bys(between3600sand7776000s).sessionLengthEnabled: Set totrue.sessionReauthMethod: Set toLOGIN(or leave unset).
REST API
Send a POST request to the Access Context Manager API:
POST https://accesscontextmanager.googleapis.com/v1/organizations/ORG_ID/gcpUserAccessBindings
JSON request body:
{
"principal": {
"federatedPrincipal": "principalSet://cloudresourcemanager.googleapis.com/organizations/ORG_ID/type/WorkforcePool"
},
"scopedAccessSettings": [
{
"scope": {
"clientScope": {
"restrictedClientApplication": {
"name": "Gemini Enterprise mobile Android"
}
}
},
"activeSettings": {
"sessionSettings": {
"sessionLength": "7776000s",
"sessionLengthEnabled": true,
"sessionReauthMethod": "LOGIN"
}
}
},
{
"scope": {
"clientScope": {
"restrictedClientApplication": {
"name": "Gemini Enterprise mobile IOS"
}
}
},
"activeSettings": {
"sessionSettings": {
"sessionLength": "7776000s",
"sessionLengthEnabled": true,
"sessionReauthMethod": "LOGIN"
}
}
}
]
}
Replace the following:
ORG_ID: Your Google Cloud organization ID (for example,123456789012).name: The exact name of a supported application. Identifying applications by OAuth client ID (clientId) is not supported.sessionLength: The session duration in seconds followed bys. For example,7776000sspecifies a 90-day session.sessionLengthEnabled: Set totrue.sessionReauthMethod: Set toLOGIN(or leave unset).
Viewing and listing bindings
Because the binding applies across all workforce pools in the organization, there is at most one access binding per organization.
List active bindings
To list the workforce pool access binding in your organization, use the principal:federatedPrincipal filter:
gcloud
gcloud access-context-manager cloud-bindings list \
--organization=ORG_ID \
--filter="principal:federatedPrincipal"
REST API
GET https://accesscontextmanager.googleapis.com/v1/organizations/ORG_ID/gcpUserAccessBindings?filter=principal:federated_principal
Get binding details
To view the details of a specific workforce pool access binding:
gcloud
gcloud access-context-manager cloud-bindings describe \
--binding=BINDING_NAME
Replace BINDING_NAME with the full resource name of the binding (for example, organizations/123456789012/gcpUserAccessBindings/b1234567890).
REST API
GET https://accesscontextmanager.googleapis.com/v1/organizations/ORG_ID/gcpUserAccessBindings/BINDING_ID
Replace the following:
ORG_ID: Your Google Cloud organization ID (for example,123456789012).BINDING_ID: The ID of your access binding (for example,b1234567890).
Update an access binding
You can update an existing workforce pool access binding to modify session lengths, add new project or application scopes, or remove existing scopes.
gcloud
Define the updated policy in a YAML file named
updated-esl-binding.yaml:scopedAccessSettings: - scope: clientScope: restrictedProject: name: projects/PROJECT_NUMBER activeSettings: sessionSettings: sessionLength: 2592000s sessionLengthEnabled: true sessionReauthMethod: LOGINApply the updated policy:
- Replace scoped access settings: To overwrite the existing scopes with the configuration defined in
updated-esl-binding.yaml:
gcloud access-context-manager cloud-bindings update \ --binding=BINDING_NAME \ --binding-file="updated-esl-binding.yaml"- Append to existing settings: To append the scopes defined in
updated-esl-binding.yamlto the binding's existing scopes without overwriting them, pass the--appendflag:
gcloud access-context-manager cloud-bindings update \ --binding=BINDING_NAME \ --binding-file="updated-esl-binding.yaml" \ --append- Replace scoped access settings: To overwrite the existing scopes with the configuration defined in
Replace the following:
* BINDING_NAME: The full resource name of the binding (for example, organizations/123456789012/gcpUserAccessBindings/b1234567890).
* PROJECT_NUMBER: The Google Cloud project number to apply extended session length to. All OAuth apps owned by this project receive the extended session length.
* sessionLength: The updated session duration (for example, 2592000s for 30 days).
REST API
Send a PATCH request to update the binding.
- Replace scoped access settings: To overwrite existing scopes:
PATCH https://accesscontextmanager.googleapis.com/v1/organizations/ORG_ID/gcpUserAccessBindings/BINDING_ID?updateMask=scopedAccessSettings
- Append to existing settings: To append new scopes without overwriting existing ones, set the
append=truequery parameter:
PATCH https://accesscontextmanager.googleapis.com/v1/organizations/ORG_ID/gcpUserAccessBindings/BINDING_ID?updateMask=scopedAccessSettings&append=true
JSON request body:
{
"scopedAccessSettings": [
{
"scope": {
"clientScope": {
"restrictedProject": {
"name": "projects/PROJECT_NUMBER"
}
}
},
"activeSettings": {
"sessionSettings": {
"sessionLength": "2592000s",
"sessionLengthEnabled": true,
"sessionReauthMethod": "LOGIN"
}
}
}
]
}
Replace the following:
* ORG_ID: Your Google Cloud organization ID (for example, 123456789012).
* BINDING_ID: The ID of your access binding (for example, b1234567890).
* PROJECT_NUMBER: The Google Cloud project number to apply extended session length to. All OAuth apps owned by this project receive the extended session length.
* sessionLength: The updated session duration (for example, 2592000s for 30 days).
Delete an access binding
If you delete the workforce pool access binding, extended session length is disabled for all workforce pools in your organization.
gcloud
gcloud access-context-manager cloud-bindings delete \
--binding=BINDING_NAME
Replace BINDING_NAME with the full resource name of the binding.
REST API
Send a DELETE request to remove the binding:
DELETE https://accesscontextmanager.googleapis.com/v1/organizations/ORG_ID/gcpUserAccessBindings/BINDING_ID
Replace the following:
ORG_ID: Your Google Cloud organization ID.BINDING_ID: The ID of the access binding to delete.