Class GrouperAzureProvisioningTargetNativeSync

java.lang.Object
edu.internet2.middleware.grouper.app.provisioning.GrouperProvisioningTargetNativeSync
edu.internet2.middleware.grouper.app.azure.GrouperAzureProvisioningTargetNativeSync

public class GrouperAzureProvisioningTargetNativeSync extends GrouperProvisioningTargetNativeSync
Azure-specific GrouperProvisioningTargetNativeSync: builds native target reporting beans for sync-back to the generic grouper_prov_group / grouper_prov_user tables.

Both groups and users are captured from the raw Microsoft Graph JSON (JSON Pointer paths, like SCIM/Adobe/Google), hooked at the API-commands seam (GrouperAzureApiCommands.retrieveAzureGroups/retrieveGroupsHelper and retrieveAzureUsers/retrieveUsersHelper) where the full JSON node is in scope. This avoids losing any Graph field that the GrouperAzureGroup / GrouperAzureUser typed beans do not model; operators can capture any JSON field via nativeAttributesGroups / nativeAttributesEntities with a name and optional JSON-Pointer path.

Unlike Adobe, Azure keeps canRetrieveGroup=true (Graph reads a single group by id or displayName), so the routing is unchanged -- only the capture site moved off the typed bean.

Memberships are group-centric and derived during DAO translation (captureMembershipsForGroup(java.lang.String, java.util.Collection<java.lang.String>)): the Graph group-members read co-locates the group id and the member user ids. Members are NOT folded into the group attribute node -- they are their own (group,user) mirror rows.

