Access control in Google Cloud Search is based on the user's Google Account. When indexing content, all item ACLs must resolve to valid Google user or group IDs (email addresses).
In many cases, a repository doesn't have direct knowledge of Google Accounts. Instead, local accounts represent users, or users use federated sign-in with an identity provider. This identification, other than the email address, is called the external ID.
Created using the Admin console, identity sources bridge the gap between identity systems by:
- Defining a custom user field to store external IDs. This field resolves external IDs to a Google Account.
- Defining a namespace for security groups managed by a repository or identity provider.
Use identity sources when:
- The repository doesn't know the user's primary email address in Google Workspace or Google Cloud Directory.
- The repository defines access control groups that don't correspond to email-based groups in Google Workspace.
Identity sources improve efficiency by decoupling indexing from identity mapping. This lets you defer user lookup when creating ACLs and indexing items.
Example deployment
Figure 1 shows an enterprise using both on-premises and cloud repositories. Each uses a different type of external ID.
Repository 1 identifies users by email address using SAML. Since it knows the primary email address in Google Workspace or Cloud Directory, it doesn't need an identity source.
Repository 2 integrates with an on-premises directory and identifies users by
sAMAccountName. Because it uses this attribute as an external ID, it
requires an identity source.
Create an identity source
If you require an identity source, see Map user identities in Cloud Search.
Create the identity source before creating a content connector; you need its
ID to create ACLs and index data. Creating an identity source also creates a
custom user property
in Cloud Directory to store external IDs. The property name uses the
convention IDENTITY_SOURCE_ID_identity.
This table shows two identity sources: one for SAM account names and one for user IDs (uid).
| Identity source | User property | External ID |
|---|---|---|
id1 |
id1_identity |
sAMAccountName |
id2 |
id2_identity |
uid |
Create an identity source for each type of external ID used in your enterprise.
This table shows how a user with a Google Account and two external IDs appears in Cloud Directory:
| User | id1_identity |
id2_identity |
|
|---|---|---|---|
| Ann | ann@example.com |
example\ann |
1001 |
You can reference the same user using any of these IDs when forming ACLs for indexing.
Write user ACLs
Use
getUserPrincipal()
or
getGroupPrincipal()
to create principals using external IDs.
This example retrieves file permissions, including users with access:
This snippet creates principals for owners using the externalUserName
attribute:
This snippet creates principals for readers:
Once you have readers and owners, create the ACL:
The REST API uses the pattern
identitysources/IDENTITY_SOURCE_ID/users/EXTERNAL_ID.
Ann's id1_identity resolves to
identitysources/id1_identity/users/example/ann. This is the user's
intermediate ID.
For more on modeling repository ACLs, see ACLs.
Map groups
Identity sources also serve as a namespace for ACL groups. Use this to create and map groups used only for security or local to a repository.
Use the Cloud Identity Groups API to create groups and manage memberships. Associate the group with an identity source by using the identity source name as the namespace.
This snippet creates a group:
Create a group ACL
Use getGroupPrincipal()
to create a group principal with an external ID, then build the ACL:
Identity connectors
Users can't see items in search results until their external IDs resolve to a Google ID in Cloud Directory. You can ensure this in three ways:
- Manually update user profiles in the Admin console (recommended only for testing).
- Map IDs using the Directory API.
- Create an identity connector using the Identity Connector SDK.
Identity connectors map external IDs from enterprise identities to internal Google identities. If you create an identity source, you must also create an identity connector.
Google Cloud Directory Sync (GCDS) is an example of an identity connector. It maps user and group information from Active Directory to Cloud Directory.
Sync identities using the REST API
Use the update method
to sync identities.
Remap identities
After remapping an identity, you must reindex items for the change to take effect.
- If you remove or change a user mapping, the original mapping remains until reindexing.
- If you delete a mapped group and create a new one with the same
groupKey, it won't grant access until you reindex.