Captain-P-Goldfish / SCIM-SDK

a scim implementation as described in RFC7643 and RFC7644
https://github.com/Captain-P-Goldfish/SCIM/wiki
BSD 3-Clause "New" or "Revised" License
122 stars 38 forks source link

[Fixes #629] Lenient content type header checking #636

Closed haster closed 6 months ago

haster commented 6 months ago

Interoperability considerations: The "application/scim+json" media type is intended to identify JSON structure data that conforms to the SCIM protocol and schema specifications. Older versions of SCIM are known to informally use "application/json".

and also (regarding the Accept header):

Service providers MUST support the "Accept" header "Accept: application/scim+json" and SHOULD support the header "Accept: application/json", both of which specify JSON documents conforming to [RFC7159]. The format defaults to "application/scim+json" if no format is specified.

This also fits in with general good practices, which suggest to be lenient with regards to your input, but strict with regards to your output.

Captain-P-Goldfish commented 6 months ago

The code looks good so far but I am missing some unit tests. At least for a Bulk request and one for patch, update and create.

haster commented 6 months ago

Hey, I think I added unit tests for all cases as part of the rework of the UriInfosTest.

For instance https://github.com/Captain-P-Goldfish/SCIM-SDK/pull/636/files#diff-6dc7aa8282c79aae1fd2be4602b0f769b83bc8cd0daf2c0aabb05f4cc4cc4aabR227 and https://github.com/Captain-P-Goldfish/SCIM-SDK/pull/636/files#diff-6dc7aa8282c79aae1fd2be4602b0f769b83bc8cd0daf2c0aabb05f4cc4cc4aabR328

Are you missing anything?

(I just noticed I copied the javadoc for all new testmethods, I'll push an update to rewrite that.)

haster commented 6 months ago

Hey, while testing I noticed I forgot to actually save the lenientContentType configuration parameter. I pushed a small commit 45bff8c to fix that.