Group OWNERS, by contrast, ARE a managed group attribute in Azure (groupOwners), not memberships. They are fetched by a separate Graph /owners call and folded into the same native group via captureGroupOwners(String, java.util.Set) (called from GrouperAzureApiCommands.retrieveGroupOwnersHelper2), so a cache-reconstructed group carries its owners on the GROUP -- never in the membership mirror. See captureGroupOwners for why.

  • Constructor Details

    • GrouperAzureProvisioningTargetNativeSync

      public GrouperAzureProvisioningTargetNativeSync()
  • Method Details

    • getDefaultNativeAttributeConfigsEntities

      protected List<GrouperProvisioningNativeAttributeConfig> getDefaultNativeAttributeConfigsEntities()
      Description copied from class: GrouperProvisioningTargetNativeSync
      Per-protocol sensible-default attribute list for entities (users) when the operator hasn't configured nativeAttributesEntities. Override in protocol subclasses to return a curated list (e.g. SCIM core schema fields). Default is empty — for LDAP this means "no extra capture beyond what the regular target query returned," which is the historical behavior.
      Overrides:
      getDefaultNativeAttributeConfigsEntities in class GrouperProvisioningTargetNativeSync
    • getDefaultNativeAttributeConfigsGroups

      protected List<GrouperProvisioningNativeAttributeConfig> getDefaultNativeAttributeConfigsGroups()
      Description copied from class: GrouperProvisioningTargetNativeSync
      Per-protocol sensible-default attribute list for groups. See GrouperProvisioningTargetNativeSync.getDefaultNativeAttributeConfigsEntities().
      Overrides:
      getDefaultNativeAttributeConfigsGroups in class GrouperProvisioningTargetNativeSync
    • buildNativeGroupFromJson

      public GrouperProvisioningTargetNativeGroup buildNativeGroupFromJson(com.fasterxml.jackson.databind.JsonNode groupNode)
      Build a native group bean from the raw Microsoft Graph group JSON. targetId is read from /id (the same field the old buildNativeGroupFromAzureGroup took from GrouperAzureGroup.getId()); the attributes map is populated for each entry in GrouperProvisioningTargetNativeSync.effectiveNativeAttributeConfigsGroups() (operator-configured or default) by JSON Pointer. Returns null when the JSON is missing or has no id.
    • buildNativeUserFromJson

      public GrouperProvisioningTargetNativeUser buildNativeUserFromJson(com.fasterxml.jackson.databind.JsonNode userNode)
      Build a native user bean from the raw Microsoft Graph user JSON. targetId is read from /id (the same field the old buildNativeUserFromAzureUser took from GrouperAzureUser.getId()); the attributes map is populated for each entry in GrouperProvisioningTargetNativeSync.effectiveNativeAttributeConfigsEntities() (operator-configured or default) by JSON Pointer. Returns null when the JSON is missing or has no id.
    • captureGroupJson

      public void captureGroupJson(com.fasterxml.jackson.databind.JsonNode groupNode)
      Build + record an Azure group from its raw JSON. No-op when sync-back is off or id-less.
    • captureUserJson

      public void captureUserJson(com.fasterxml.jackson.databind.JsonNode userNode)
      Build + record an Azure user from its raw JSON. No-op when sync-back is off or id-less.
    • captureMembershipsForGroup

      public void captureMembershipsForGroup(String targetGroupId, Collection<String> targetUserIds)
      Record (targetGroupId, targetUserId) memberships for a single Azure group, given the already-resolved user ids returned by retrieveAzureGroupMembers. No-op when inputs are blank.

      Azure membership is group-centric and derived during DAO translation (the Graph group-members read co-locates both ids), so it stays bean/id-based -- the same situation as Adobe -- while object capture moves to raw JSON.

    • captureGroupOwners

      public void captureGroupOwners(String targetGroupId, Set<String> ownerIds)
      Fold the resolved owner set for one Azure group into that group's already-captured native group as the multi-valued groupOwners attribute.

      Azure group owners are a managed GROUP ATTRIBUTE (not memberships): GrouperAzureGroup.toProvisioningGroup assigns them to groupOwners, and Grouper diffs/writes them as a group attribute (updateGroups' groupOwners branch, addOwnersToGroup/ removeOwnersFromGroup). So sync-back must carry owners on the GROUP, not in grouper_prov_mship -- a cache-reconstructed group missing groupOwners would look changed and re-push owners on every from-cache run (for a config where groupOwners is selected/updated). Owners must NOT enter the membership mirror, or the compare would treat an owner as a plain group member.

      Owners are fetched by a SEPARATE Graph /owners call AFTER the group JSON was captured, so the native group is already recorded (recordTargetNativeGroup); this augments it in place with the SAME id set the typed bean carries (grouperAzureGroup.getOwners()), so the cached value matches what a live read produces (same set through the same toProvisioningGroup map) -- no spurious diff. A copy is stored so later mutation of the bean's set does not leak into the cache. An empty/blank owner set records "no owners" (no attribute values), matching a live read of an owner-less group. No-op when the group was not captured (sync-back off for this read, or an id-less group).

      Parameters:
      targetGroupId - the Azure group id (target_group_id)
      ownerIds - the group's owner ids as resolved from the /owners read (may be empty/null)
    • captureGroupJsonFromCurrentProvisioner

      public static void captureGroupJsonFromCurrentProvisioner(com.fasterxml.jackson.databind.JsonNode groupNode)
      Capture an Azure group (from its raw JSON) against the current provisioner's sync. No-op if there's no current provisioner or the active provisioner isn't an Azure one. Called from the commands seam (GrouperAzureApiCommands.retrieveAzureGroups/retrieveGroupsHelper) for every group read.
    • captureUserJsonFromCurrentProvisioner

      public static void captureUserJsonFromCurrentProvisioner(com.fasterxml.jackson.databind.JsonNode userNode)
      Capture an Azure user (from its raw JSON) against the current provisioner's sync. No-op if there's no current provisioner or the active provisioner isn't an Azure one. Called from the commands seam (GrouperAzureApiCommands.retrieveAzureUsers/retrieveUsersHelper).
    • captureMembershipsForGroupFromCurrentProvisioner

      public static void captureMembershipsForGroupFromCurrentProvisioner(String targetGroupId, Collection<String> targetUserIds)
      Record group-to-user memberships against the current provisioner's sync, using already-resolved Azure target ids.
    • captureGroupOwnersFromCurrentProvisioner

      public static void captureGroupOwnersFromCurrentProvisioner(String targetGroupId, Set<String> ownerIds)
      Fold a group's resolved owner id set into its already-captured native group (as the multi-valued groupOwners attribute) against the current provisioner's sync. No-op if there's no current provisioner or the active provisioner isn't an Azure one. Called from the owners seam (GrouperAzureApiCommands.retrieveGroupOwnersHelper2) once per group after its /owners read. See captureGroupOwners(String, Set) for why owners live on the group, not in memberships.
    • captureMembershipInsertFromCurrentProvisioner

      public static void captureMembershipInsertFromCurrentProvisioner(String groupTargetId, String userTargetId)
      Write-track a successful Azure membership add against the current provisioner: record (groupTargetId, userTargetId) in the native membership map. No-op out of cycle or for a non-Azure provisioner (the underlying record call is itself guarded by isLoadMembershipsToGenericGrouperTable()).
    • captureMembershipDeleteFromCurrentProvisioner

      public static void captureMembershipDeleteFromCurrentProvisioner(String groupTargetId, String userTargetId)
      Write-track a successful Azure membership remove against the current provisioner: drop (groupTargetId, userTargetId) from the native membership map so the end-of-run flush deletes its grouper_prov_mship row. No-op out of cycle or for a non-Azure provisioner.