Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Azure style Group member remove operations #448

Merged
merged 3 commits into from
Dec 19, 2023

Conversation

kjthorpe18
Copy link
Contributor

@kjthorpe18 kjthorpe18 commented Dec 12, 2023

Azure sends PATCH operations to remove members from a group of the following form:

{
   "schemas":[
      "urn:ietf:params:scim:api:messages:2.0:PatchOp"
   ],
   "Operations":[
      {
         "op":"remove",
         "path":"members",
         "value":[
            {
               "value":"aaebb169-b91d-481c-9957-097faeaf649a"
            }
         ]
      }
   ]
}

This is not how the SCIM spec says how to remove a single member from a group, but should be easy enough to handle this case of request.

This PR adds a special case in the DefaultPatchHandler to convert these requests to the acceptable and spec-compliant form.

));

ScimGroup updatedGroup = patchHandler.apply(group(), List.of(op));
assertThat(updatedGroup.getMembers().size()).isEqualTo(3);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: may want to assert on the members of the to ensure member collection contains the expected new value

@bdemers
Copy link
Member

bdemers commented Dec 19, 2023

@kjthorpe18 Can you rebase one more time?
After that 4ded7f3 should apply clean, and we should be able to ship it!

@kjthorpe18 kjthorpe18 force-pushed the handle-azure-group-member-removes branch from 3b762b5 to cd7bd90 Compare December 19, 2023 01:43
@kjthorpe18 kjthorpe18 requested a review from bdemers December 19, 2023 01:45
Detects Azure Quirk mode.
Azure uses an out of spec patch operation that does not use an express,
but instead uses a remove with a value.  Detect this and convert it to an expression

 {
  "op":"remove",
  "path":"members",
  "value":[{
    "value":"<id>"
  }]
}
@bdemers bdemers merged commit 5eef635 into apache:develop Dec 19, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants