yaal-coop / scim2-models

SCIM resources serialization and validation with Pydantic
https://scim2-models.readthedocs.io
Apache License 2.0
5 stars 2 forks source link

Attribute names should be case insensitive #39

Closed ccoors closed 19 hours ago

ccoors commented 3 days ago

I'm trying to build a SCIM provider that passes the MS Entra Validation Tests by porting the Postman tests to Python. One part of the tests attempts to create a user from this payload:

{
    "UserName": "UserName123",
    "Active": True,
    "DisplayName": "BobIsAmazing",
    "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0:User"
    ],
    "externalId": uuid.uuid4().hex,
    "name": {
        "formatted": "Ryan Leenay",
        "familyName": "Leenay",
        "givenName": "Ryan"
    },
    "emails": [
        {
            "Primary": True,
            "type": "work",
            "value": "testing@bob.com"
        },
        {
            "Primary": False,
            "type": "home",
            "value": "testinghome@bob.com"
        }
    ]
}

This does not work, as attributes are handled in a case-sensitive manner:

User.model_validate(
    {... payload from above},
    scim_ctx=Context.RESOURCE_CREATION_REQUEST,
)
Field 'user_name' is required but value is missing or null [type=required_error, input_value={'UserName': 'UserName123...'testinghome@bob.com'}]}, input_type=dict]

According to RFC 7643, Section 2.1

Attribute names are case insensitive and are often "camel-cased" (e.g., "camelCase").

This is also supported by RFC 7644, Section 3.10

All facets (URN, attribute, and sub-attribute name) of the fully encoded attribute name are case insensitive.

azmeuk commented 3 days ago

Thank you for your detailed bug report. I will look at this soon.

azmeuk commented 19 hours ago

This is fixed in 0.1.11. Please tell me if it good for you, and do not hesitate to open new bug reports if other Entra validation tests are failing.