Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Créer et rechercher des groupes de mappage d'identité
Cette page explique comment créer et rechercher des groupes de mappage d'identité. Un groupe de mappage d'identité est un type de groupe qui reflète un groupe dans une source d'identité externe, telle qu'un groupe Active Directory. Les groupes de mappage d'identité sont utilisés lors de la création d'un connecteur d'identité pour Google Cloud Search.
Pour créer un groupe de mappage d'identité, appelez la méthode groups.create() avec une instance du nouveau groupe. L'instance de groupe doit inclure les paramètres groupKey, Parent et label définis sur system/groups/external. groupKey est une combinaison de namespace et groupId qui identifie le groupe de manière unique.
Python
L'exemple suivant montre une fonction d'assistance qui permet de créer un groupe d'identités à l'aide de la bibliothèque cliente Python. Utilisez l'ID de la source d'identité, obtenu lors de la création de la source d'identité dans la console d'administration Google, pour appeler la fonction d'assistance et créer un groupe:
defcreate_identity_group(service,identity_source_id,group_id,group_display_name,group_description):namespace="identitysources/"+identity_source_idgroup_key={"id":group_id,"namespace":namespace}group={"parent":namespace,"description":group_description,"displayName":group_display_name,"groupKey":group_key,"labels":{# Set the label to specify creation of an identity group."system/groups/external":""}}try:response=service.groups().create(body=group).execute()printresponseexceptException,e:printemyNewGroup=create_identity_group(idSvc,"ABC1234","zebra","Zebra external group","The Zebra group is an identity group representing the Zoolandexternalidentity")
L'espace de noms garantit que vous ne rencontrerez aucune conflit de dénomination et place le groupe de mappage d'identité dans le contexte approprié d'autres groupes de la même source d'identité externe.
Rechercher des groupes de mappage d'identité
REST
Pour rechercher des groupes de mappage d'identité, appelez la méthode groups.search() avec une chaîne de requête. Pour rechercher tous les groupes, vous ne devez fournir que le libellé system/groups/external.
Python
L'exemple suivant montre une fonction d'assistance utilisée pour rechercher des groupes de mappage d'identité à l'aide de la bibliothèque cliente Python :
defsearch_identity_groups(service,identity_source_id,pageSize,view):# Set the label to search for all identity groupssearchQuery="&query=namespace=identitysources/"+identity_source_id \
+"%20AND%20"+"labels:system/groups/external" \
+"&pageSize="+pageSize+"&view="+viewtry:searchGroupsRequest=service.groups().search()searchGroupsRequest.uri+=searchQueryresponse=searchGroupsRequest.execute()printresponseexceptException,e:printe
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eIdentity-mapped groups mirror groups in external identity sources like Active Directory and are used when creating an identity connector for Google Cloud Search.\u003c/p\u003e\n"],["\u003cp\u003eCreating an identity-mapped group involves using the \u003ccode\u003egroups.create()\u003c/code\u003e API method and providing a \u003ccode\u003egroupKey\u003c/code\u003e, \u003ccode\u003eParent\u003c/code\u003e, and \u003ccode\u003elabel\u003c/code\u003e set to \u003ccode\u003esystem/groups/external\u003c/code\u003e, with the \u003ccode\u003egroupKey\u003c/code\u003e uniquely identifying the group through a \u003ccode\u003enamespace\u003c/code\u003e and \u003ccode\u003egroupId\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eWhen creating the identity group using Python, the namespace must be included to avoid naming conflicts and to ensure the group is in the proper context of the external identity source.\u003c/p\u003e\n"],["\u003cp\u003eSearching for identity-mapped groups is done via the \u003ccode\u003egroups.search()\u003c/code\u003e API method, where providing the \u003ccode\u003esystem/groups/external\u003c/code\u003e label will return all such groups.\u003c/p\u003e\n"],["\u003cp\u003eAfter creating an identity group, the next step is to create memberships, using the procedures described in "Managing identity-mapped group memberships".\u003c/p\u003e\n"]]],[],null,["# Creating and searching for identity-mapped groups\n=================================================\n\nThis page explains how to create and search for *identity-mapped groups*. An\nidentity-mapped group is a type of group that mirrors a group in an\nexternal identity source, such as an Active Directory group. Identity-mapped\ngroups are used when creating an identity connector for Google Cloud Search.\n\nFor more information about identity-mapped groups, see\n[Groups API overview](/identity/docs/groups#group-types).\n\nThe following sections demonstrate how to manage identity-mapped groups.\n\nBefore you begin\n----------------\n\n| **Note:** Before you use any of the Cloud Identity APIs, you must set up Cloud Identity. See [Setting up Cloud Identity](/identity/docs/set-up-cloud-identity-admin) for instructions.\n\nPerform the following tasks before proceeding with the information on this page:\n\n- [Create the identity source](https://support.google.com/a/answer/9039510)\n in the Google Admin console.\n\n- Read the [Groups API overview](/identity/docs/groups).\n\n- [Set up the Groups API](/identity/docs/how-to/setup).\n\nCreating an identity-mapped group\n---------------------------------\n\n### REST\n\nTo create an identity-mapped group, call\n[`groups.create()`](/identity/docs/reference/rest/v1/groups/create) with an\ninstance of the new group. The group instance must include a `groupKey` ,\n`Parent`, and `label` set to `system/groups/external`. The `groupKey` is a\ncombination of `namespace` and `groupId` that uniquely identifies the group.\n\n### Python\n\nThe following example shows a helper function to create an identity group\nusing the Python client library. Use the identity source ID, obtained when you\ncreated the identity source in the Google Admin console, to call the helper\nfunction and create a group: \n\n def create_identity_group(service, identity_source_id, group_id, group_display_name,\n group_description):\n namespace = \"identitysources/\" + identity_source_id\n group_key = {\"id\": group_id, \"namespace\": namespace}\n group = {\n \"parent\": namespace,\n \"description\": group_description,\n \"displayName\": group_display_name,\n \"groupKey\": group_key,\n \"labels\": {\n # Set the label to specify creation of an identity group.\n \"system/groups/external\": \"\"\n }\n }\n\n try:\n response = service.groups().create(body=group).execute()\n print response\n except Exception, e:\n print e\n\n myNewGroup = create_identity_group(\n idSvc,\n \"ABC1234\",\n \"zebra\",\n \"Zebra external group\",\n \"The Zebra group is an identity group representing the Zooland\n external identity\"\n )\n\nProviding the namespace ensures that you won't experience any naming\ncollisions, and places the identity-mapped group in the proper context of other\ngroups from the same external identity source.\n\n### Searching for identity-mapped groups\n\n### REST\n\nTo search for identity-mapped groups, call\n[`groups.search()`](/identity/docs/reference/rest/v1/groups/search) with a\nquery string. To search for all groups, you only need to provide the label\n`system/groups/external`.\n\n### Python\n\nThe following example shows a helper function used to\nsearch for identity-mapped groups using the Python client library: \n\n def search_identity_groups(service, identity_source_id, pageSize, view):\n # Set the label to search for all identity groups\n searchQuery = \"&query=namespace=identitysources/\" + identity_source_id \\\n + \"%20AND%20\" + \"labels:system/groups/external\" \\\n + \"&pageSize=\" + pageSize + \"&view=\" + view\n try:\n searchGroupsRequest = service.groups().search()\n searchGroupsRequest.uri += searchQuery\n response = searchGroupsRequest.execute()\n print response\n except Exception, e:\n print e\n\nWhat's next\n-----------\n\nAfter a group exists, you can create memberships for it. To create memberships\nfor an identity-mapped group, refer to\n[Managing identity-mapped group memberships](/identity/docs/how-to/memberships-identity-groups)."]]