Skip to content

Conversation

@Ryanmeakins
Copy link
Contributor

@Ryanmeakins Ryanmeakins commented May 28, 2020

Problem: The provider base class does not return any values for resource types or schemas. Therefore running the sample as is with the InMemory provider returns empty arrays when calling the endpoints.
Solution: In order to increase the usefulness of the sample provider sample values have been added to the returned collection for Types and Schemas.
Validation: The included Postman tests for endpoint validation.

@mllab-nl
Copy link

mllab-nl commented Aug 10, 2020

Good PR @Ryanmeakins
@ArvindHarinder1 Any reason it is not being merged ?

Copy link
Collaborator

@peteretelej peteretelej left a comment

Choose a reason for hiding this comment

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

Approving to unblock, since payload matches spec. I think this endpoint also requires Auth (at the moment accessible without auth).

Also, the /Schemas endpoint should list all attributes supported by the endpoint ( see RFC here)

An HTTP GET to the endpoint "/Schemas" SHALL return all supported schemas in ListResponse format

A few attributes are missing from those supported by this scim app. For example for User resource: nickName, timezone, roles, and some subattributes eg in name.

Comment on lines 201 to 205
AttributeScheme nameScheme = new AttributeScheme("name", AttributeDataType.complex, false);
nameScheme.Description = SampleConstants.DescriptionName;
nameScheme.AddSubAttribute(FormattedNameAttributeScheme);
nameScheme.AddSubAttribute(GivenNameAttributeScheme);
return nameScheme;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The Name attribute in this endpoint supports other subattributes (eg FamilyName, HonorificPrefix, HonorificSuffix) but are not added here hence not returned in /Schemas (see here). /Schemas should include all supported attributes / subattributes of the scim endpoint

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 the attributes returned should match what the API supports.

@charitymarani charitymarani force-pushed the EndpointFixes branch 3 times, most recently from 41a636e to 045be9c Compare May 12, 2021 18:15
@blairno
Copy link

blairno commented Jul 20, 2021

The latest version of this branch returns an empty "schemas" array when creating a new user.
For example, using the following payload to POST a new User resource:
{ "UserName": "UserName222", "Active": true, "DisplayName": "lennay", "schemas": [ "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User", "urn:ietf:params:scim:schemas:core:2.0:User" ], "externalId": "${__UUID}", "name": { "formatted": "Adrew Ryan", "familyName": "Ryan", "givenName": "Andrew" }, "emails": [ { "Primary": true, "type": "work", "value": "testing@bob2.com" }, { "Primary": false, "type": "home", "value": "testinghome@bob3.com" } ], "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": { "Department": "bob", "Manager" : { "Value": "SuzzyQ" } } }

The returned response is as follows (the "schemas" attribute is an empty array).
{ "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": { "manager": { "value": "SuzzyQ" }, "department": "bob" }, "active": true, "displayName": "lennay", "emails": [ { "type": "work", "primary": true, "value": "testing@bob2.com" }, { "type": "home", "primary": false, "value": "testinghome@bob3.com" } ], "meta": { "resourceType": "User" }, "name": { "formatted": "Adrew Ryan", "familyName": "Ryan", "givenName": "Andrew" }, "userName": "UserName222", "externalId": "${__UUID}", "id": "13b49587-4efd-46ad-af94-ee9f54874fda", "schemas": [] }

This does not happen with the Master branch, which correctly returns the expected array of "schemas".

Reversing the 2 line change in "Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Schematized.cs" seems to fix that issue on my machine, but I am not sure what else that might impact or what the original purpose of that change was.

I think the issue is that in the change the "IReadOnlyCollection Schemas" field is being decorated as the DataMember named "Schemas" which returns an empty array when it is serialized into json since I don't think "IReadOnlyCollection" supports serialization.
Prior to the change, the "List schemas" field was decorated as the DataMember named "Schemas" which is able to be successfully serialized.
^^^ @charitymarani

@charitymarani
Copy link
Contributor

charitymarani commented Jul 27, 2021

The latest version of this branch returns an empty "schemas" array when creating a new user.
For example, using the following payload to POST a new User resource:
{ "UserName": "UserName222", "Active": true, "DisplayName": "lennay", "schemas": [ "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User", "urn:ietf:params:scim:schemas:core:2.0:User" ], "externalId": "${__UUID}", "name": { "formatted": "Adrew Ryan", "familyName": "Ryan", "givenName": "Andrew" }, "emails": [ { "Primary": true, "type": "work", "value": "testing@bob2.com" }, { "Primary": false, "type": "home", "value": "testinghome@bob3.com" } ], "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": { "Department": "bob", "Manager" : { "Value": "SuzzyQ" } } }

