simpleidserver / SimpleIdServer

OpenID, OAuth 2.0, SCIM2.0, UMA2.0, FAPI, CIBA & OPENBANKING Framework for ASP.NET Core
https://simpleidserver.com/
Apache License 2.0
683 stars 90 forks source link

[SCIM] - PATCH group support 'value eq' #696

Closed danflomin closed 4 months ago

danflomin commented 5 months ago

Hi, how are you?

Is it supported to have a PATCH with a filter on the full_path?

For example, to remove a group membership using this kind of body -

{
    "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
    "Operations": [{
        "op": "remove",
        "path": "members[value eq \"89bb1940-b905-4575-9e7f-6f887cfb368e\"]"
        }]
    }]
}

I tried this form in my UTs, and it seems to not work.

To make sure my tests are correct, I'd like your help with testing this as well. If it is not supported, then fixing this issue would be awesome!

Kind regards Dan

danflomin commented 5 months ago

I think that the following line in SCIMRepresentationExtensions can be improved to the latter. It fixes this issue IMO.

Current

if (SCIMFilterParser.DontContainsFilter(patch.Path) && patch.Value != null)

New

if (SCIMFilterParser.DontContainsFilter(patch.Path) && patch.Value != null && patch.Value is JObject or JArray)
simpleidserver commented 5 months ago

Hello,

I hope you are doing well.

The remove operations specified in the HTTP PATCH request can support this kind of path members[value eq "ID"] property. Which version of the SCIM package are you using? If you are using version 4.0.6, could you please test it with the NuGet package version 4.0.7-rc1? This new package contains some bug fixes and no breaking changes :).

I have created a Postman project to demonstrate that this scenario is supported by the latest version of the SCIM project.

Ticket696.postman_collection.json

KR,

SID.

danflomin commented 4 months ago

Hello, It seems like my UT framework had an issue which caused this bug to occur. The issue is resolved.

Thank you for your willingness to help.