The returned response is as follows (the "schemas" attribute is an empty array).
{ "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": { "manager": { "value": "SuzzyQ" }, "department": "bob" }, "active": true, "displayName": "lennay", "emails": [ { "type": "work", "primary": true, "value": "testing@bob2.com" }, { "type": "home", "primary": false, "value": "testinghome@bob3.com" } ], "meta": { "resourceType": "User" }, "name": { "formatted": "Adrew Ryan", "familyName": "Ryan", "givenName": "Andrew" }, "userName": "UserName222", "externalId": "${__UUID}", "id": "13b49587-4efd-46ad-af94-ee9f54874fda", "schemas": [] }

This does not happen with the Master branch, which correctly returns the expected array of "schemas".

Reversing the 2 line change in "Microsoft.SystemForCrossDomainIdentityManagement/Schemas/Schematized.cs" seems to fix that issue on my machine, but I am not sure what else that might impact or what the original purpose of that change was.

I think the issue is that in the change the "IReadOnlyCollection Schemas" field is being decorated as the DataMember named "Schemas" which returns an empty array when it is serialized into json since I don't think "IReadOnlyCollection" supports serialization.
Prior to the change, the "List schemas" field was decorated as the DataMember named "Schemas" which is able to be successfully serialized.
^^^ @charitymarani

@blairno I just confirmed the issue. Thank you for noticing. I have pushed new changes

    - Fix type property's value in atttributes schema to be camelCase
    - Add subAttributes to complex types
    - Add schemas attribute to Schema resource
    - Remove all unused imports
    - Put all using statements inside namespace
    - Fix typos in the code
    - Use expression body where necessary
    - Add Authentication
@owinoakelo owinoakelo merged commit b2b13fa into master Aug 3, 2021
charitymarani pushed a commit that referenced this pull request Aug 10, 2021
* Adds returning of sample resource types from the endpoint

* Adds sample schema types support

* fix: Make schema discovery response SCIM compliant

    - Fix type property's value in atttributes schema to be camelCase
    - Add subAttributes to complex types
    - Add schemas attribute to Schema resource
    - Remove all unused imports
    - Put all using statements inside namespace
    - Fix typos in the code
    - Use expression body where necessary
    - Add Authentication

Co-authored-by: RyanE <v-ryeaki@microsoft.com>
Co-authored-by: Charity Marani <cmarani@microsoft.com>
charitymarani pushed a commit that referenced this pull request Aug 10, 2021
* Adds returning of sample resource types from the endpoint

* Adds sample schema types support

* fix: Make schema discovery response SCIM compliant

    - Fix type property's value in atttributes schema to be camelCase
    - Add subAttributes to complex types
    - Add schemas attribute to Schema resource
    - Remove all unused imports
    - Put all using statements inside namespace
    - Fix typos in the code
    - Use expression body where necessary
    - Add Authentication

Co-authored-by: RyanE <v-ryeaki@microsoft.com>
Co-authored-by: Charity Marani <cmarani@microsoft.com>
charitymarani pushed a commit that referenced this pull request Aug 10, 2021
* Adds returning of sample resource types from the endpoint

* Adds sample schema types support

* fix: Make schema discovery response SCIM compliant

    - Fix type property's value in atttributes schema to be camelCase
    - Add subAttributes to complex types
    - Add schemas attribute to Schema resource
    - Remove all unused imports
    - Put all using statements inside namespace
    - Fix typos in the code
    - Use expression body where necessary
    - Add Authentication

Co-authored-by: RyanE <v-ryeaki@microsoft.com>
Co-authored-by: Charity Marani <cmarani@microsoft.com>
charitymarani pushed a commit that referenced this pull request Aug 10, 2021
* Adds returning of sample resource types from the endpoint

* Adds sample schema types support

* fix: Make schema discovery response SCIM compliant

    - Fix type property's value in atttributes schema to be camelCase
    - Add subAttributes to complex types
    - Add schemas attribute to Schema resource
    - Remove all unused imports
    - Put all using statements inside namespace
    - Fix typos in the code
    - Use expression body where necessary
    - Add Authentication

Co-authored-by: RyanE <v-ryeaki@microsoft.com>
Co-authored-by: Charity Marani <cmarani@microsoft.com>
charitymarani added a commit that referenced this pull request Aug 10, 2021
* Adds returning of sample resource types from the endpoint

* Adds sample schema types support

* fix: Make schema discovery response SCIM compliant

    - Fix type property's value in atttributes schema to be camelCase
    - Add subAttributes to complex types
    - Add schemas attribute to Schema resource
    - Remove all unused imports
    - Put all using statements inside namespace
    - Fix typos in the code
    - Use expression body where necessary
    - Add Authentication

Co-authored-by: RyanE <v-ryeaki@microsoft.com>
Co-authored-by: Charity Marani <cmarani@microsoft.com>

Co-authored-by: Ryanmeakins <Ryanmeakins@gmail.com>
Co-authored-by: RyanE <v-ryeaki@microsoft.com>
Co-authored-by: Charity Marani <cmarani@microsoft.com>
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.

/schemas and /ResourceTypes endpoints returning empty result

10 participants